bugmake - Bugs: bug #49681, Make fails to glob lib/*.{o,a}

 
 

bug #49681: Make fails to glob lib/*.{o,a}

Submitted by:  None
Submitted on:  Wed 23 Nov 2016 12:18:08 PM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: Not A BugPrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 4.1Operating 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.

 

Wed 23 Nov 2016 03:25:29 PM UTC, comment #1:

Any commands inside a recipe are passed to the shell, not interpreted by make. If that command is behaving differently it's due to some change in your environment or configuration, not because of a change in GNU make.

Note that by default, GNU make (as all makes) always uses /bin/sh as the shell to run recipes, and never the user's shell. The standard POSIX shell doesn't define brace-expansion, so it won't recognize that glob expression.

Some distributions install bash as /bin/sh and if that's true then you'll get (at least some of) the bash extensions by default in GNU make recipes. Other distributions install dash, ksh, or some other shell as /bin/sh and if that's true you won't get any bash extensions.

If you want to write your recipes using bash extensions then you should explicitly set SHELL in your makefile to /bin/bash:

If you don't want to do that, you should be sure to write your recipes using only standard POSIX shell features and not extensions:

Paul D. Smith <psmith>
Project Administrator
Wed 23 Nov 2016 12:18:08 PM UTC, original submission:

This is a regression from GNU make 4.0. The make target

clean:
rm lib/*.{o,a}

fails to remove files lib/foo.o, lib/bar.o, and lib/libfoobar.a because lib/.{o,a} does not glob lib/.o and lib/*.a, as is its intention.

This is very different from how the shell globs things:
$ echo lib/*.{o,a}
lib/foo.o lib/bar.o lib/libfoobar.a

(Maybe related to http://savannah.gnu.org/bugs/index.php?18123)

Anonymous

 

(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)
  •  

    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
    Wed 23 Nov 2016 03:25:29 PM UTCpsmithStatusNone=>Not A Bug
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1