From 13a1d5883c9aa81ee10d61cbe4c2f2223dad9a50 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 14 Feb 2012 10:11:43 -0600 Subject: scripts: unset CDPATH if cd is used This wonderful/awful little bash shell variable wrecks havoc on `cd` calls in shell scripts. Unset CDPATH in makepkg where we use `cd` quite heavily. In pacman-optimize, we can move the change directory logic into the bsdtar call so we are left with no usages of `cd` in the script. Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts/makepkg.sh.in') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 80bb1c94..5e8687e7 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -36,6 +36,8 @@ export TEXTDOMAINDIR='@localedir@' # file -i does not work on Mac OSX unless legacy mode is set export COMMAND_MODE='legacy' +# Ensure CDPATH doesn't screw with our cd calls +unset CDPATH myver='@PACKAGE_VERSION@' confdir='@sysconfdir@' -- cgit v1.2.3-24-g4f1b From edd81f3e8b505be2f7c7a18d3c28956b82264c45 Mon Sep 17 00:00:00 2001 From: Christoph Vigano Date: Tue, 14 Feb 2012 21:31:04 +0100 Subject: makepkg: fix syntax error in remove_deps This fixes a problem that occurs if you tell makepkg to remove installed dependencies (just to be sure) but there are none. As the $ was missing in front of deplist, the check never happened and 'pacman -Rn' was called which obviously failed. Dan: later reported as FS#28448. Signed-off-by: Christoph Vigano Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/makepkg.sh.in') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 5e8687e7..9766c8c6 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -521,7 +521,7 @@ remove_deps() { local deplist deplist=($(grep -xvFf <(printf "%s\n" "${original_pkglist[@]}") \ <(printf "%s\n" "${current_pkglist[@]}") || true)) - if [[ -z deplist ]]; then + if [[ -z $deplist ]]; then return fi -- cgit v1.2.3-24-g4f1b From ca4142714137b16feabac09c4cda86b0a75036f8 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Wed, 15 Feb 2012 22:50:51 -0500 Subject: parseopts: normalize options into an array Modify parse_options logic to fill an array instead of printing parsed options. Avoid eval like the plague. Because it is the plague. Fixes bugs such as FS#28445. Signed-off-by: Dave Reisner Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts/makepkg.sh.in') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 9766c8c6..805c31a9 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1906,11 +1906,11 @@ OPT_LONG+=",version,config:" # Pacman Options OPT_LONG+=",noconfirm,noprogressbar" -if ! OPT_TEMP="$(parse_options $OPT_SHORT $OPT_LONG "$@")"; then +if ! parse_options $OPT_SHORT $OPT_LONG "$@"; then echo; usage; exit 1 # E_INVALID_OPTION; fi -eval set -- "$OPT_TEMP" -unset OPT_SHORT OPT_LONG OPT_TEMP +set -- "${OPTRET[@]}" +unset OPT_SHORT OPT_LONG OPTRET while true; do case "$1" in -- cgit v1.2.3-24-g4f1b