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

 
 

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

Submitter:  None
Submitted:  Wed 23 Nov 2016 12:18:08 PM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Not A Bug Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  4.1 Operating System:  POSIX-Based
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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:


SHELL := /bin/bash

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


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:


clean: ; rm lib/*.o lib/*.a


Paul D. Smith <psmith>
Group 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 Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-11-23 psmith StatusNone Not A Bug
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code