delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/01/29/15:54:45

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
From: "Tim Van Holder" <tim DOT van DOT holder AT pandora DOT be>
To: <djgpp-workers AT delorie DOT com>
Subject: Small bash issue with #! handling
Date: Tue, 29 Jan 2002 21:54:22 +0100
Message-ID: <000301c1a907$20ea5d60$997c76d5@zastaixp>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook, Build 10.0.3416
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Importance: Normal
Reply-To: djgpp-workers AT delorie DOT com

Hi,

autoconf 2.52 tested for the path separator using

# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
  echo "#! $SHELL" >conftest.sh
  echo  "exit 0"   >>conftest.sh
  chmod +x conftest.sh
  if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then
    PATH_SEPARATOR=';'
  else
    PATH_SEPARATOR=:
  fi
  rm -f conftest.sh
fi

This works fine.
However, this caused failures on OS/2, so it was
changed to

# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
  echo "#! /bin/sh" >conftest.sh
  echo  "exit 0"   >>conftest.sh
  chmod +x conftest.sh
  if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then
    PATH_SEPARATOR=';'
  else
    PATH_SEPARATOR=:
  fi
  rm -f conftest.sh
fi

(i.e. use '#! /bin/sh' instead of '#! $SHELL').

This causes ':' to be found for DJGPP, which is not a
problem during the configure run, as bash handles either
case.  But the deduced value can also be used in Makefiles
or output scripts, and that may cause problems because the
pathsep used may not agree with the environment (as
PATH_SEPARATOR wasn't set).

The reason things fail is that our bash handles '#! /bin/sh'
by looking for sh along the path, and PATH is effectively
reduced to '.' for the purpose of this test.
I would suggest that bash should always tack on $DJDIR/bin
and/or dirname(argv0-of-bash) to PATH for the purpose of
these lookups (or look in $DJDIR/bin first for any /[s]bin,
/usr/[s]bin or /usr/local/[s]bin paths).

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019