bugmake - Bugs: bug #30614, Output redirection with &>...

 
 

bug #30614: Output redirection with &> not parsed correctly in make 3.81 and up

Submitted by:  Joey Adams <joeyalanadams>
Submitted on:  Sun 01 Aug 2010 04:46:57 AM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: Not A BugPrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 4.0Operating System: POSIX-Based
Fixed Release: NoneTriage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Fri 06 Aug 2010 05:24:19 AM UTC, comment #2:

See the GNU make manual (or the POSIX standard for make) for a discussion of which shell is used and the details surrounding the SHELL make variable.

Paul D. Smith <psmith>
Project Administrator
Sun 01 Aug 2010 05:10:12 AM UTC, comment #1:

Update:

The issue turned out to be make using /bin/sh instead of bash. Only the latter supports the &> syntax.

Joey Adams <joeyalanadams>
Sun 01 Aug 2010 04:46:57 AM UTC, original submission:

Given the following Makefile:

all:
@echo "You shouldn't be seeing this." &> /dev/null

GNU Make 3.80 has the expected behavior, which is to redirect stdout/stderr to /dev/null .

3.81, 3.82, and CVS do not redirect either stdout or stderr. Instead, the echo command is backgrounded, and the output appears in the terminal.

If I replace &> with >& (which also works in GNU Make 3.80):

all:
@echo "You shouldn't be seeing this." >& /dev/null

I get the following error message:

/bin/sh: Syntax error: Bad fd number
make: *** [all] Error 2

Here is a workaround for redirecting stdout/stderr that does work in GNU Make 3.81 and up:

all:
@(echo "You shouldn't be seeing this." 2>&1) > /dev/null

Joey Adams <joeyalanadams>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

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 joeyalanadams (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 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 06 Aug 2010 05:24:19 AM UTCpsmithStatusNone=>Not A Bug
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1