bugmake - Bugs: bug #57674, GNU make doesn't use default path...

 
 

bug #57674: GNU make doesn't use default path if PATH not set

Submitted by:  Natanael Copa <ncopa>
Submitted on:  Mon 27 Jan 2020 11:41:55 AM UTC  
 
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  Paul D. Smith <psmith> Open/Closed:  Closed
Component Version:  4.3 Operating System:  POSIX-Based
Fixed Release:  SCM Triage Status:  Small Effort

Add a New Comment (Rich Markup)
   

You are not logged in

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

 

Wed 01 Apr 2020 06:05:40 AM UTC, comment #3: 

I pushed a fix for this.  Thanks for reporting!

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Tue 31 Mar 2020 11:32:48 PM UTC, comment #2: 

I know why this happens.

In GNU make prior to 4.3 we used the execvp() system call to invoke commands.  This call behaves like this (from the man page):

> The file is sought in the colon-separated list of directory pathnames
> specified in the PATH environment variable.  If this variable isn't
> defined,  the path list defaults to a list that includes the directories
> returned by confstr(_CS_PATH) (which typically returns the value
> "/bin:/usr/bin")


In GNU make 4.3, for performance reasons we choose to use posix_spawn() if it's available on the system.  posix_spawn() doesn't do any path search, so we do it ourselves and we don't have this backup default PATH lookup that execvp() does.

While it could be argued either way, I think this is probably something we should fix in GNU make so I'm going to leave this open.

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Thu 30 Jan 2020 10:25:30 AM UTC, comment #1: 

This may not be a bug in make. `env -i` will unset $PATH so I guess this is expected behavior.

I guess this can be closed.

Natanael Copa <ncopa>
Mon 27 Jan 2020 11:41:55 AM UTC, original submission:  

(I tried to send this to -email is unavailable- but is seems to have been redirected to /dev/null by some spam filter or similar)

Hi,

I believe there is a regression in make 4.3. To reproduce:

$ make -v
GNU Make 4.3
Built for x86_64-alpine-linux-musl
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ cat Makefile
all:
@echo \$(CC)
$ make -sf Makefile
cc
$ cat Makefile  | env -i make -sf -
make: echo: No such file or directory
make: *** [/tmp/GmOCOMgl:2: all] Error 127

Problem was found in the configure script of mandoc (mdocml).

  CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | env -i make -sf -`

https://cvsweb.bsd.lv/mandoc/configure?rev=1.71&content-type=text/x-cvsweb-markup

Downstream bug report:
https://gitlab.alpinelinux.org/alpine/aports/issues/11163

Thanks!

-nc

Natanael Copa <ncopa>

 

(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 ncopa (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-04-01 psmith StatusNone => Fixed
        Open/ClosedOpen => Closed
        Fixed ReleaseNone => SCM
    2020-03-31 psmith Assigned toNone => psmith
        Triage StatusNone => Small Effort
    2020-03-31 psmith Summaryregression in make 4.3 with makefile from stdin => GNU make doesn't use default path if PATH not set

    Back to the top


    Powered by Savane 3.5