bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: coreutils 6.6 HP-UX build error


From: Jim Meyering
Subject: Re: coreutils 6.6 HP-UX build error
Date: Mon, 08 Jan 2007 11:35:54 +0100

Paul Eggert <address@hidden> wrote:
> Jim Meyering <address@hidden> writes:
>
>> Thanks, but that doesn't matter.  When st_size is used that way (when
>> ->fts_info == FTS_NSOK), its value must be FTS_STAT_REQUIRED (1) or
>> FTS_NO_STAT_REQUIRED (2).  If there is a way to make it have any other
>> value, it's a bug.
>
> Yes, but the point of the switch is that it attempts to detect these
> bugs, and to abort if there is a bug by falling into the default case.
> Formerly the code detected the bug when st_size was 2**32 + 2.
> Currently the code does not detect the bug in this case; it treats
> 2**32 + 2 like FTS_STAT_REQUIRED.
>
> It's a very minor point, and not worth much worry.  (I'm just trying
> to explain the point at this point. :-)

Every little bit helps :-)
I've done as you suggest:

        Use a more robust test for a "can't happen" condition.
        * lib/fts.c (fts_read): Revert the change of 2006-11-22, since it
        narrowed the st_size value.  Presuming the "can't happen" condition
        is true, that narrowing could conceivably convert an invalid st_size
        value into a valid one.  Instead, use a change based on Matthew
        Woehlke's original patch.

Index: lib/fts.c
===================================================================
RCS file: /sources/gnulib/gnulib/lib/fts.c,v
retrieving revision 1.31
diff -u -p -r1.31 fts.c
--- lib/fts.c   8 Jan 2007 10:30:47 -0000       1.31
+++ lib/fts.c   8 Jan 2007 10:31:58 -0000
@@ -740,17 +740,10 @@ name:             t = sp->fts_path + NAPPEND(p->fts
 check_for_dir:
                if (p->fts_info == FTS_NSOK)
                  {
-                   enum Fts_stat need_stat = p->fts_statp->st_size;
-                   switch (need_stat)
-                     {
-                     case FTS_STAT_REQUIRED:
-                       p->fts_info = fts_stat(sp, p, false);
-                       break;
-                     case FTS_NO_STAT_REQUIRED:
-                       break;
-                     default:
-                       fts_assert (0);
-                     }
+                   if (p->fts_statp->st_size == FTS_STAT_REQUIRED)
+                     p->fts_info = fts_stat(sp, p, false);
+                   else
+                     fts_assert (p->fts_statp->st_size == 
FTS_NO_STAT_REQUIRED);
                  }

                sp->fts_cur = p;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]