preload: copy timestamps with cp -p
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 122
- Forks
- 34
- PR merge metrics
- No merged PRs in 30d
Description
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``.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the filesystem syscall wrapper layer for utimensat, fadvise64, and fgetxattr. Reproduce the cp -pr failure on NFS using the supplied strace, then verify that timestamp copying and the referenced descriptor operations complete without the missing-wrapper errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100