[pacman-dev] [PATCH] Print callback messages to stderr

Dan McGee dpmcgee at gmail.com
Sat Aug 20 11:11:11 EDT 2011


On Sat, Aug 20, 2011 at 7:58 AM, Dave Reisner <d at falconindy.com> wrote:
> On Sat, Aug 20, 2011 at 03:15:34PM +1000, Allan McRae wrote:
>> On 20/08/11 12:42, Allan McRae wrote:
>> >Fixes FS#25099.
>> >
>> >Signed-off-by: Allan McRae<allan at archlinux.org>
>> >---
>> >  src/pacman/callback.c |    2 +-
>> >  1 files changed, 1 insertions(+), 1 deletions(-)
>> >
>> >diff --git a/src/pacman/callback.c b/src/pacman/callback.c
>> >index 873e3fc..5ee4e5a 100644
>> >--- a/src/pacman/callback.c
>> >+++ b/src/pacman/callback.c
>> >@@ -690,7 +690,7 @@ void cb_log(alpm_loglevel_t level, const char *fmt, va_list args)
>> >                     output = alpm_list_add(output, string);
>> >             }
>> >     } else {
>> >-            pm_vfprintf(stdout, level, fmt, args);
>> >+            pm_vfprintf(stderr, level, fmt, args);
>> >     }
>> >  }
>> >
>>
>>
>> This breaks some pactests because stdout/stderr output is not being
>> kept in sync so timestamps with --debug get printed all over the
>> place. e.g.
>>
>> > ./src/pacman/pacman -T glibc --debug
>> <snip>
>> debug: unregistering database 'local'
>> debug: freeing package cache for repository 'local'
>> debug: unregistering database 'allanbrokeit'
>> debug: unregistering database 'kernel64'
>> debug: unregistering database 'testing'
>> debug: unregistering database 'core'
>> debug: unregistering database 'extra'
>> debug: unregistering database 'community-testing'
>> debug: unregistering database 'community'
>> [15:11:34] [15:11:34] [15:11:34] [15:11:34] [15:11:34] [15:11:34]
>> [15:11:34] [15:11:34] [15:11:34]
>>
>>
>
> Wouldn't it make more sense to write the timestamps to stderr along with
> the logging they belong to? If someone were to enable --debug and send
> stderr off to a file, you'd see some really weird output.

Yes- we shouldn't be trying to multiplex stderr and stdout correctly
on the same line. These need to both go to the same place, and why
aren't they printed in the same printf() invocation?

-Dan


More information about the pacman-dev mailing list