[pacman-dev] [PATCH 2/2] Save path to Pacman, which could be lost during --syncdeps operation

Dave Reisner d at falconindy.com
Sat Nov 3 00:25:40 EDT 2012


On Sat, Nov 03, 2012 at 04:13:02AM +0000, Martin Panter wrote:
> On 3 November 2012 01:57, Dave Reisner <d at falconindy.com> wrote:
> > On Wed, Oct 31, 2012 at 07:06:13AM +0000, Martin Panter wrote:
> >> Unmangled version: https://github.com/vadmium/pacman-arch/commit/b984a8b.patch
> >>
> >> Turns out it wasn’t too hard to allow spaces in the path returned from
> >> “command -v”, while handling any extra arguments.
> >>
> >> From b984a8b2cb3daa05177420d1a9d83648d6c0aa0d Mon Sep 17 00:00:00 2001
> >> From: Martin Panter <vadmium à gmail·com>
> >> Date: Wed, 31 Oct 2012 02:45:36 +0000
> >> Subject: [PATCH] Save path to Pacman, which could be lost during --syncdeps
> >>  operation
> >> MIME-Version: 1.0
> >> Content-Type: text/plain; charset=UTF-8
> >> Content-Transfer-Encoding: 8bit
> >>
> >> Access to the Pacman command could be lost when /etc/profile is invoked and
> >> $PATH is reset. Tested to make sure the following scenarios behave sensibly,
> >> where “roopwn” is in ~/bin/:
> >>
> >> PACMAN="pacman --config /etc/pacman.conf" makepkg --syncdeps --install
> >> PACMAN="nonexistent --dummy" makepkg --syncdeps --install
> >> PACMAN="nonexistent --dummy" makepkg
> >> PACMAN="roopwn --verbose" makepkg --syncdeps --install
> >
> > NAK'ing this as well, based on feedback from the prior patch. This is
> > the wrong approach to extending invocations to pacman.
> 
> Is your problem just that this perpetuates the custom arguments in the
> $PACMAN variable? If we got rid of the custom arguments support, this
> patch would have been a lot simpler, probably similar to just this
> hunk:

Right. PACMAN defines a command, not a command and options.

I'm a little confused as to why this would be needed. Presumably, pacman
is in /usr/bin. If that falls out of your PATH, you're going to have
much larger problems, and it won't only be pacman which is no longer
accessible. Could you perhaps expand on your use case and why/how you
ran into this problem?

> >> @@ -2728,7 +2729,11 @@ if (( NODEPS || (NOBUILD && !DEP_BIN ) )); then
> >>       if (( NODEPS )); then
> >>               warning "$(gettext "Skipping dependency checks.")"
> >>       fi
> >> -elif type -p "${PACMAN%% *}" >/dev/null; then
> >> +elif output="$(command -v "$PACMAN")"; then
> >> +     # Save full path to Pacman in case the --syncdeps operation modifies
> >> +     # the $PATH and makes it inaccessible
> >> +     PACMAN="$output"
> >> +
> >>       if (( RMDEPS && ! INSTALL )); then
> >>               original_pkglist=($(run_pacman -Qq))    # required by remove_dep
> >>       fi
> 


More information about the pacman-dev mailing list