bugmake - Bugs: bug #52912, minor bug in GNU make's own...

 
 

bug #52912: minor bug in GNU make's own Makefile under .ONESHELL

Submitter:  David Boyce <boyski>
Submitted:  Tue 16 Jan 2018 02:12:06 PM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Wont Fix Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  4.2.1 Operating System:  POSIX-Based
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 16 Jan 2018 05:28:01 PM UTC, comment #4: 

Yes, I understand you weren't suggesting the fake "bash" be on PATH. But I still think it's an unfortunate hack.

I've been using the build of make itself as a test/demo for a related build tool I'm working on. I'm under no illusion that the rest of the world is a friendlier place for .ONESHELL but I did think it would be nice if GNU make could support its own feature.

How about adding a special variable POSIXSHELL with the same semantics as SHELL except for (a) taking precedence and (b) declaring it to be POSIX compatible?

David Boyce <boyski>
Tue 16 Jan 2018 05:05:33 PM UTC, comment #3: 

I'm saying that if you hope to be able to force ONESHELL with a non-standard shell on a wide variety of different makefiles, you're going to have this problem in spades and fixing all those individual makefiles to allow it is Quixotic... or Sisyphean, if you prefer :).

I wasn't suggesting you should name your wrapper "bash" or "dash" then stick it in the PATH somewhere.  You could add it to a test directory (or whatever) where it wouldn't normally be seen, then just set it directly as SHELL, only to make.  You can even call the script something else, then create a symlink named "sh" or "dash" or whatever, and point make's SHELL at that.

I'm not sure about having all prerequisites of .ONESHELL refer to POSIX shells... I don't see why we'd expect that to be the case.  I think it would lead to confusion.

I'm going to close this but we can continue to discuss options in the comments.

Paul D. Smith <psmith>
Group administrator
Tue 16 Jan 2018 03:58:12 PM UTC, comment #2: 

Hmm. When you say "I think that your use-case is going to cause lots of other problems", I'm not sure whether you're referring to the make build model per se or the greater universe of makefiles. I'm aware that .ONESHELL has certain pitfalls in the greater universe (I contributed the feature originally, after all :-) but this is the only problem it causes in making make, at least on Linux.

And wrt "convince make that your shell IS a POSIX shell (if indeed it is)": "my shell" is just a wrapper which accepts the usual -c, -e, -x flags, adds its own value, and passes the command string along to /bin/sh. So yes it's a POSIX shell in all but name but I don't think renaming it "bash" or "dash" would be appropriate.

Since .ONESHELL currently has no defined prerequisites, possibly they could be used to extend the set of POSIX shells? E.g.

# make --eval=".ONESHELL:<myshell>" SHELL=<myshell>

This isn't a real problem for me, I just thought I'd report it. No complaint if it has to be closed as unfixable.

David Boyce <boyski>
Tue 16 Jan 2018 03:24:09 PM UTC, comment #1: 

Unfortunately, Makefile.in is generated by automake and that rule is part of automake's autogenerated content, it's not part of GNU make, so there's not much we can do about it (at least, not easily).

I think that your use-case is going to cause lots of other problems and I'm not sure it's feasible to change all the makefiles to make them work in this mode.

Instead I think it would be better to convince make that your shell IS a POSIX shell (if indeed it is).  Maybe someday a new option that would define a shell as POSIX-compatible would be appropriate for GNU make although I can't think of a nice way to manage it offhand.

In the meantime, you can change the name of your shell (or make a symlink to it) to one of the POSIX-compatible shells that make knows about (sh, bash, ksh, rksh, zsh, ash, dash) and set SHELL=/path/to/my/sh and then make should be mollified.

Paul D. Smith <psmith>
Group administrator
Tue 16 Jan 2018 02:12:06 PM UTC, original submission:  

This is a very minor bug but easily fixed (patch inline). A recipe in Makefile.in has two consecutive lines starting with @ which the manual says is incompatible with .ONESHELL unless the shell is recognized as POSIX-compatible. Therefore, when overriding both i.e.:

# make --eval=.ONESHELL: SHELL=<myshell>

The error "@test: command not found" is emitted.

--- Makefile.in 2016-06-10 16:03:22.000000000 -0700
+++ ../../make-4.2.1/Makefile.in 2018-01-15 21:35:02.827437149 -0800
@@ -570,8 +570,8 @@
 $(am__aclocal_m4_deps):

 config.h: stamp-h1
- @test -f $@ || rm -f stamp-h1
- @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
+ @test -f $@ || rm -f stamp-h1 && \
+ test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1

 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
  @rm -f stamp-h1

David Boyce <boyski>

 

(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)
  • -email is unavailable- added by boyski (Submitted the item)
  •  

    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
    2018-01-16 psmith StatusNone Wont Fix
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code