bugmake - Bugs: bug #33134, spurious error when stdout is...


bug #33134: spurious error when stdout is already closed

Submitted by:  David Boyce <boyski>
Submitted on:  Thu 21 Apr 2011 01:03:09 AM UTC  
Severity: 3 - NormalItem Group: Bug
Status: FixedPrivacy: Public
Assigned to: Paul D. Smith <psmith>Open/Closed: Closed
Component Version: 4.0Operating System: None
Fixed Release: 4.0Triage Status: None

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sun 15 Sep 2013 12:41:08 AM UTC, comment #3:

Applied a fix along these lines.

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Thu 21 Apr 2011 04:25:22 PM UTC, comment #2:

My original one-line patch had two mistakes, which may be a record! In the course of work for enhancement #33138 I made a macro:

#define STREAM_OK(strm) ((fcntl(fileno((strm)), F_GETFD) != -1) || (errno != EBADF))

whose logic would be much better than the original ftell(). Turns out that on many platforms ftell cannot be used on a non-seekable descriptor at all. My development is on Solaris where ftell works as a go/no-go indicator, but that isn't portable. And the EBADF test is required for reasons which are obvious and also discussed in the email thread.

David Boyce <boyski>
Thu 21 Apr 2011 12:55:34 PM UTC, comment #1:

Note that there is a thread on the bug-make mailing list discussing this in some detail:


David Boyce <boyski>
Thu 21 Apr 2011 01:03:09 AM UTC, original submission:

Ironically, make's attempt to be super-duper careful about catching write errors to stdout (in the close_stdout function) results in a spurious error message when the user has already closed stdout:

% cat makefile
.PHONY: all
all:; date

% make 1>&-
make: write error

Patch attached.

David Boyce <boyski>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #23282:  make-stdout-patch added by boyski (418B - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by psmith (Posted a comment)
  • -unavailable- added by boyski (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 15 Sep 2013 12:41:08 AM UTCpsmithStatusNone=>Fixed
      Assigned toNone=>psmith
      Fixed ReleaseNone=>4.0
    Thu 21 Apr 2011 01:03:09 AM UTCboyskiAttached File-=>Added make-stdout-patch, #23282

    Back to the top

    Powered by Savane 3.1-cleanup1