Stuart Henderson
2021-Mar-18 10:27 UTC
bug: some table header(?) output goes to stderr instead of stdout
On 2021-03-18, Marc <Marc at f1-outsourcing.eu> 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).
Marc
2021-Mar-18 21:21 UTC
bug: some table header(?) output goes to stderr instead of stdout
> On 2021-03-18, Marc <Marc at f1-outsourcing.eu> 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.
Joseph Tam
2021-Mar-18 22:32 UTC
bug: some table header(?) output goes to stderr instead of stdout
On 2021-03-18, Marc <Marc at f1-outsourcing.eu> 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 > ba955a6d6218950f42e5b0ee0a33a916Strange -- 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 theheader 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 <jtam.home at gmail.com>