[pacman-dev] [PATCH 10/11] makepkg: do not ask sudo password twice

Andres P aepd87 at gmail.com
Thu Jun 17 08:44:50 EDT 2010


Fixes a regression in 05ff276eefc with passwd_timeout=0 in sudoers.

Passwords were being asked twice for *every* operation.

Signed-off-by: Andres P <aepd87 at gmail.com>
---

makepkg shouldn't make assumptions about the site's security settings,
specially something as innocuous as passwd_timeout.

A cleaner way that also involves less forks is to process sudo's $?, if
possible:
	sudo $PACMAN $PACMAN_OPTS "$@" || ret=$?
	if [[ $? = 4 ]]; then
		error "$(gettext "You are not authorized to use sudo pacman.")"
		exit $E_AUTH
	fi
Note that 4 is just an example
...

 scripts/makepkg.sh.in |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 6de6100..f03c358 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -372,7 +372,7 @@ download_file() {
 run_pacman() {
 	local ret=0
 	if (( ! ASROOT )) && [[ $1 != "-T" && $1 != "-Qq" ]]; then
-		if type -p sudo >/dev/null && sudo -l $PACMAN &>/dev/null; then
+		if type -p sudo >/dev/null; then
 			sudo $PACMAN $PACMAN_OPTS "$@" || ret=$?
 		else
 			su -c "$PACMAN $PACMAN_OPTS $*" || ret=$?
-- 
1.7.1



More information about the pacman-dev mailing list