GNU bug report logs - #8408
A possible tee bug?

Previous Next

Package: coreutils;

Reported by: George Goffe <goffe <at> google.com>

Date: Fri, 1 Apr 2011 20:41:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8408 in the body.
You can then email your comments to 8408 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#8408; Package coreutils. (Fri, 01 Apr 2011 20:41:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to George Goffe <goffe <at> google.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Fri, 01 Apr 2011 20:41:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: George Goffe <goffe <at> google.com>
To: bug-coreutils <at> gnu.org
Subject: A possible tee bug?
Date: Fri, 1 Apr 2011 13:36:58 -0700
[Message part 1 (text/plain, inline)]
Howdy,

I have run several scripts and seen this behavior in all cases...

tee somescript | tee somescript.log 2>&1

The contents of the log is missing a lot of activity... messages and so
forth. Is it possible that there are other file descriptors being used for
these messages?

Regards,

George...
[Message part 2 (text/html, inline)]

Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#8408; Package coreutils. (Fri, 01 Apr 2011 21:35:01 GMT) Full text and rfc822 format available.

Message #8 received at 8408 <at> debbugs.gnu.org (full text, mbox):

From: "Alan Curry" <pacman-cu <at> kosh.dhis.org>
To: goffe <at> google.com (George Goffe)
Cc: 8408 <at> debbugs.gnu.org
Subject: Re: bug#8408: A possible tee bug?
Date: Fri, 1 Apr 2011 16:34:30 -0500 (GMT+5)
George Goffe writes:
> 
> Howdy,
> 
> I have run several scripts and seen this behavior in all cases...
> 
> tee somescript | tee somescript.log 2>&1
> 
> The contents of the log is missing a lot of activity... messages and so
> forth. Is it possible that there are other file descriptors being used for
> these messages?

I can't tell what you're trying to do from this incomplete example, but it
looks like you're expecting the 2>&1 to do something other than what it's
actually doing. It's only pointing the second tee's stderr to wherever its
stdout was going.

If the above pipeline is run in isolation from an interactive shell prompt,
the 2>&1 is accomplishing nothing at all, since stderr and stdout will
already be going to the same place (the tty) anyway.

tee's stderr will normally be empty; it would only print an error message
there if it had trouble writing to somescript.log.

Post a more complete description of your intent.

-- 
Alan Curry




Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#8408; Package coreutils. (Fri, 01 Apr 2011 22:38:02 GMT) Full text and rfc822 format available.

Message #11 received at 8408 <at> debbugs.gnu.org (full text, mbox):

From: George Goffe <goffe <at> google.com>
To: Alan Curry <pacman-cu <at> kosh.dhis.org>
Cc: 8408 <at> debbugs.gnu.org
Subject: Re: bug#8408: A possible tee bug?
Date: Fri, 1 Apr 2011 15:36:57 -0700
[Message part 1 (text/plain, inline)]
Alan,

Oops. I goofed... My apologies.

The example would be this "somescript | tee somescript.log 2>&1".

The intent is to capture all the output (stdout and stderr) from
"somescript". "somescript" runs several commands that may or may not utilize
other FDs. I was hoping to get a better output than what you might get from
the script command which records all the messages + a ton of other things
like escapes which are a pain to eliminate.

Does this make better sense?

Regards,

George...

On Fri, Apr 1, 2011 at 2:34 PM, Alan Curry <pacman-cu <at> kosh.dhis.org> wrote:

> George Goffe writes:
> >
> > Howdy,
> >
> > I have run several scripts and seen this behavior in all cases...
> >
> > tee somescript | tee somescript.log 2>&1
> >
> > The contents of the log is missing a lot of activity... messages and so
> > forth. Is it possible that there are other file descriptors being used
> for
> > these messages?
>
> I can't tell what you're trying to do from this incomplete example, but it
> looks like you're expecting the 2>&1 to do something other than what it's
> actually doing. It's only pointing the second tee's stderr to wherever its
> stdout was going.
>
> If the above pipeline is run in isolation from an interactive shell prompt,
> the 2>&1 is accomplishing nothing at all, since stderr and stdout will
> already be going to the same place (the tty) anyway.
>
> tee's stderr will normally be empty; it would only print an error message
> there if it had trouble writing to somescript.log.
>
> Post a more complete description of your intent.
>
> --
> Alan Curry
>
[Message part 2 (text/html, inline)]

Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#8408; Package coreutils. (Fri, 01 Apr 2011 22:42:01 GMT) Full text and rfc822 format available.

