[pacman-dev] [PATCH] Remove conflict message for no-existent files.
Aaron Griffin
aaronmgriffin at gmail.com
Fri Jul 27 17:46:13 EDT 2007
On 7/13/07, Andrew Fyfe <andrew at neptune-one.net> wrote:
> Xavier wrote:
> > On Tue, Jul 10, 2007 at 05:44:24PM +0200, Xavier wrote:
> >> On Tue, Jul 10, 2007 at 04:31:13PM +0100, Andrew Fyfe wrote:
> >>> Signed-off-by: Andrew Fyfe <andrew at neptune-one.net>
> >>> ---
> >>> lib/libalpm/conflict.c | 3 ++-
> >>> 1 files changed, 2 insertions(+), 1 deletions(-)
> >>>
> >>> diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
> >>> index 3755fcd..adaba1a 100644
> >>> --- a/lib/libalpm/conflict.c
> >>> +++ b/lib/libalpm/conflict.c
> >>> @@ -506,7 +506,8 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root)
> >>> path, p1->name, NULL);
> >>> }
> >>> } else {
> >>> - _alpm_log(PM_LOG_DEBUG, "%s is a directory, not a conflict", path);
> >>> + if(S_ISDIR(buf.st_mode))
> >>> + _alpm_log(PM_LOG_DEBUG, "%s is a directory, not a conflict", path);
> >>> }
> >>> }
> >>> alpm_list_free_inner(tmpfiles, &free);
> >>> --
> >>> 1.5.2.3
> >>>
> >> That looks correct but a bit weird ;)
> >> Why not just splitting the if condition, so we can correctly check for lstat
> >> failure, instead of making the S_ISDIR check a second time ?
> >
> > Here is what I had in mind :
> >
> >>From 28108f35d00774bf29f4ed180b4a6d89e988c2f0 Mon Sep 17 00:00:00 2001
> > From: Chantry Xavier <shiningxc at gmail.com>
> > Date: Fri, 13 Jul 2007 10:41:40 +0200
> > Subject: [PATCH] Remove conflict message for no-existent files (reworked).
> >
> > Signed-off-by: Chantry Xavier <shiningxc at gmail.com>
> > ---
> > lib/libalpm/conflict.c | 10 ++++++----
> > 1 files changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
> > index 9ee8985..3eab6b1 100644
> > --- a/lib/libalpm/conflict.c
> > +++ b/lib/libalpm/conflict.c
> > @@ -432,7 +432,12 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root)
> > snprintf(path, PATH_MAX, "%s%s", root, filestr);
> >
> > /* stat the file - if it exists and is not a dir, do some checks */
> > - if(lstat(path, &buf) == 0 && !S_ISDIR(buf.st_mode)) {
> > + if(lstat(path, &buf) != 0) {
> > + continue;
> > + }
> > + if(S_ISDIR(buf.st_mode)) {
> > + _alpm_log(PM_LOG_DEBUG, "%s is a directory, not a conflict", path);
> > + } else {
> > _alpm_log(PM_LOG_DEBUG, "checking possible conflict: %s", path);
> >
> > /* Make sure the possible conflict is not a symlink that points to a
> > @@ -496,9 +501,6 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root)
> > conflicts = add_fileconflict(conflicts, PM_CONFLICT_TYPE_FILE,
> > path, p1->name, NULL);
> > }
> > - } else {
> > - if(S_ISDIR(buf.st_mode))
> > - _alpm_log(PM_LOG_DEBUG, "%s is a directory, not a conflict", path);
> > }
> > }
> > alpm_list_free_inner(tmpfiles, &free);
> That make more sense :)
Minor prodding here as I'm catching up on things I missed - is this in
someone's git tree? Was it merged anywhere?
More information about the pacman-dev
mailing list