Skip to contentSkip to conversation

Extra checks for PERL_PATH and SHELL_PATH?

PATCH In review Matt Kraai 2 participants 5 messages Jun 15, 2016

Subsystems (2)
lore
Share & tools
lore

Matt Kraai

author
#0 lore raw

Hi,

The top-level Makefile currently contains

Quoted 6 lines

ifndef SHELL_PATH
SHELL_PATH = /bin/sh
endif
ifndef PERL_PATH
PERL_PATH = /usr/bin/perl
endif

The checks are only necessary if these variables need to be overridden by environment variables, not just via the make command line. Is this the case?

Signature · 1 line
Matt Kraai                                           http://ftbfs.org/
#1 lore raw
Quoted 9 lines · Matt Kraai

The top-level Makefile currently contains

Quoted 6 lines

ifndef SHELL_PATH
SHELL_PATH = /bin/sh
endif
ifndef PERL_PATH
PERL_PATH = /usr/bin/perl
endif

Quoted 3 lines

The checks are only necessary if these variables need to be overridden by environment variables, not just via the make command line. Is this the case?

It may not have been the original intention, but the above would mean that some people may have learned to run "SHELL_PATH=/bin/ksh make" and changing it would break things for them, no?

I do not think changing them is bad per-se, but we would need to add extra warnings in the release note to explain this change, that's all. This would only affect people who build from the source (including distro people) so it is not really a big deal.

author
#2 lore raw

PATCH 1/1 Makefile: set PERL_PATH and SHELL_PATH unconditionally

Do not check whether PERL_PATH and SHELL_PATH are undefined before setting their default values. This prevents them from being set via environment variables.

---

Quoted 11 lines · Junio C Hamano
Quoted 9 lines · Matt Kraai

The top-level Makefile currently contains

Quoted 6 lines

ifndef SHELL_PATH
SHELL_PATH = /bin/sh
endif
ifndef PERL_PATH
PERL_PATH = /usr/bin/perl
endif

Quoted 7 lines
Quoted 3 lines

The checks are only necessary if these variables need to be overridden by environment variables, not just via the make command line. Is this the case?

It may not have been the original intention, but the above would mean that some people may have learned to run "SHELL_PATH=/bin/ksh make" and changing it would break things for them, no?

Yes, that's what I was concerned about. This appears to be possible for PERL_PATH on all platforms and for SHELL_PATH on platforms other than SCO UnixWare, SunOS, and IRIX.

Quoted 4 lines

I do not think changing them is bad per-se, but we would need to add extra warnings in the release note to explain this change, that's all. This would only affect people who build from the source (including distro people) so it is not really a big deal.

I hope this patch is OK.

 Documentation/RelNotes-1.6.6.txt |    3 +++
 Makefile                         |    8 ++------
 2 files changed, 5 insertions(+), 6 deletions(-)
Documentation/RelNotes-1.6.6.txt +3 -0
index 5f1fecb..bfda14c 100644
@@ -58,3 +58,6 @@ release, unless otherwise noted.
    whitespace attribute).  The 'trailing-space' whitespace error class has
    become a short-hand to cover both of these and there is no behaviour
    change for existing set-ups.
+
+ * PERL_PATH and SHELL_PATH may not be overridden using environment
+   variables during the build.
Makefile +2 -6
index 42b7d60..5bac305 100644
@@ -392,12 +392,8 @@ ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
 OTHER_PROGRAMS = git$X
 
 # Set paths to tools early so that they can be used for version tests.
-ifndef SHELL_PATH
-	SHELL_PATH = /bin/sh
-endif
-ifndef PERL_PATH
-	PERL_PATH = /usr/bin/perl
-endif
+SHELL_PATH = /bin/sh
+PERL_PATH = /usr/bin/perl
 
 export PERL_PATH
 
Signature · 1 line
1.6.5
#3 lore raw

Re: [PATCH] Makefile: set PERL_PATH and SHELL_PATH unconditionally

Quoted 3 lines · Matt Kraai

Do not check whether PERL_PATH and SHELL_PATH are undefined before setting their default values. This prevents them from being set via environment variables.

Is there an upside of "preventing them from getting set", by the way?

author
#4 lore raw

Re: [PATCH] Makefile: set PERL_PATH and SHELL_PATH unconditionally

Quoted 7 lines · Junio C Hamano
Quoted 3 lines · Matt Kraai

Do not check whether PERL_PATH and SHELL_PATH are undefined before setting their default values. This prevents them from being set via environment variables.

Is there an upside of "preventing them from getting set", by the way?

Not that I know of.

I originally thought that the checks were superfluous, but now I just believe they're inconsistent and confusing to people like me who think they understand Makefiles but don't. :)

Signature · 1 line
Matt Kraai                                             http://ftbfs.org/