bug-gnulib
[Top][All Lists]
Advanced

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

Re: fts vs. simulated-inode file systems: FUSE-based, FAT, smbfs, cifs,


From: Jim Meyering
Subject: Re: fts vs. simulated-inode file systems: FUSE-based, FAT, smbfs, cifs, ...
Date: Sat, 14 Oct 2006 08:32:19 +0200

Jim Meyering <address@hidden> wrote:
> Miklos Szeredi <address@hidden> wrote:
>> I've tried out the CVS version of findutils+gnulib, and it does indeed
>> seem to fix the problem with inode-less filesystems, in addition to
>> using noticably less system time.
>>
>> I've also found that the -xdev option of find no longer works: it
>> outputs just a single line for the base directory.
>
> Thanks for reporting that.
> That's a bug I introduced yesterday.
> With FTS_XDEV, p->fts_statp->st_dev is used uninitialized.

Here's the patch (same as proposed, but with a comment),
followed by a patch to add a findutils test that exercises the bug.

2006-10-13  Jim Meyering  <address@hidden>

        Fix a bug in yesterday's change.
        * lib/fts.c (fts_open): When using FTS_XDEV|FTS_NOSTAT,
        p->fts_statp->st_dev would be used uninitialized.
        Ensures that we always call fts_stat on the very first entry.
        Miklos Szeredi reported that find -xdev stopped working.

Index: lib/fts.c
===================================================================
RCS file: /sources/gnulib/gnulib/lib/fts.c,v
retrieving revision 1.21
diff -u -r1.21 fts.c
--- lib/fts.c   12 Oct 2006 10:36:51 -0000      1.21
+++ lib/fts.c   14 Oct 2006 06:28:14 -0000
@@ -396,7 +396,10 @@
                p->fts_level = FTS_ROOTLEVEL;
                p->fts_parent = parent;
                p->fts_accpath = p->fts_name;
-               if (defer_stat) {
+               /* Even when defer_stat is true, be sure to stat the first
+                  command line argument, since fts_read (at least with
+                  FTS_XDEV) requires that.  */
+               if (defer_stat && root != NULL) {
                        p->fts_info = FTS_NSOK;
                        fts_set_stat_required(p, true);
                } else {

--- /dev/null   2006-09-30 18:47:07.772235750 +0200
+++ find/testsuite/find.posix/xdev.exp  2006-10-14 08:15:27.541426401 +0200
@@ -0,0 +1,5 @@
+# tests for -xdev making fts use uninitialized memory
+exec rm -rf tmp
+exec mkdir -p tmp/x
+find_start p {tmp -xdev }
+exec rm -rf tmp
--- /dev/null   2006-09-30 18:47:07.772235750 +0200
+++ find/testsuite/find.posix/xdev.xo   2006-10-14 08:16:13.355072613 +0200
@@ -0,0 +1,2 @@
+tmp
+tmp/x




reply via email to

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