Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preload: copy timestamps with cp -p #729

Open
adammoody opened this issue Aug 4, 2022 · 2 comments
Open

preload: copy timestamps with cp -p #729

adammoody opened this issue Aug 4, 2022 · 2 comments

Comments

@adammoody
Copy link
Collaborator

A cp with the -p option fails when accessing a file descriptor while trying to copy the file timestamps. Here is an strace output for cp -pr file.foo file.bar on NFS.

stat("file.bar", 0x7fffffffbed0)        = -1 ENOENT (No such file or directory)
lstat("file.foo", {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
stat("file.bar", 0x7fffffffbc30)        = -1 ENOENT (No such file or directory)
open("file.foo", O_RDONLY|O_NOFOLLOW)   = 3
fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
open("file.bar", O_WRONLY|O_CREAT|O_EXCL, 0600) = 4
fstat(4, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
fadvise64(3, 0, 0, POSIX_FADV_SEQUENTIAL) = 0
read(3, "", 65536)                      = 0
utimensat(4, NULL, [{tv_sec=1659649206, tv_nsec=800501000} /* 2022-08-04T14:40:06.800501000-0700 */, {tv_sec=1659649206, tv_nsec=800501000} /* 2022-08-04T14:40:06.800501000-0700 */], 0) = 0
fgetxattr(3, "system.posix_acl_access", 0x7fffffffb870, 132) = -1 EOPNOTSUPP (Operation not supported)
fsetxattr(4, "system.posix_acl_access", "\2\0\0\0\1\0\6\0\377\377\377\377\4\0\0\0\377\377\377\377 \0\0\0\377\377\377\377", 28, 0) = -1 EOPNOTSUPP (Operation not supported)
fchmod(4, 0100600)                      = 0
close(4)                                = 0
close(3)                                = 0
lseek(0, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
close(0)                                = 0
close(1)                                = 0
close(2)                                = 0

It looks to be due to a missing wrapper for utimensat.

We should also check fadvise64, fgetxattr, fgetxattr.

@adammoody
Copy link
Collaborator Author

Actually it seems, cp -p calls futimens. I added wrappers for this and and "not supported" wrapper for utimensat in 6497781

@adammoody
Copy link
Collaborator Author

Noticing a segfault on a touch /unifyfs/file1:

2022-08-05T13:14:54 tid=51630 @ __wrap_close() [unifyfs-sysio.c:2287] closing (internal=0, exposed=1024)
2022-08-05T13:14:54 tid=51630 @ __wrap_close() [unifyfs-sysio.c:2324] syncing fid=1
2022-08-05T13:14:54 tid=51630 @ unifyfs_intercept_fd() [posix_client.c:289] Changing fd from exposed dup2=0 to internal 0
./runme_preload: line 68: 51630 Segmentation fault      (core dumped) touch /unifyfs/file1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant