RE: bug: some table header(?) output goes to stderr instead of stdout

2021-03-19 Thread Marc

> 
> Strange -- my version (2.3.10) dumps headers to stdout, not stderr
> 
No not strange ;) stupid of me not to mention that I am still on el7 
distribution (dovecot-2.2.36-8.el7.x86_64). But I think I will move to the 
vendor packages soon, now that centos8 is eol and only stream is available.



Re: bug: some table header(?) output goes to stderr instead of stdout

2021-03-18 Thread Joseph Tam

On 2021-03-18, Marc  wrote:


[@ sbin]# doveadm -f table -o 
mail_location=mdbox_deleted:/home/popusers/testtest/mdbox:INDEX=/home/popindex/testtest/index
 fetch -u testtest 'guid' mailbox INBOX 2> /dev/null
3c967f33b8aea671f3551db1ea8e33e9
6fa01ccc103a7009c7b940657dbcd72c
ba955a6d6218950f42e5b0ee0a33a916


Strange -- my version (2.3.10) dumps headers to stdout, not stderr

# doveadm -f table fetch -u $user guid mailbox INBOX 2>/dev/null | cat 
-n | head -3
1  guid
2  8104226179c70d7cc248c9924cabdb8c
3  0813554a7ed4cf1e113f42a4cc8bc477


From a strictly design point of view, this seems more correct as the

header is part of the data, not "out of band" output like errors.  If headers
are pumped to stderr, you can always employ shell hacks (as a followup poster
did) to unify them to stdout

# doveadm -f table fetch ... 2>&1

Maybe it's better to add another formatter to avoid tricky parsing
or shell hacks e.g.

# doveadm -f tab-nohdr ...

Joseph Tam 


RE: bug: some table header(?) output goes to stderr instead of stdout

2021-03-18 Thread Marc
> On 2021-03-18, Marc  wrote:
> >
> > [@ sbin]# doveadm -f table -o
> mail_location=mdbox_deleted:/home/popusers/testtest/mdbox:INDEX=/home/po
> pindex/testtest/index fetch -u testtest 'guid' mailbox INBOX 2>
> /dev/null
> > 3c967f33b8aea671f3551db1ea8e33e9
> > 6fa01ccc103a7009c7b940657dbcd72c
> > ba955a6d6218950f42e5b0ee0a33a916
> >
> > [@ sbin]# doveadm -f table -o
> mail_location=mdbox_deleted:/home/popusers/testtest/mdbox:INDEX=/home/po
> pindex/testtest/index fetch -u testtest 'guid' mailbox INBOX
> > guid
> > 3c967f33b8aea671f3551db1ea8e33e9
> > 6fa01ccc103a7009c7b940657dbcd72c
> > ba955a6d6218950f42e5b0ee0a33a916
> >
> >
> >
> 
> That's a useful feature, saves messing about to exclude the headers when
> you
> want to use the results to fetch messages as shown in doveadm-search(1).
> 

Using stderr/stdout like this is not according to standards. But I do get that, 
I was tryig to do that with tail -n +1, and thought wtf is it not working!!! ;)
There could be a nasty side effect, if someone starts redirecting 2>/dev/null 
because of this table header. He will not get a real error.





Re: bug: some table header(?) output goes to stderr instead of stdout

2021-03-18 Thread Stuart Henderson
On 2021-03-18, Marc  wrote:
>
> [@ sbin]# doveadm -f table -o 
> mail_location=mdbox_deleted:/home/popusers/testtest/mdbox:INDEX=/home/popindex/testtest/index
>  fetch -u testtest 'guid' mailbox INBOX 2> /dev/null
> 3c967f33b8aea671f3551db1ea8e33e9
> 6fa01ccc103a7009c7b940657dbcd72c
> ba955a6d6218950f42e5b0ee0a33a916
>
> [@ sbin]# doveadm -f table -o 
> mail_location=mdbox_deleted:/home/popusers/testtest/mdbox:INDEX=/home/popindex/testtest/index
>  fetch -u testtest 'guid' mailbox INBOX
> guid
> 3c967f33b8aea671f3551db1ea8e33e9
> 6fa01ccc103a7009c7b940657dbcd72c
> ba955a6d6218950f42e5b0ee0a33a916
>
>
>

That's a useful feature, saves messing about to exclude the headers when you
want to use the results to fetch messages as shown in doveadm-search(1).




bug: some table header(?) output goes to stderr instead of stdout

2021-03-18 Thread Marc

[@ sbin]# doveadm -f table -o 
mail_location=mdbox_deleted:/home/popusers/testtest/mdbox:INDEX=/home/popindex/testtest/index
 fetch -u testtest 'guid' mailbox INBOX 2> /dev/null
3c967f33b8aea671f3551db1ea8e33e9
6fa01ccc103a7009c7b940657dbcd72c
ba955a6d6218950f42e5b0ee0a33a916

[@ sbin]# doveadm -f table -o 
mail_location=mdbox_deleted:/home/popusers/testtest/mdbox:INDEX=/home/popindex/testtest/index
 fetch -u testtest 'guid' mailbox INBOX
guid
3c967f33b8aea671f3551db1ea8e33e9
6fa01ccc103a7009c7b940657dbcd72c
ba955a6d6218950f42e5b0ee0a33a916