Re: [pacman-dev] [PATCH] src/pacman/query.c: do not exit -Qo with error if file does not exist

2017-11-13 Thread Ivy Foster
On 12 Nov 2017, at  7:00 pm -0500, Eli Schwartz wrote:
> On 11/12/2017 06:00 PM, i...@escondida.tk wrote:
> > As a side note, this removes the sole usage of the translated error
> > "failed to find '%s' in PATH: %s\n". I have not deleted this string
> > from every .po file, but that option now exists.

> That's okay, strings are never touched except right before a release,
> when the strings are frozen, added/changed/deleted strings updated in
> the .po files, and everything is shipped off to transifex for the
> translation team to look at.

That's really good to know, thanks!

Ivy


Re: [pacman-dev] [PATCH] src/pacman/query.c: do not exit -Qo with error if file does not exist

2017-11-13 Thread Ivy Foster
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 
> > 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, ) == -1) {
> > -   /* if it is not a path but a program name, then check 
> > in PATH */
> > -   if(strchr(filename, '/') == NULL) {
> > -   if(search_path(, ) == -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, ) == -1) && (strchr(filename, '/') == 
> > NULL)) {
> > +   search_path(, );
> > }
> >
> > 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