Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
fae8d26
cc-wrapper, bintools-wrapper: Remove now unneeded `set {+,-}u`
Ericson2314 Nov 5, 2019
cdbbaa9
cmake: CMAKE_*_PATH can be undefined
Ericson2314 Nov 5, 2019
2c1d9d8
i-score: CMAKE_PREFIX_PATH can be undefined
Ericson2314 Nov 5, 2019
770a4c7
glib: Fix setup hook
Ericson2314 Nov 6, 2019
42ffaf5
cmake: NIX_CFLAGS_COMPILE NIX_LDFLAG could be undefined
Ericson2314 Nov 6, 2019
9167482
opensp: `sgmlHookDone` can be undefined
Ericson2314 Nov 6, 2019
67cc85e
OCaml findlib: OCAMLPATH could be undefined
Ericson2314 Nov 6, 2019
0b90a7f
lispPackages.clwrapper: NIX_LISP_LD_LIBRARY_PATH might be undefined
Ericson2314 Nov 6, 2019
aaf0fd2
lua-5 setup hook: LUA_PATH and LUA_CPATH can be undefined
Ericson2314 Nov 6, 2019
b78e840
gdk-pixbuf setup hook: GDK_PIXBUF_MODULE_FILE might not be defined
Ericson2314 Nov 7, 2019
beda036
darwin private frameworks setup hook: NIX_CFLAGS_COMPILE may be undef…
Ericson2314 Nov 7, 2019
12a85a7
SDL, SDL2: SDL{,2}_PATH may be undefined
Ericson2314 Nov 7, 2019
908b143
gstreamer: GST_PLUGIN_SYSTEM_PATH.* may be undefined
Ericson2314 Nov 7, 2019
6fb526b
findlib setup hook: `createFindlibDestdir` may not be defined
Ericson2314 Nov 7, 2019
f1481f2
apple-sdk setup hooks: NIX_CFLAGS_COMPILE may be undefined
Ericson2314 Nov 7, 2019
ca78249
emacs package setup hook: Fix
Ericson2314 Nov 7, 2019
784c3dc
qt5 qmake setup hook: `qmakeFlags` may be undefined
Ericson2314 Nov 8, 2019
f7fdc99
Merge commit 'afa48f16f265fd3e88073bca7929e1e103bd3dc3' into bash-no-…
Ericson2314 Nov 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions nixos/doc/manual/release-notes/rl-2003.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@
<link linkend="opt-networking.interfaces">networking.interfaces.&lt;name&gt;.…</link> options.
</para>
</listitem>
<listitem>
<para>
The stdenv now runs all bash with <literal>set -u</literal>, to catch the use of undefined variables.
Before, it itself used <literal>set -u</literal> but was careful to unset it so other packages' code ran as before.
Now, all bash code is held to the same high standard, and the rather complex stateful manipulation of the options can be discarded.
</para>
</listitem>
</itemizedlist>
</section>

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/audio/i-score/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ stdenv.mkDerivation rec {
];

preConfigure = ''
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH:$(echo "${jamomacore}/jamoma/share/cmake/Jamoma")"
export CMAKE_PREFIX_PATH="''${CMAKE_PREFIX_PATH-}:$(echo "${jamomacore}/jamoma/share/cmake/Jamoma")"
'';