Message #14 received at 8408 <at> debbugs.gnu.org (full text, mbox):

From: "Alan Curry" <pacman-cu <at> kosh.dhis.org>
To: goffe <at> google.com (George Goffe)
Cc: 8408 <at> debbugs.gnu.org
Subject: Re: bug#8408: A possible tee bug?
Date: Fri, 1 Apr 2011 17:41:11 -0500 (GMT+5)
George Goffe writes:
> Alan,
> 
> Oops. I goofed... My apologies.
> 
> The example would be this "somescript | tee somescript.log 2>&1".
> 
> The intent is to capture all the output (stdout and stderr) from
> "somescript". "somescript" runs several commands that may or may not utilize
> other FDs. I was hoping to get a better output than what you might get from
> the script command which records all the messages + a ton of other things
> like escapes which are a pain to eliminate.
> 
> Does this make better sense?

Well, you still have the 2>&1 in the wrong place. If you want it to affect
the stderr of the command to the left of the pipe, you have to put it to the
left of the pipe.





Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#8408; Package coreutils. (Fri, 01 Apr 2011 22:54:01 GMT) Full text and rfc822 format available.

Message #17 received at 8408 <at> debbugs.gnu.org (full text, mbox):

From: George Goffe <goffe <at> google.com>
To: Alan Curry <pacman-cu <at> kosh.dhis.org>
Cc: 8408 <at> debbugs.gnu.org
Subject: Re: bug#8408: A possible tee bug?
Date: Fri, 1 Apr 2011 15:53:01 -0700
[Message part 1 (text/plain, inline)]
Alan,

Thank you for your help.

Sorry to bother you with such a trivial "problem". I'm still learning "unix"
after all these years. Sigh.

Have a GREAT weekend and, again, Thanks.

George...

On Fri, Apr 1, 2011 at 3:41 PM, Alan Curry <pacman-cu <at> kosh.dhis.org> wrote:

> George Goffe writes:
> > Alan,
> >
> > Oops. I goofed... My apologies.
> >
> > The example would be this "somescript | tee somescript.log 2>&1".
> >
> > The intent is to capture all the output (stdout and stderr) from
> > "somescript". "somescript" runs several commands that may or may not
> utilize
> > other FDs. I was hoping to get a better output than what you might get
> from
> > the script command which records all the messages + a ton of other things
> > like escapes which are a pain to eliminate.
> >
> > Does this make better sense?
>
> Well, you still have the 2>&1 in the wrong place. If you want it to affect
> the stderr of the command to the left of the pipe, you have to put it to
> the
> left of the pipe.
>
>
[Message part 2 (text/html, inline)]

Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Sat, 02 Apr 2011 00:07:02 GMT) Full text and rfc822 format available.

Notification sent to George Goffe <goffe <at> google.com>:
bug acknowledged by developer. (Sat, 02 Apr 2011 00:07:02 GMT) Full text and rfc822 format available.

Message #22 received at 8408-done <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: George Goffe <goffe <at> google.com>
Cc: 8408-done <at> debbugs.gnu.org
Subject: Re: bug#8408: A possible tee bug?
Date: Sat, 02 Apr 2011 01:05:17 +0100
On 01/04/11 23:36, George Goffe wrote:
> Alan,
> 
> Oops. I goofed... My apologies.
> 
> The example would be this "somescript | tee somescript.log 2>&1".
> 
> The intent is to capture all the output (stdout and stderr) from
> "somescript". "somescript" runs several commands that may or may not utilize
> other FDs.

somescript 2>&1 | tee log

> I was hoping to get a better output than what you might get from
> the script command which records all the messages + a ton of other things
> like escapes which are a pain to eliminate.

You could also try using `script` and then
later filtering the output through something like
http://www.pixelbeat.org/scripts/ansi2html.sh

cheers,
Pádraig




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 30 Apr 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 58 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.