Git Product home page Git Product logo

Comments (5)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 26, 2024
I actually ran into this very bug with rsync last night, thanks for finding it. 
I'll
apply the change and write a test when I have the time.

Original comment by [email protected] on 28 Apr 2009 at 3:55

  • Changed state: Accepted

from fusecompress.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 26, 2024
Speaking of rsync, I found another related issue.  rsync sets the mtime/atime 
for
symbolic links to the same value as the source link.  The current fusecompress 
uses
utime() which sets the target file's atime/mtime, not the link's.  At first I 
thought
this might be an unsolvable problem since fuse only provides a utime interface 
(not
lutimes()) but then when I watched the DEBUG messages I saw that fuse 
dereferences,
or doesn't dereference, the link before calling fusecompress as appropriate.  
So, if
rsync tried to set mtime for the link, fuse calls fuse_compress.utime() with 
the link
filename.  If rsync tries to set the mtime for the target file, fuse calls
fuse_compress.utime() with the target filename.
Anyway, I found that using lutimes() instead of utime() fixes the problem.  
My testing seems to show that the behavior is what you would expect.  If you 
use the
"touch" command, which always modifies the target not the link, on the link the
target is modified.  However, if you run lutimes() against the link (I have a 
little
C program that's useful testing, and I'll attach it) the link is updated.  I 
believe
that this change is correct but, of course, it should be tested more thoroughly.

This diff includes the first change too:
--- fusecompress.c  (revision 90)
+++ fusecompress.c  (working copy)
@@ -112,7 +112,7 @@
    // (tar checks this item and it is loudly when the result
    // is different than what it exepects)
    //
-   stbuf->st_ctime = stbuf->st_mtime;
+   //stbuf->st_ctime = stbuf->st_mtime;

    UNLOCK(&file->lock);
    return 0;
@@ -436,12 +436,25 @@
 static int fusecompress_utime(const char *path, struct utimbuf *buf)
 {
    const char *full;
-   
+   struct timeval timesval[2];
+   struct timeval *timesbuf=NULL;
+
    full = fusecompress_getpath(path);

-   if (utime(full, buf) == -1)
+   DEBUG_("('%s')", full);
+
+   if (buf != NULL)
+   {
+       timesval[0].tv_usec = 0;
+       timesval[1].tv_usec = 0;
+       timesval[0].tv_sec = buf->actime;
+       timesval[1].tv_sec = buf->modtime;
+       timesbuf=timesval;
+   }
+       
+   if (lutimes(full,timesbuf) == -1)
        return -errno;
-
+   
    return 0;
 }


Original comment by [email protected] on 28 Apr 2009 at 7:02

Attachments:

from fusecompress.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 26, 2024

Original comment by [email protected] on 3 May 2009 at 9:51

  • Added labels: Milestone-0.9.2

from fusecompress.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 26, 2024
This issue was closed by r96.

Original comment by [email protected] on 28 Jul 2009 at 4:28

  • Changed state: Fixed

from fusecompress.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 26, 2024
Patch added in r96. Thanks for your contribution.

Original comment by [email protected] on 28 Jul 2009 at 4:29

from fusecompress.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.