1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

bin/package: do not use previously compiled shell

The package script searches for a good shell to run the build
scripts, preferring a ksh. But it also finds any recently compiled
development version of ksh in arch/*/bin that may be broken, or
have debug code, etc. -- and uses that in preference to anything
else. This is quite capable of breaking the build process.

The way to get around it is to do something like
	bin/package make SHELL=/bin/ksh
which is annoying to have to keep doing.

bin/package,
src/cmd/INIT/package.sh:
- When finding a good shell, use the saved user path ($path), not
  the current $PATH which includes arch/$HOSTTYPE/bin. Prefix this
  temporary path with `getconf PATH`, the system's default path,
  so that known-good system shells are found first.
This commit is contained in:
Martijn Dekker 2020-08-26 17:11:18 +01:00
parent 42092187a7
commit e08ca80d15
2 changed files with 34 additions and 42 deletions

View file

@ -3076,31 +3076,27 @@ cat $INITROOT/$i.sh
# grab a decent default shell
checksh "$SHELL" || KEEP_SHELL=0
case $KEEP_SHELL in
0) executable "$SHELL" || SHELL=
case $SHELL in
?*) checksh $SHELL || SHELL= ;;
esac
case $SHELL in
''|/bin/*|/usr/bin/*)
case $SHELL in
'') SHELL=/bin/sh ;;
esac
for i in ksh sh bash
do if onpath $i && checksh $_onpath_
then SHELL=$_onpath_
break
fi
done
;;
*/*ksh) if executable $KSH
then SHELL=$KSH
0) save_PATH=$PATH
if PATH=`getconf PATH 2>/dev/null`
then PATH=$PATH:$path
else PATH=/bin:/usr/bin:/sbin:/usr/sbin:$path
fi
for i in ksh ksh93 mksh yash bash sh
do if onpath "$i" && checksh "$_onpath_"
then SHELL=$_onpath_
KEEP_SHELL=1
break
fi
;;
done
PATH=$save_PATH
unset save_PATH
case $KEEP_SHELL in
0) echo "Cannot find good default shell, please supply SHELL=/path/to/shell" >&2
exit 1 ;;
esac
;;
*) checksh $SHELL || SHELL=/bin/sh
;;
esac
export SHELL
$show SHELL=$SHELL

View file

@ -3075,31 +3075,27 @@ cat $INITROOT/$i.sh
# grab a decent default shell
checksh "$SHELL" || KEEP_SHELL=0
case $KEEP_SHELL in
0) executable "$SHELL" || SHELL=
case $SHELL in
?*) checksh $SHELL || SHELL= ;;
esac
case $SHELL in
''|/bin/*|/usr/bin/*)
case $SHELL in
'') SHELL=/bin/sh ;;
esac
for i in ksh sh bash
do if onpath $i && checksh $_onpath_
then SHELL=$_onpath_
break
fi
done
;;
*/*ksh) if executable $KSH
then SHELL=$KSH
0) save_PATH=$PATH
if PATH=`getconf PATH 2>/dev/null`
then PATH=$PATH:$path
else PATH=/bin:/usr/bin:/sbin:/usr/sbin:$path
fi
for i in ksh ksh93 mksh yash bash sh
do if onpath "$i" && checksh "$_onpath_"
then SHELL=$_onpath_
KEEP_SHELL=1
break
fi
;;
done
PATH=$save_PATH
unset save_PATH
case $KEEP_SHELL in
0) echo "Cannot find good default shell, please supply SHELL=/path/to/shell" >&2
exit 1 ;;
esac
;;
*) checksh $SHELL || SHELL=/bin/sh
;;
esac
export SHELL
$show SHELL=$SHELL