• Jakob Unterwurzacher's avatar
    loopback: fix Utimens on symlinks · d36ee9dd
    Jakob Unterwurzacher authored
    The problem was that os.Chtimes() operates on the target of the
    symlink and not on the symlink itself.
    When tar extracts an archive containing a symlink, it actually wants
    to set the times on the symlink. This can also be tested using
    "touch -h".
    
    This patch adds a wrapper for the Linux utimensat(2) syscall
    that allows passing flags along with a unit test.
    
    It uses the flag AT_SYMLINK_NOFOLLOW to implement
    loopbackFileSystem.Utimens() properly.
    
    It also add handling for UTIME_NOW and UTIME_OMIT that was already
    present in loopbackFile.Utimens() but missing in loopbackFileSystem.
    
    Fixes issue 81 ( https://github.com/hanwen/go-fuse/issues/81 ).
    d36ee9dd
loopback.go 5.46 KB