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 Apr 21 01:03:09 2011  
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 MarkupRich Markup):

You are not logged in

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


Sun Sep 15 00:41:08 2013, comment #3:

Applied a fix along these lines.

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Thu Apr 21 16:25:22 2011, 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 Apr 21 12:55:34 2011, comment #1:

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


David Boyce <boyski>
Thu Apr 21 01:03:09 2011, 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 Sep 15 00:41:08 2013psmithStatusNone=>Fixed
      Assigned toNone=>psmith
      Fixed ReleaseNone=>4.0
    Thu Apr 21 01:03:09 2011boyskiAttached File-=>Added make-stdout-patch, #23282

    Back to the top

    Powered by Savane 3.1-cleanup1