On Tue, May 15, 2018 at 11:13:09AM -0400, Eli Schwartz wrote: > In commit 5698d7b66daa2a0bc99cab7a989cef1c806c3bf6 a new non-root use of > pacman was added -- previously we used -T or -Qq, and run_pacman did not > know how to special-case -Qi to skip being prepended with sudo.
Can we just be explicit about when we do and don't need elevated privileges rather than trying to guess? Surely the caller knows the requirements a priori. > The result is: > > -> Generating .BUILDINFO file... > ERROR: ld.so: object 'libfakeroot.so' from LD_PRELOAD cannot be preloaded > (cannot open shared object file): ignored. > [sudo] password for eschwartz: > -> Adding changelog file... > > Fix this by using a more generic glob since neither -Q nor -T will ever > need sudo or PACMAN_OPTS > > Signed-off-by: Eli Schwartz <eschwa...@archlinux.org> > --- > scripts/makepkg.sh.in | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in > index 62b912e3..e9080a70 100644 > --- a/scripts/makepkg.sh.in > +++ b/scripts/makepkg.sh.in > @@ -220,12 +220,12 @@ missing_source_file() { > > run_pacman() { > local cmd > - if [[ $1 != -@(T|Qq) ]]; then > + if [[ $1 != -@(T|Q)*([[:alpha:]]) ]]; then > cmd=("$PACMAN_PATH" "${PACMAN_OPTS[@]}" "$@") > else > cmd=("$PACMAN_PATH" "$@") > fi > - if [[ $1 != -@(T|Qq|Q) ]]; then > + if [[ $1 != -@(T|Q)*([[:alpha:]]) ]]; then > if type -p sudo >/dev/null; then > cmd=(sudo "${cmd[@]}") > else > -- > 2.17.0