bug-findutils
[Top][All Lists]
Advanced

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

[bugs #3998] updatedb: exists early with ". changed during execution"


From: James Youngman
Subject: [bugs #3998] updatedb: exists early with ". changed during execution"
Date: Sat, 20 Nov 2004 18:18:24 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041007 Debian/1.7.3-5

This mail is an automated notification from the bugs tracker
 of the project: findutils.

/**************************************************************************/
[bugs #3998] Latest Modifications:

Changes by: 
                James Youngman <address@hidden>
'Date: 
                Sat 11/20/04 at 22:53 (GMT)

------------------ Additional Follow-up Comments ----------------------------
I think I have a solution.  It is to memorise the paths listed in /etc/mnttab 
at startup.  Then when I chdir into a directory and the device number changes, 
AND it is not in the saved copy of mnttab, BUT it is in the new copy (that I 
re-read only when this error occurs), then the directory must have been 
automounted.  Otherwise, I flag the situation as an error and quit.   This 
seems inelegant but workable.






/**************************************************************************/
[bugs #3998] Full Item Snapshot:

URL: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=3998>
Project: findutils
Submitted by: Steve Revilak
On: Mon 06/16/03 at 19:23

Category:  updatedb
Severity:  5 - Average
Item Group:  None
Resolution:  Postponed
Privacy:  Public
Assigned to:  None
Originator Name:  
Originator Email:  
Status:  Open
Release:  None
Fixed Release:  None


Summary:  updatedb: exists early with ". changed during execution"

Original Submission:  I'd like to report a problem with findutils-4.1.20 on 
Solaris 7.

I think that a comparison is the easiest way to illustrate.  For this,
I'm using an updatedb script and find binary that have been slightly
modified to provide additional debugging information  (Diffs are
appended, so that you can see exactly what's changed).

First - just a simple execution of find, run from the root of the
filesystem:

  $ time sudo /usr/local/src/findutils-4.1.20/find/find / | wc
  ^C
  real    419m54.387s
  user    3m52.060s
  sys     34m3.240s

If you factor in nfs shares, / a big filesystem on this machine.  I
expected the above to take awhile, but got impatient.  Let's try
again, sticking to a single partition:

  $ time sudo /usr/local/src/findutils-4.1.20/find/find /  -xdev | wc
   105906  105906 5109425

  real    0m18.742s
  user    0m1.430s
  sys     0m2.890s

Above, find found 105,906 files in about 18 seconds.  Remember these
numbers.


Next - try to run updatedb without any arguments.  This should find a
similar number of files (modulo the default set of prunepaths).

  $ time sudo /u/srevilak/updatedb
  /usr/local/src/findutils-4.1.20/find/find: find.c:528: . changed during 
execution of /usr/local/src/findutils-4.1.20/find/find
  /u/srevilak/updatedb: debug: entries in /tmp/debug-updatedb: 5

  real    0m1.572s
  user    0m0.060s
  sys     0m0.080s

updatedb comes up with only 5 files, and finishes in under 2 seconds.


To summarize, something in the updatedb invocation of find is causing
it to bail early.  Looking around find.c:528, we have

      if (stat_buf.st_dev != dir_ids[dir_curr].dev ||
          stat_buf.st_ino != dir_ids[dir_curr].ino)
        error (1, 0, _("%s changed during execution of %s"), starting_dir, 
program_name);


The test seems entirely reasonable, and under some invocations it
never returns positive.  Perhaps one of the predicates in the updatedb
invocation isn't taking care of dir_ids properly?

I did notice `[ Bug #3786 ] updatedb fails if it cannot access "." as
the user to whom it switches uid.', but this appears to be something
different.  "updatedb --localuser=root --netuser=root" fails in the
same way.

Anyway, if you guys could look into this, I'd really appreciate it.
If you need any additional information, please let me know and I'll be
happy to provide it.  If I happen to get any further insight, I'll be
sure to pass it along.


Thanks much!

address@hidden


==================================================================
Aforementioned diffs follow:

==================================================================
updatedb diff.  
Change: tee output to a temporary file and say how many files appeared

--- /usr/local/gnu/bin/updatedb 2003-06-06 08:13:25.000000000 -0400
+++ /u/srevilak/updatedb        2003-06-16 07:34:48.938002000 -0400
@@ -100,6 +100,8 @@
 : ${bigram=${LIBEXECDIR}/bigram}
 : ${code=${LIBEXECDIR}/code}
 
+find=/usr/local/src/findutils-4.1.20/find/find
+
 PATH=/bin:/usr/bin:${BINDIR}; export PATH
 
 : ${PRUNEFS="nfs NFS proc"}
@@ -143,7 +145,8 @@
     $find $NETPATHS ( -type d -regex "$PRUNEREGEX" -prune ) -o -print
   fi
 fi
-} | sort -f | $frcode > $LOCATE_DB.n
+} | sort -f | tee /tmp/debug-updatedb | $frcode > $LOCATE_DB.n
+echo "$0: debug: entries in /tmp/debug-updatedb: `grep -c . 
/tmp/debug-updatedb`"
 
 # To avoid breaking locate while this script is running, put the
 # results in a temp file, then rename it atomically.


==================================================================
find.c diff.
Change: add __FILE__ and __LINE__ to each error() call containing the
text "changed during execution"

--- find.c.ORIG 2003-05-24 14:36:25.000000000 -0400
+++ find.c      2003-06-16 07:32:57.067319000 -0400
@@ -304,7 +304,7 @@
        error (1, errno, "%s", starting_dir);
       if (stat_buf.st_dev != starting_stat_buf.st_dev ||
          stat_buf.st_ino != starting_stat_buf.st_ino)
-       error (1, 0, _("%s changed during execution of %s"), starting_dir, 
program_name);
+       error (1, 0, _("%s:%d: %s changed during execution of %s"), __FILE__, 
__LINE__, starting_dir, program_name);
     }
   else
     {
@@ -341,7 +341,7 @@
        error (1, errno, "%s", pathname);
       if (cur_stat_buf.st_dev != stat_buf.st_dev ||
          cur_stat_buf.st_ino != stat_buf.st_ino)
-       error (1, 0, _("%s changed during execution of %s"), pathname, 
program_name);
+       error (1, 0, _("%s:%d: %s changed during execution of %s"), __FILE__, 
__LINE__, pathname, program_name);
 
       process_path (pathname, ".", false, ".");
       chdir_back ();
@@ -525,7 +525,7 @@
        error (1, errno, "%s", pathname);
       if (stat_buf.st_dev != dir_ids[dir_curr].dev ||
          stat_buf.st_ino != dir_ids[dir_curr].ino)
-       error (1, 0, _("%s changed during execution of %s"), starting_dir, 
program_name);
+       error (1, 0, _("%s:%d: %s changed during execution of %s"), __FILE__, 
__LINE__, starting_dir, program_name);
 
       for (namep = name_space; *namep; namep += file_len - pathname_len + 1)
        {
@@ -589,9 +589,9 @@
              (dir_curr > 0 ? dir_ids[dir_curr-1].ino : 
starting_stat_buf.st_ino))
            {
              if (dereference)
-               error (1, 0, _("%s changed during execution of %s"), parent, 
program_name);
+               error (1, 0, _("%s:%d: %s changed during execution of %s"), 
__FILE__, __LINE__, parent, program_name);
              else
-               error (1, 0, _("%s/.. changed during execution of %s"), 
starting_dir, program_name);
+               error (1, 0, _("%s:%d: %s/.. changed during execution of %s"), 
__FILE__, __LINE__, starting_dir, program_name);
            }
        }
 


Follow-up Comments
------------------


-------------------------------------------------------
Date: Sat 11/20/04 at 22:53         By: James Youngman <jay>
I think I have a solution.  It is to memorise the paths listed in /etc/mnttab 
at startup.  Then when I chdir into a directory and the device number changes, 
AND it is not in the saved copy of mnttab, BUT it is in the new copy (that I 
re-read only when this error occurs), then the directory must have been 
automounted.  Otherwise, I flag the situation as an error and quit.   This 
seems inelegant but workable.

-------------------------------------------------------
Date: Sat 11/20/04 at 19:57         By: Steve Revilak <srevilak>
I had a chance to run some tests with findutils-4.2.5.  Here's what I
found.

  * Caveat: it is not possible for me to do testing on the systems
    where the problem was originally observed.  Instead, I was able
    to use a `similar' environment (Solaris 8, with some filesystems
    mounted via nfs).

  * The original problem (updatedb exiting immediately) was not
    reproduced.  However, this may be a result of the order in which
    file system directories was traversed.  (i.e. - it the problem
    spots sooner rather than later).

  * I saw sporadic instances of the `changed during execution'
    phenemon noted earlier.

    /home/srevilak/findutils/build/bin/find: /data/DF changed during execution 
of /home/srevilak/findutils/build/bin/find (old device number 74973186, new 
device number 74712136, filesystem type is nfs) [ref 636]

   /home/srevilak/findutils/build/bin/find: /sources/DOWNLOADS changed during 
execution of /home/srevilak/findutils/build/bin/find (old device number 
74973190, new device number 74712147, filesystem type is nfs) [ref 636]

   /home/srevilak/findutils/build/bin/find: /data/DF changed during execution 
of /home/srevilak/findutils/build/bin/find (old device number 74973186, new 
device number 74712311, filesystem type is nfs) [ref 817]


    In this case, both directories are the roots of nfs filesystems,
    mounted by Sun's automountd.

Now, here's the thing that I found most interesting.

On this machine, /data/ is a directory that serves as the root of an
automounter map.  Starting from a state where none of the /data/
subdirectories show up in the output of df:

  # make sure we're using the right find
  $ type find
  find is hashed (/home/srevilak/findutils/build/bin/find)

  # try `find /data'
  $  find /data | wc
     find: /data/DF changed during execution of find (old device number 
74973186, new device number 74712431, filesystem type is nfs) [ref 817]
        2       2      15

  # okay try again
  $ find /data | wc
       51      51     762

  # demonstrate that /data/ does not contain symlinks
  $ find /data -type l | wc
        0       0       0

  # demonstrate that /data/ contains directories
  $ find /data -type d | wc
       51      51     762

  # same as above, but hit the subdirectories directly
  $ find /data/* -type d | wc
  find: /data/9202doc changed during execution of find (old device number 
74973186, new device number 74712435, filesystem type is nfs) [ref 629]
        0       0       0

  # okay, try again
  $ find /data/* -type d | wc
  find: /data/DU changed during execution of find (old device number 74973186, 
new device number 74712436, filesystem type is nfs) [ref 629]
      235     235    8334

  # Lets try to hit one of the sub directories that isn't mounted
  $ find /data/texmf -type f | wc
  find: /data/texmf changed during execution of find (old device number 
74973186, new device number 74712440, filesystem type is nfs) [ref 629]
        0       0       0

  # Before executing the above, /data/texmf *did not* appear in the
  # machine's mount table.
  #
  # After executing the avove, /data/texmf *did* appear in the
  # machine's mount table
  
  # when mounted, it works
  $ find /data/texmf -type f | wc
     3318    3318  190539

If you'd like to me to try any other tests, let me know.


-------------------------------------------------------
Date: Sat 11/20/04 at 01:35         By: 0 <None>
Sorry - I received the mail notification for the 11/19 update, but not for the 
10/31, 11/08 updates.  Either I missed them, or my ISPs spam filter ate them 
for lunch :(  I'll make sure that doesn't happen in the future.

I'll try to do a test over the weekend.  

-------------------------------------------------------
Date: Fri 11/19/04 at 19:37         By: James Youngman <jay>
Did you get a chance to do that test?

-------------------------------------------------------
Date: Mon 11/08/04 at 21:52         By: James Youngman <jay>
I'm marking this bug postponed for now, but will look at it again when I get 
the diagnostic info from the test with findutils-4.2.3 (or later).  

-------------------------------------------------------
Date: Sun 10/31/04 at 17:29         By: James Youngman <jay>
findutils 4.2.3 (available on ftp://alpha.gnu.org/gnu/findutils) includes an 
enhanced diagnostic for this scenario.  Could you re-test with that, please?  
Thanks, 
James.


-------------------------------------------------------
Date: Mon 06/16/03 at 19:26         By: Steve Revilak <srevilak>
I hit the submit button a little too soon: "exists" in the Summary line should 
be "exits".  Sorry :(












For detailed info, follow this link:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=3998>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/







reply via email to

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