postInstall = ''rm $out/bin/i-score.sh'';
Expand Down
13 changes: 1 addition & 12 deletions pkgs/build-support/bintools-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,13 @@ stdenv.mkDerivation {

installPhase =
''
set -u

mkdir -p $out/bin $out/nix-support

wrap() {
local dst="$1"
local wrapper="$2"
export prog="$3"
set +u
substituteAll "$wrapper" "$out/bin/$dst"
set -u
chmod +x "$out/bin/$dst"
}
''
Expand Down Expand Up @@ -163,8 +159,6 @@ stdenv.mkDerivation {
[[ -e "$underlying" ]] || continue
wrap ${targetPrefix}$variant ${./ld-wrapper.sh} $underlying
done

set +u
'';

emulation = let
Expand Down Expand Up @@ -205,11 +199,7 @@ stdenv.mkDerivation {
];

postFixup =
''
set -u
''

+ optionalString (libc != null) (''
optionalString (libc != null) (''
##
## General libc support
##
Expand Down Expand Up @@ -307,7 +297,6 @@ stdenv.mkDerivation {
''

+ ''
set +u
substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh
substituteAll ${./add-hardening.sh} $out/nix-support/add-hardening.sh
substituteAll ${../wrapper-common/utils.bash} $out/nix-support/utils.bash
Expand Down
3 changes: 0 additions & 3 deletions pkgs/build-support/bintools-wrapper/setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
#
# See comments in cc-wrapper's setup hook. This works exactly the same way.

set -u

# Skip setup hook if we're neither a build-time dep, nor, temporarily, doing a
# native compile.
#
Expand Down Expand Up @@ -73,4 +71,3 @@ export NIX_HARDENING_ENABLE

# No local scope in sourced file
unset -v role_pre role_post cmd upper_case
set +u
8 changes: 4 additions & 4 deletions pkgs/build-support/build-dotnet-package/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ attrsOrig @
configurePhase = ''
runHook preConfigure

[ -z "$dontPlacateNuget" ] && placate-nuget.sh
[ -z "$dontPlacatePaket" ] && placate-paket.sh
[ -z "$dontPatchFSharpTargets" ] && patch-fsharp-targets.sh
[ -z "''${dontPlacateNuget-}" ] && placate-nuget.sh
[ -z "''${dontPlacatePaket-}" ] && placate-paket.sh
[ -z "''${dontPatchFSharpTargets-}" ] && patch-fsharp-targets.sh

runHook postConfigure
'';
Expand Down Expand Up @@ -69,7 +69,7 @@ attrsOrig @

cp -rv ${arrayToShell outputFiles} "''${outputFilesArray[@]}" "$target"

if [ -z "$dontRemoveDuplicatedDlls" ]
if [ -z "''${dontRemoveDuplicatedDlls-}" ]
then
pushd "$out"
remove-duplicated-dlls.sh
Expand Down
4 changes: 0 additions & 4 deletions pkgs/build-support/cc-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,6 @@ stdenv.mkDerivation {

installPhase =
''
set -u

mkdir -p $out/bin $out/nix-support

wrap() {
Expand Down Expand Up @@ -224,8 +222,6 @@ stdenv.mkDerivation {

postFixup =
''
set -u

# Backwards compatability for packages expecting this file, e.g. with
# `$NIX_CC/nix-support/dynamic-linker`.
#
Expand Down
3 changes: 0 additions & 3 deletions pkgs/build-support/cc-wrapper/setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@
# For more details, read the individual files where the mechanisms used to
# accomplish this will be individually documented.

set -u

# Skip setup hook if we're neither a build-time dep, nor, temporarily, doing a
# native compile.
#
Expand Down Expand Up @@ -120,4 +118,3 @@ export NIX_HARDENING_ENABLE

# No local scope in sourced file
unset -v role_pre role_post
set +u
6 changes: 3 additions & 3 deletions pkgs/build-support/emacs/setup-hook.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
addEmacsVars () {
if test -d $1/share/emacs/site-lisp; then
export EMACSLOADPATH="$1/share/emacs/site-lisp:$EMACSLOADPATH"
if [[ -d "$1/share/emacs/site-lisp" ]]; then
export EMACSLOADPATH="$1/share/emacs/site-lisp${EMACSLOADPATH:+:}${EMACSLOADPATH-}"
fi
}

# If this is for a wrapper derivation, emacs and the dependencies are all
# run-time dependencies. If this is for precompiling packages into bytecode,
# emacs is a compile-time dependency of the package.
addEnvHooks "$targetOffset" addEmacsVars
addEnvHooks "$hostOffset" addEmacsVars
addEnvHooks "$targetOffset" addEmacsVars
2 changes: 1 addition & 1 deletion pkgs/build-support/setup-hooks/audit-tmpdir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# the moment that would produce too many spurious errors (e.g. debug
# info or assertion messages that refer to $TMPDIR).

fixupOutputHooks+=('if [ -z "$noAuditTmpdir" -a -e "$prefix" ]; then auditTmpdir "$prefix"; fi')
fixupOutputHooks+=('if [[ -z "${noAuditTmpdir-}" && -e "$prefix" ]]; then auditTmpdir "$prefix"; fi')

auditTmpdir() {
local dir="$1"
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/setup-hooks/auto-patchelf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ autoPatchelf() {
# behaviour as fixupOutputHooks because the setup hook for patchelf is run in
# fixupOutput and the postFixup hook runs later.
postFixupHooks+=('
if [ -z "$dontAutoPatchelf" ]; then
if [ -z "${dontAutoPatchelf-}" ]; then
autoPatchelf -- $(for output in $outputs; do
[ -e "${!output}" ] || continue
echo "${!output}"
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/setup-hooks/compress-man-pages.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fixupOutputHooks+=('if [ -z "$dontGzipMan" ]; then compressManPages "$prefix"; fi')
fixupOutputHooks+=('if [ -z "${dontGzipMan-}" ]; then compressManPages "$prefix"; fi')

compressManPages() {
local dir="$1"
Expand Down
4 changes: 2 additions & 2 deletions pkgs/build-support/setup-hooks/find-xml-catalogs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ addXMLCatalogs () {
done
}

if [ -z "$libxmlHookDone" ]; then
if [ -z "${libxmlHookDone-}" ]; then
libxmlHookDone=1

# Set up XML_CATALOG_FILES. An empty initial value prevents
# xmllint and xsltproc from looking in /etc/xml/catalog.
export XML_CATALOG_FILES
export XML_CATALOG_FILES=''
if [ -z "$XML_CATALOG_FILES" ]; then XML_CATALOG_FILES=" "; fi
addEnvHooks "$hostOffset" addXMLCatalogs
fi
2 changes: 1 addition & 1 deletion pkgs/build-support/setup-hooks/move-lib64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
fixupOutputHooks+=(_moveLib64)

_moveLib64() {
if [ "$dontMoveLib64" = 1 ]; then return; fi
if [ "${dontMoveLib64-}" = 1 ]; then return; fi
if [ ! -e "$prefix/lib64" -o -L "$prefix/lib64" ]; then return; fi
echo "moving $prefix/lib64/* to $prefix/lib"
mkdir -p $prefix/lib
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/setup-hooks/move-sbin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
fixupOutputHooks+=(_moveSbin)

_moveSbin() {
if [ "$dontMoveSbin" = 1 ]; then return; fi
if [ "${dontMoveSbin-}" = 1 ]; then return; fi
if [ ! -e "$prefix/sbin" -o -L "$prefix/sbin" ]; then return; fi
echo "moving $prefix/sbin/* to $prefix/bin"
mkdir -p $prefix/bin
Expand Down
6 changes: 3 additions & 3 deletions pkgs/build-support/setup-hooks/multiple-outputs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ _assignFirst() {
local varName="$1"
local REMOVE=REMOVE # slightly hacky - we allow REMOVE (i.e. not a variable name)
shift
while [ $# -ge 1 ]; do
if [ -n "${!1}" ]; then eval "${varName}"="$1"; return; fi
while (( $# )); do
if [ -n "${!1-}" ]; then eval "${varName}"="$1"; return; fi
shift
done
echo "Error: _assignFirst found no valid variant!"
Expand All @@ -19,7 +19,7 @@ _assignFirst() {

# Same as _assignFirst, but only if "$1" = ""
_overrideFirst() {
if [ -z "${!1}" ]; then
if [ -z "${!1-}" ]; then
_assignFirst "$@"
fi
}
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/setup-hooks/patch-shebangs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ patchShebangs() {
}

patchShebangsAuto () {
if [ -z "$dontPatchShebangs" -a -e "$prefix" ]; then
if [ -z "${dontPatchShebangs-}" -a -e "$prefix" ]; then

# Dev output will end up being run on the build platform. An
# example case of this is sdl2-config. Otherwise, we can just
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/setup-hooks/prune-libtool-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
fixupOutputHooks+=(_pruneLibtoolFiles)

_pruneLibtoolFiles() {
if [ "$dontPruneLibtoolFiles" ] || [ ! -e "$prefix" ]; then
if [ "${dontPruneLibtoolFiles-}" ] || [ ! -e "$prefix" ]; then
return
fi

Expand Down
4 changes: 2 additions & 2 deletions pkgs/build-support/setup-hooks/strip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _doStrip() {
local -ra stripCmds=(STRIP TARGET_STRIP)

# Optimization
if [[ "$STRIP" == "$TARGET_STRIP" ]]; then
if [[ "${STRIP-}" == "${TARGET_STRIP-}" ]]; then
dontStripTarget+=1
fi

Expand All @@ -20,7 +20,7 @@ _doStrip() {
local -n stripCmd="${stripCmds[$i]}"

# `dontStrip` disables them all
if [[ "$dontStrip" || "$flag" ]] || ! type -f "$stripCmd" 2>/dev/null
if [[ "${dontStrip-}" || "${flag-}" ]] || ! type -f "${stripCmd-}" 2>/dev/null
then continue; fi

stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
preConfigurePhases+=" updateAutotoolsGnuConfigScriptsPhase"

updateAutotoolsGnuConfigScriptsPhase() {
if [ -n "$dontUpdateAutotoolsGnuConfigScripts" ]; then return; fi
if [ -n "${dontUpdateAutotoolsGnuConfigScripts-}" ]; then return; fi

for script in config.sub config.guess; do
for f in $(find . -type f -name "$script"); do
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/setup-hooks/wrap-gapps-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ wrapGApp() {
wrapProgram "$program" "${gappsWrapperArgs[@]}" "$@"
}

# Note: $gappsWrapperArgs still gets defined even if $dontWrapGApps is set.
# Note: $gappsWrapperArgs still gets defined even if ${dontWrapGApps-} is set.
wrapGAppsHook() {
# guard against running multiple times (e.g. due to propagation)
[ -z "$wrapGAppsHookHasRun" ] || return 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ let cpuName = stdenv.hostPlatform.parsed.cpu.name;

# Set JAVA_HOME automatically.
cat <<EOF >> $out/nix-support/setup-hook
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
EOF
'';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ let result = stdenv.mkDerivation rec {

# Set JAVA_HOME automatically.
cat <<EOF >> "$out/nix-support/setup-hook"
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
EOF
'';

Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/graalvm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ in rec {
# Set JAVA_HOME automatically.
mkdir -p $out/nix-support
cat <<EOF > $out/nix-support/setup-hook
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
EOF
'';
postFixup = openjdk.postFixup or null;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/graalvm/enterprise-edition.nix
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ let
# Set JAVA_HOME automatically.
mkdir -p $out/nix-support
cat <<EOF > $out/nix-support/setup-hook
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
EOF
'';

Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/openjdk/11.nix
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ let
# Set JAVA_HOME automatically.
mkdir -p $out/nix-support
cat <<EOF > $out/nix-support/setup-hook
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out/lib/openjdk; fi
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out/lib/openjdk; fi
EOF
'';

Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/openjdk/8.nix
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ let
# Set JAVA_HOME automatically.
mkdir -p $out/nix-support
cat <<EOF > $out/nix-support/setup-hook
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out/lib/openjdk; fi
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out/lib/openjdk; fi
EOF
'';

Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/openjdk/darwin/11.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ let

# Set JAVA_HOME automatically.
cat <<EOF >> $out/nix-support/setup-hook
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
EOF
'';

Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/openjdk/darwin/8.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ let

# Set JAVA_HOME automatically.
cat <<EOF >> $out/nix-support/setup-hook
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
EOF
'';

Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/openjdk/darwin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ let

# Set JAVA_HOME automatically.
cat <<EOF >> $out/nix-support/setup-hook
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
EOF
'';

Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/openjdk/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ let
# Set JAVA_HOME automatically.
mkdir -p $out/nix-support
cat <<EOF > $out/nix-support/setup-hook
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out/lib/openjdk; fi
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out/lib/openjdk; fi
EOF
'';

Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/oraclejdk/jdk-linux-base.nix
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ let result = stdenv.mkDerivation rec {

# Set JAVA_HOME automatically.
cat <<EOF >> $out/nix-support/setup-hook
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
EOF
'';

Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/rust/setup-hook.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Fix 'failed to open: /homeless-shelter/.cargo/.package-cache' in rust 1.36.
if [[ -z $IN_NIX_SHELL && -z $CARGO_HOME ]]; then
if [[ -z ${IN_NIX_SHELL-} && -z ${CARGO_HOME-} ]]; then
export CARGO_HOME=$TMPDIR
fi
2 changes: 1 addition & 1 deletion pkgs/development/compilers/zulu/8.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ in stdenv.mkDerivation {

# Set JAVA_HOME automatically.
cat <<EOF >> $out/nix-support/setup-hook
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
EOF
'';

Expand Down
Loading