From 335627d72dd5e51201b4cd53d84b70954946c013 Mon Sep 17 00:00:00 2001 From: Cedric Staniewski Date: Wed, 21 Oct 2009 16:06:42 +0200 Subject: makepkg: check for non-empty pkgbase instead of pkgname pkgbase is used in the following rm calls, and since pkgname can be present when pkgbase is not, it is safer to check for pkgbase. Signed-off-by: Cedric Staniewski Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 13e4ed5e..929f43f9 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -155,7 +155,7 @@ clean_up() { # If it's a clean exit and -c/--clean has been passed... msg "$(gettext "Cleaning up...")" rm -rf "$pkgdir" "$srcdir" - if [ -n "$pkgname" ]; then + if [ -n "$pkgbase" ]; then # Can't do this unless the BUILDSCRIPT has been sourced. rm -f "${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-build.log"* if [ "$PKGFUNC" -eq 1 ]; then -- cgit v1.2.3-70-g09d2 From a12ed63545ee16d37da2b28bbf4c1820bd367315 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 19 Jan 2010 21:52:54 -0600 Subject: NULL out handle after release We free'd the handle but didn't NULL out the global variable, leading to problems if you try to reinitialize the library. Make sure we clean up after ourselves. Signed-off-by: Dan McGee --- lib/libalpm/alpm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index 6ab65161..82502562 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -71,6 +71,7 @@ int SYMEXPORT alpm_release(void) } _alpm_handle_free(handle); + handle = NULL; return(0); } -- cgit v1.2.3-70-g09d2 From 0c3f5020645ab5ab28113322e33abdeeb2b34a63 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sun, 15 Nov 2009 20:24:24 +1000 Subject: contrib/bacman: fix checking if file has been added Fixes FS#17140. Signed-off-by: Allan McRae Signed-off-by: Dan McGee (cherry picked from commit 0199a7ee717f0848e336fda8dc1f5b9364ce3478) Signed-off-by: Dan McGee --- contrib/bacman | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/bacman b/contrib/bacman index 22940ecb..dfd53e8b 100755 --- a/contrib/bacman +++ b/contrib/bacman @@ -21,7 +21,7 @@ # readonly progname="bacman" -readonly progver="0.2.0" +readonly progver="0.2.1" # # User Friendliness @@ -137,7 +137,7 @@ while read i; do bsdtar -cnf - "/$i" 2> /dev/null | bsdtar -xpf - # Workaround to bsdtar not reporting a missing file as an error - if [ ! -e "$work_dir/$i" ] && [ -L "$work_dir/$i"]; then + if [ ! -e "$work_dir/$i" -a ! -L "$work_dir/$i" ]; then echo "" echo "ERROR: unable to add /$i to the package" echo " If your user does not have permssion to read this file then" -- cgit v1.2.3-70-g09d2 From ce9bb994f86f9653dc293f2dda0f8f2160964090 Mon Sep 17 00:00:00 2001 From: Cedric Staniewski Date: Tue, 10 Nov 2009 20:47:09 +0100 Subject: makepkg: fix abortion after sourcing /etc/profile The source command triggers / might trigger the ERR trap which makes makepkg abort right after a successful installation of missing dependencies. Thanks to Xavier Chantry for finding this solution. Signed-off-by: Cedric Staniewski Signed-off-by: Xavier Chantry Signed-off-by: Dan McGee (cherry picked from commit 77e84bea71e3dfe87a8009e7e7a913d1a12b7585) Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 929f43f9..f58e2742 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -385,10 +385,11 @@ handledeps() { fi # we might need the new system environment - # set -e can cause problems during sourcing profile scripts - set +e + # avoid triggering the ERR trap + local restoretrap=$(trap -p ERR) + trap - ERR source /etc/profile &>/dev/null - set -e + eval $restoretrap return $R_DEPS_SATISFIED } -- cgit v1.2.3-70-g09d2 From 8b3f5f0ce6dca98ca14cc48f5a85188313769b40 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 30 Nov 2009 22:56:44 -0600 Subject: bash_completion: use absolute paths to utilities Fixes issues noted in FS#16630. Signed-off-by: Dan McGee (cherry picked from commit 03f35b1432675f5b10ec53945e48c2bbd7c628e9) Signed-off-by: Dan McGee --- contrib/bash_completion | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/contrib/bash_completion b/contrib/bash_completion index 65135cfd..62e5bc95 100644 --- a/contrib/bash_completion +++ b/contrib/bash_completion @@ -14,7 +14,7 @@ rem_selected () # (Adapted from bash_completion by Ian Macdonald ) # This removes any options from the list of completions that have # already been specified on the command line. - COMPREPLY=($(echo "${COMP_WORDS[@]}" | \ + COMPREPLY=($(/bin/echo "${COMP_WORDS[@]}" | \ (while read -d ' ' i; do [ "${i}" == "" ] && continue # flatten array with spaces on either side, @@ -24,20 +24,20 @@ rem_selected () # remove word from list of completions COMPREPLY=(${COMPREPLY/ ${i%% *} / }) done - echo ${COMPREPLY[@]}))) + /bin/echo ${COMPREPLY[@]}))) return 0 } _available_repos () { - COMPREPLY=( $( compgen -W "$(grep '\[' /etc/pacman.conf | grep -v -e 'options' -e '^#' | tr -d '[]' )" -- $cur ) ) + COMPREPLY=( $( compgen -W "$(/bin/grep '\[' /etc/pacman.conf | /bin/grep -v -e 'options' -e '^#' | tr -d '[]' )" -- $cur ) ) } _installed_pkgs () { local installed_pkgs - installed_pkgs=$( ls /var/lib/pacman/local/ ) - COMPREPLY=( $( compgen -W "$( for i in $installed_pkgs; do echo ${i%-*-*}; done )" -- $cur ) ) + installed_pkgs=$( /bin/ls /var/lib/pacman/local/ ) + COMPREPLY=( $( compgen -W "$( for i in $installed_pkgs; do /bin/echo ${i%-*-*}; done )" -- $cur ) ) } _available_pkgs () @@ -47,16 +47,16 @@ _available_pkgs () # This little change-up removes the find *and* only uses enabled repos local available_pkgs local enabled_repos - enabled_repos=$( grep '\[' /etc/pacman.conf | grep -v -e 'options' -e '^#' | tr -d '[]' ) - available_pkgs=$( for r in $enabled_repos; do echo /var/lib/pacman/sync/$r/*; done ) + enabled_repos=$( /bin/grep '\[' /etc/pacman.conf | /bin/grep -v -e 'options' -e '^#' | tr -d '[]' ) + available_pkgs=$( for r in $enabled_repos; do /bin/echo /var/lib/pacman/sync/$r/*; done ) COMPREPLY=( $( compgen -W "$( for i in $available_pkgs; do j=${i##*/}; echo ${j%-*-*}; done )" -- $cur ) ) } _installed_groups () { local installed_groups - installed_groups=$( find /var/lib/pacman/local -name desc -exec sed -ne '/%GROUPS%/,/^$/{//d; p}' {} \; | sort -u ) - COMPREPLY=( $( compgen -W "$( for i in $installed_groups; do echo ${i%-*-*}; done )" -- $cur ) ) + installed_groups=$( /bin/find /var/lib/pacman/local -name desc -exec /bin/sed -ne '/%GROUPS%/,/^$/{//d; p}' {} \; | /bin/sort -u ) + COMPREPLY=( $( compgen -W "$( for i in $installed_groups; do /bin/echo ${i%-*-*}; done )" -- $cur ) ) } _available_groups () @@ -66,9 +66,9 @@ _available_groups () # This little change-up removes the find *and* only uses enabled repos local available_groups local enabled_repos - enabled_repos=$( grep '\[' /etc/pacman.conf | grep -v -e 'options' -e '^#' | tr -d '[]' ) - available_groups=$( for r in $enabled_repos; do sed '/%GROUPS%/,/^$/{//d; p}' /var/lib/pacman/sync/$r/*/desc | sort -u; done ) - COMPREPLY=( $( compgen -W "$( for i in $available_groups; do echo ${i%-*-*}; done )" -- $cur ) ) + enabled_repos=$( /bin/grep '\[' /etc/pacman.conf | /bin/grep -v -e 'options' -e '^#' | tr -d '[]' ) + available_groups=$( for r in $enabled_repos; do /bin/sed '/%GROUPS%/,/^$/{//d; p}' /var/lib/pacman/sync/$r/*/desc | /bin/sort -u; done ) + COMPREPLY=( $( compgen -W "$( for i in $available_groups; do /bin/echo ${i%-*-*}; done )" -- $cur ) ) } ## makepkg completion @@ -126,7 +126,7 @@ _instring () str="${1}" shift 1 for c in "${@}"; do - if [ $(expr index "${str}" "${c}") -gt 0 ]; then + if [ $(/bin/expr index "${str}" "${c}") -gt 0 ]; then return 0 fi done @@ -193,7 +193,7 @@ _pacman () esac arglen=$(( ${#toparse}-1 )) - for c in $(seq 0 "${arglen}"); do + for c in $(/bin/seq 0 "${arglen}"); do arg=${toparse:$c:1} [ "${arg}" != "-" ] && mod="${mod}${arg}" done -- cgit v1.2.3-70-g09d2