git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: not all tests pass when on an NFS partition

From
Brandon Casey <casey@nrlssc.navy.mil>
Date
Feb 17, 2009, 16:16 UTC
Message-ID
<oguD57F0nZjzoh_EcoiIq6sB9GB3-tLhSNMQLqx9Xlh_z-uW_d0_yg@cipher.nrlssc.navy.mil>
In-Reply-To
<3a69fa7c0902151219y270681f7r17a108fdf44213ad@mail.gmail.com>
E R wrote:
Show 7 quoted lines
> On Thu, Feb 12, 2009 at 6:54 PM, Brandon Casey <casey@nrlssc.navy.mil> wrote:
> 
>> RHEL 5.2? me too.
>>
>> RHEL 4.7 works fine, same NFS server (running 5.2).
> 
> Yes - it's Centos 5.2. Very interesting.
It looks like mtime (and ctime) are being filled in with the atime value.
I modified builtin-prune.c as follows (warning: copy/pasted):
diff --git a/builtin-prune.c b/builtin-prune.c
index 545e9c1..2c1d351 100644
--- a/builtin-prune.c
+++ b/builtin-prune.c
@@ -38,8 +38,17 @@ static int prune_object(char *path, const char *filename, con
                struct stat st;
                if (lstat(fullpath, &st))
                        return error("Could not stat '%s'", fullpath);
-               if (st.st_mtime > expire)
+               printf("%s: expire %lu\n"
+                      "    inode  %lu\n"
+                      "    atime  %lu\n"
+                      "    mtime  %lu\n"
+                      "    ctime  %lu\n",
+                      fullpath, expire,
+                      st.st_ino, st.st_atime, st.st_mtime, st.st_ctime);
+               if (st.st_mtime > expire) {
+                       puts("not expiring");
                        return 0;
+                }
        }
        if (show_only || verbose) {
                enum object_type type = sha1_object_info(sha1, NULL);


After inserting an 'exit' statement before test 4 of t5304, the second
'git gc' prints the following:

    $ git gc
    Counting objects: 3, done.
    Writing objects: 100% (3/3), done.
    Total 3 (delta 0), reused 3 (delta 0)
    .git/objects/fb/f6228a25d50b1ea329e06e75b2f3f1de3793a0: expire 1233599127
        inode  46186578
        atime  1234807371
        mtime  1234807371
        ctime  1234807371
    not expiring

And stat gives:

    $ stat .git/objects/fb/f6228a25d50b1ea329e06e75b2f3f1de3793a0
      File: `.git/objects/fb/f6228a25d50b1ea329e06e75b2f3f1de3793a0'
      Size: 23              Blocks: 16         IO Block: 4096   regular file
    Device: 1ah/26d Inode: 46186578    Links: 1
    Access: (0444/-r--r--r--)  Uid: (  XXX)   Gid: (  XXX)
    Access: 2009-02-16 12:02:51.000000000 -0600
    Modify: 2009-02-02 12:03:45.000000000 -0600
    Change: 2009-02-16 12:03:46.000000000 -0600

And for the lazy

    $ perl -e 'print scalar(localtime(1234807371)), "\n";'
    Mon Feb 16 12:02:51 2009


Compiling with -O0 produces the same results.
Also, I am unable to write a program to reproduce this behavior.

Here's a variation for you. 'git prune --expire 2.weeks.ago' only fails if
called after a failed 'git gc'.

# edit t5304-prune.sh to replace the second 'git gc' in test 4 with
# 'git prune --expire 2.weeks.ago'
$ rm -rf 'trash directory.t5304-prune'
$ ./t5304-prune.sh
# Success for test 4, but the new 11 and 12 still fail.
# Plus, the correct values for atime, mtime, and ctime are printed out by
# the modifications in the patch above.


# Reset t5304-prune.sh back to the original, then add an exit statement
# _after_ test 4.  The test will fail.  Then cd into 'trash directory.t5304-prune'
# and again 'git prune --expire 2.weeks.ago' will succeed.
$ rm -rf 'trash directory.t5304-prune'
$ ./t5304-prune.sh
$ cd 'trash directory.t5304-prune'
$ git prune --expire 2.weeks.ago
# success, correct file times are printed out.

# Now do the same thing as above, but this time run 'git gc' before running
# prune.
$ rm -rf 'trash directory.t5304-prune'
$ ./t5304-prune.sh
$ cd 'trash directory.t5304-prune'
$ git gc
# fails to remove appropriate file, all file times are from atime
$ git prune --expire 2.weeks.ago
# fails to remove the appropriate file, all file times are from atime

After some amount of time (minutes), git gc succeeds in removing the
object and prints out the correct time values.

-brandon
Previous: Brandon Casey
Message 7 of 7 in “not all tests pass when on an NFS partition”
  1. E RFeb 12, 2009
  2. Junio C HamanoFeb 12, 2009
  3. Brandon CaseyFeb 13, 2009
  4. E RFeb 15, 2009
  5. E RFeb 17, 2009
  6. Brandon CaseyFeb 17, 2009
  7. Brandon CaseyFeb 17, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.