Skip to content

linux,darwin: make uv_fs_copyfile behaves like cp -r#4396

Merged
santigimeno merged 1 commit intolibuv:v1.xfrom
juanarbol:juan/fix-cp-file
May 8, 2024
Merged

linux,darwin: make uv_fs_copyfile behaves like cp -r#4396
santigimeno merged 1 commit intolibuv:v1.xfrom
juanarbol:juan/fix-cp-file

Conversation

@juanarbol
Copy link
Copy Markdown
Member

This commit changes the timestamps in the file, the ownership and the group.

Fixes: #3125

Am I missing any metadata here?

juan@ubuntu:/tmp$ ls -l | grep cop
-rwxrwxrwx 1 juan testing  811 Apr 26 22:12 copied
-rwxrwxrwx 1 juan testing  811 Apr 26 22:12 copied2
-rwxrwxrwx 1 juan testing  811 Apr 26 21:47 copyFile.c

@juanarbol juanarbol force-pushed the juan/fix-cp-file branch 3 times, most recently from 4770b18 to 2ca7cfc Compare April 26, 2024 22:58
Comment thread src/unix/fs.c Outdated
Comment thread src/unix/fs.c Outdated
Comment thread src/unix/fs.c Outdated
Comment thread src/unix/fs.c Outdated
@juanarbol juanarbol force-pushed the juan/fix-cp-file branch from a5c5097 to b1db4a1 Compare May 6, 2024 17:19
This commit changes the timestamps in the file, the ownership and the
group.

Fixes: libuv#3125
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
@juanarbol juanarbol force-pushed the juan/fix-cp-file branch from b1db4a1 to 0f1e23c Compare May 6, 2024 17:45
@santigimeno santigimeno merged commit bf61390 into libuv:v1.x May 8, 2024
skooch added a commit to skooch/libuv that referenced this pull request Mar 11, 2026
futimens() on CIFS/SMB shares may fail with EPERM because these
filesystems do not support setting arbitrary timestamps. Since
preserving timestamps during copyfile is best-effort, detect the
CIFS/SMB condition using uv__is_cifs_or_smb() and squelch the error,
matching the existing handling for fchmod() in the same function.

Without this fix, uv_fs_copyfile() fails with EPERM when copying
files to CIFS/SMB mounts on Linux (e.g. Alpine containers with
mounted cifs shares).

Fixes: nodejs/node#56248
Refs: libuv#4396
skooch added a commit to skooch/node that referenced this pull request Mar 11, 2026
Original commit message:

    unix: squelch futimens() EPERM on CIFS/SMB shares in copyfile

    futimens() on CIFS/SMB shares may fail with EPERM because these
    filesystems do not support setting arbitrary timestamps. Since
    preserving timestamps during copyfile is best-effort, detect the
    CIFS/SMB condition using uv__is_cifs_or_smb() and squelch the error,
    matching the existing handling for fchmod() in the same function.

    Without this fix, uv_fs_copyfile() fails with EPERM when copying
    files to CIFS/SMB mounts on Linux (e.g. Alpine containers with
    mounted cifs shares).

    Refs: libuv/libuv#4396

Fixes: nodejs#56248
skooch added a commit to skooch/libuv that referenced this pull request Mar 11, 2026
futimens() on CIFS/SMB shares may fail with EPERM because these
filesystems do not support setting arbitrary timestamps. Since
preserving timestamps during copyfile is best-effort, detect the
CIFS/SMB condition using uv__is_cifs_or_smb() and squelch the error,
matching the existing handling for fchmod() in the same function.

Without this fix, uv_fs_copyfile() fails with EPERM when copying
files to CIFS/SMB mounts on Linux (e.g. Alpine containers with
mounted cifs shares).

Fixes: nodejs/node#56248
Refs: libuv#4396
saghul pushed a commit to skooch/libuv that referenced this pull request Mar 12, 2026
futimens() on CIFS/SMB shares may fail with EPERM because these
filesystems do not support setting arbitrary timestamps. Since
preserving timestamps during copyfile is best-effort, detect the
CIFS/SMB condition using uv__is_cifs_or_smb() and squelch the error,
matching the existing handling for fchmod() in the same function.

Without this fix, uv_fs_copyfile() fails with EPERM when copying
files to CIFS/SMB mounts on Linux (e.g. Alpine containers with
mounted cifs shares).

Fixes: nodejs/node#56248
Refs: libuv#4396
skooch added a commit to skooch/libuv that referenced this pull request Apr 15, 2026
futimens() may fail with EPERM on CIFS/SMB shares that do not
support setting timestamps. Since preserving timestamps during
copyfile is best-effort, ignore the return value unconditionally.

Fixes: nodejs/node#56248
Refs: libuv#4396
saghul pushed a commit that referenced this pull request Apr 17, 2026
futimens() may fail with EPERM on CIFS/SMB shares that do not
support setting timestamps. Since preserving timestamps during
copyfile is best-effort, ignore the return value unconditionally.

Fixes: nodejs/node#56248
Refs: #4396
skooch added a commit to skooch/node that referenced this pull request Apr 21, 2026
Original commit message:

    unix: treat futimens() as best-effort in copyfile

    futimens() may fail with EPERM on CIFS/SMB shares that do not
    support setting timestamps. Since preserving timestamps during
    copyfile is best-effort, ignore the return value unconditionally.

    Refs: libuv/libuv#4396

Fixes: nodejs#56248
nodejs-github-bot pushed a commit to nodejs/node that referenced this pull request Apr 25, 2026
Original commit message:

    unix: treat futimens() as best-effort in copyfile

    futimens() may fail with EPERM on CIFS/SMB shares that do not
    support setting timestamps. Since preserving timestamps during
    copyfile is best-effort, ignore the return value unconditionally.

    Refs: libuv/libuv#4396

Fixes: #56248
PR-URL: #62881
Refs: libuv/libuv#5053
Refs: libuv/libuv#4396
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
aduh95 pushed a commit to nodejs/node that referenced this pull request May 5, 2026
Original commit message:

    unix: treat futimens() as best-effort in copyfile

    futimens() may fail with EPERM on CIFS/SMB shares that do not
    support setting timestamps. Since preserving timestamps during
    copyfile is best-effort, ignore the return value unconditionally.

    Refs: libuv/libuv#4396

Fixes: #56248
PR-URL: #62881
Refs: libuv/libuv#5053
Refs: libuv/libuv#4396
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
aduh95 pushed a commit to nodejs/node that referenced this pull request May 7, 2026
Original commit message:

    unix: treat futimens() as best-effort in copyfile

    futimens() may fail with EPERM on CIFS/SMB shares that do not
    support setting timestamps. Since preserving timestamps during
    copyfile is best-effort, ignore the return value unconditionally.

    Refs: libuv/libuv#4396

Fixes: #56248
PR-URL: #62881
Refs: libuv/libuv#5053
Refs: libuv/libuv#4396
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
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

Successfully merging this pull request may close these issues.

uv_fs_copyfile is missing chgrp and other attributes

4 participants