[pacman-dev] [PATCH] makepkg: fix sudo/su calling of pacman
This fixes two issues:
1) using "sudo -l" results in excess password asking under certian
configurations. Revert to the pre 3.4 behaviour of always using
sudo if it is installed.
2) Properly escape the command so that that versioned dependencies,
such as "foo>4", do not get treated as output redirection. This
also unifies the generation of the pacman line and its privilege
escalation.
Based on patches supplied by Andres P
On 30/06/10 21:18, Allan McRae wrote:
This fixes two issues:
1) using "sudo -l" results in excess password asking under certian configurations. Revert to the pre 3.4 behaviour of always using sudo if it is installed.
2) Properly escape the command so that that versioned dependencies, such as "foo>4", do not get treated as output redirection
when using su
. This also unifies the generation of the pacman line and its privilege escalation.
Based on patches supplied by Andres P
with minor adjustments for suitability for the maint branch. Signed-off-by: Allan McRae
--- This is a fix for the maint branch. The reworking of the privilege escalation to a configurable option will need to go on the master branch at a later date.
scripts/makepkg.sh.in | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index f3c7217..25bbc74 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -368,17 +368,15 @@ download_file() { }
run_pacman() { - local ret=0 + local cmd=$(printf "%q " "$PACMAN" $PACMAN_OPTS "$@") if (( ! ASROOT ))&& [[ $1 != "-T"&& $1 != "-Qq" ]]; then - if [ "$(type -p sudo)" ]&& sudo -l $PACMAN&>/dev/null; then - sudo $PACMAN $PACMAN_OPTS "$@" || ret=$? + if [ "$(type -p sudo)" ]; then + cmd="sudo $cmd" else - su -c "$PACMAN $PACMAN_OPTS $*" || ret=$? + cmd="su -c '$cmd'" fi - else - $PACMAN $PACMAN_OPTS "$@" || ret=$? fi - return $ret + eval "$cmd" }
check_deps() {
On Wed, Jun 30, 2010 at 6:48 AM, Allan McRae
Based on patches supplied by Andres P
with minor adjustments for suitability for the maint branch. Signed-off-by: Allan McRae
---
What the fuck do you mean "based"? It's the same exact patch.
This is a fix for the maint branch. The reworking of the privilege escalation to a configurable option will need to go on the master branch at a later date.
scripts/makepkg.sh.in | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index f3c7217..25bbc74 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -368,17 +368,15 @@ download_file() { }
run_pacman() { - local ret=0 + local cmd=$(printf "%q " "$PACMAN" $PACMAN_OPTS "$@")
If you're going to NIH all over the place, at least attempt to correct mistakes in my original patch. This should be: local cmd printf -v cmd "%q " "$PACMAN" $PACMAN_OPTS "$@" Also, how do I unsubscribe from this shitty list? ;) Andres P
On Wed 30 Jun 2010 20:08 -0430, Andres P wrote:
Also, how do I unsubscribe from this shitty list? ;)
Heyy. Don't be so rude now. The list isn't that bad. http://mailman.archlinux.org/mailman/listinfo/pacman-dev Cheers.
On Thu, Jul 1, 2010 at 3:08 AM, Loui Chang
On Wed 30 Jun 2010 20:08 -0430, Andres P wrote:
Also, how do I unsubscribe from this shitty list? ;)
Heyy. Don't be so rude now. The list isn't that bad. http://mailman.archlinux.org/mailman/listinfo/pacman-dev
I always wondered what kind of people cannot find by themselves how to unsubscribe from a ML and feel obliged to spam and insult all of its users to ask. It's definitely not the first time I see this behavior, I've already seen it on some arch ML before.
participants (4)
-
Allan McRae
-
Andres P
-
Loui Chang
-
Xavier Chantry