On 12 Nov 2017, at  7:39 pm -0500, Andrew Gregory wrote:
> On 11/12/17 at 05:00pm, i...@escondida.tk wrote:
> > From: Ivy Foster <i...@escondida.tk>
> > diff --git a/src/pacman/query.c b/src/pacman/query.c
> > index 024d3e21..64c42f19 100644
> > --- a/src/pacman/query.c
> > +++ b/src/pacman/query.c
> > @@ -171,19 +171,9 @@ static int query_fileowner(alpm_list_t *targets)
> >                     filename[len--] = '\0';
> >             }
> >
> > -           if(lstat(filename, &buf) == -1) {
> > -                   /* if it is not a path but a program name, then check 
> > in PATH */
> > -                   if(strchr(filename, '/') == NULL) {
> > -                           if(search_path(&filename, &buf) == -1) {
> > -                                   pm_printf(ALPM_LOG_ERROR, _("failed to 
> > find '%s' in PATH: %s\n"),
> > -                                                   filename, 
> > strerror(errno));
> > -                                   goto targcleanup;
> > -                           }
> > -                   } else {
> > -                           pm_printf(ALPM_LOG_ERROR, _("failed to read 
> > file '%s': %s\n"),
> > -                                           filename, strerror(errno));
> > -                           goto targcleanup;
> > -                   }
> > +           /* if it is not a path but a program name, then check in PATH */
> > +           if((lstat(filename, &buf) == -1) && (strchr(filename, '/') == 
> > NULL)) {
> > +                   search_path(&filename, &buf);
> >             }
> >
> >             if(!lrealpath(filename, rpath)) {
> > --
> > 2.15.0

> This won't work for missing directories, which will be missing the
> trailing /, or files whose parent directory no longer exists, which
> will fail the call to lrealpath.

Ah, quite right. That didn't even occur to me. As always, thanks for
the feedback! I'll submit an improved patch tomorrow (Mon) or Tues.

Ivy

Reply via email to