makeWrapper: Remove unused extraFlagsArray feature

There is a bug in this feature: It allows extra arguments to leak in
from the environment. For example:

  $ export extraFlagsArray=date
  $ man ls

Note that you get the man page for date rather than for ls. This happens
because 'man' happens to use a wrapper (to add groff to its PATH).

An attempt to fix this was made in 5ae18574fc in PR #19328 for
issue #2537, but 1. That change didn't actually fix the problem because
it addressed makeWrapper's environment during the build process, not the
constructed wrapper script's environment after installation, and 2. That
change was apparently accidentally lost when merged with 7ff6eec5fd.

Rather than trying to fix the bug again, we remove the extraFlagsArray
feature, since it has never been used in the public repo in the ten
years it has been available.

wrapAclocal continues to use its own, separate flavor of extraFlagsArray
in a more limited context. The analogous bug there was fixed in
4d7d10da6b in 2011.
This commit is contained in:
Chuck 2019-09-10 15:52:53 -07:00
parent fe5a295a22
commit a45b3ad89f
No known key found for this signature in database
GPG Key ID: 79326851F2ED75D6
5 changed files with 5 additions and 12 deletions

View File

@ -19,9 +19,6 @@ assertExecutable() {
# the environment
# --unset VAR : remove VAR from the environment
# --run COMMAND : run command before the executable
# The command can push extra flags to a magic list
# variable extraFlagsArray, which are then added to
# the invocation of the executable
# --add-flags FLAGS : add FLAGS to invocation of executable
# --prefix ENV SEP VAL : suffix/prefix ENV with VAL, separated by SEP
@ -109,12 +106,8 @@ makeWrapper() {
fi
done
# Note: extraFlagsArray is an array containing additional flags
# that may be set by --run actions.
# Silence warning about unexpanded extraFlagsArray:
# shellcheck disable=SC2016
echo exec ${argv0:+-a \"$argv0\"} \""$original"\" \
"$flagsBefore" '"${extraFlagsArray[@]}"' '"$@"' >> "$wrapper"
"$flagsBefore" '"$@"' >> "$wrapper"
chmod +x "$wrapper"
}

View File

@ -16,7 +16,7 @@ wrapGSMake() {
export GNUSTEP_CONFIG_FILE="$config"
exec "$wrapped" "\$@" "\${extraFlagsArray[@]}"
exec "$wrapped" "\$@"
EOF
chmod +x "$program"
}

View File

@ -9,4 +9,4 @@ fi
initString+="]}}"
exec -a "$0" "@out@/bin/@wrapped@" "${initString}" "${extraFlagsArray[@]}" "$@"
exec -a "$0" "@out@/bin/@wrapped@" "${initString}" "$@"

View File

@ -9,4 +9,4 @@ fi
initString+="]}"
exec -a "$0" "@out@/bin/@wrapped@" "${initString}" "${extraFlagsArray[@]}" "$@"
exec -a "$0" "@out@/bin/@wrapped@" "${initString}" "$@"

View File

@ -97,7 +97,7 @@ let
cat > "$out/bin/simutrans" <<EOF
#!${runtimeShell}
cd "$out"/share/simutrans
exec "${binaries}/bin/simutrans" -use_workdir "\''${extraFlagsArray[@]}" "\$@"
exec "${binaries}/bin/simutrans" -use_workdir "\$@"
EOF
chmod +x "$out/bin/simutrans"
'';