Last active
December 29, 2015 22:49
-
-
Save geoff-nixon/7738856 to your computer and use it in GitHub Desktop.
No futimesat/utimensat on Darwin (any many others, it think) — patch for bindfs % cd26 $ 1-Dec-13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh # or, ( curl -L http://git.io/RkCAYg>p;sh ./p ) # bindfs @ cd26 #3 | |
#---------------------------------------------------------------------------# | |
echo; patch -p0 < "$0" && rm "$0" && exit 0 || exit 1 # ------8<------ | |
Index: src/bindfs.c --- +++ --- +++ --- +++ --- src/bindfs.c +++ src/bindfs.c | |
----------------------------------------------------------------------------= | |
@@ -180 +180 @@ | |
-static int bindfs_utimens(const char *path, const struct timespec tv[2]); | |
+static int bindfs_utime(const char *path, struct utimbuf *buf); | |
@@ -693 +693 @@ | |
-static int bindfs_utimens(const char *path, const struct timespec tv[2]) | |
+static int bindfs_utime(const char *path, struct utimbuf *buf) | |
@@ -699 +699 @@ | |
- res = utimensat(settings.mntsrc_fd, path, tv, AT_SYMLINK_NOFOLLOW); | |
+ res = utime(path, buf); | |
@@ -909 +909 @@ | |
- .utimens = bindfs_utimens, | |
+ .utime = bindfs_utime, | |
Index: tests/Makefile.am --- +++ --- tests/Makefile.am +++ tests/Makefile.am | |
----------------------------------------------------------------------------- | |
@@ -2 +2 @@ | |
-noinst_PROGRAMS = readdir_inode utimens_nofollow | |
+noinst_PROGRAMS = readdir_inode | |
@@ -4 +3,0 @@ | |
-utimens_nofollow_SOURCES = utimens_nofollow.c | |
Index: tests/test_bindfs.rb -- tests/test_bindfs.rb +++ tests/test_bindfs.rb | |
----------------------------------------------------------------------------- | |
@@ -374,15 +373,0 @@ | |
-root_testenv("", :title => "utimens on symlinks") do | |
- touch('mnt/file') | |
- Dir.chdir "mnt" do | |
- system('ln -sf file link') | |
- end | |
- | |
- system("#{$tests_dir}/utimens_nofollow mnt/link 12 34 56 78") | |
- raise "Failed to run utimens_nofollow: #{$?.inspect}" unless $?.success? | |
- | |
- assert { File.lstat('mnt/link').atime.to_i < 100 } | |
- assert { File.lstat('mnt/link').mtime.to_i < 100 } | |
- assert { File.lstat('mnt/file').atime.to_i > 100 } | |
- assert { File.lstat('mnt/file').mtime.to_i > 100 } | |
-end | |
- | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment