Skip to content

dsync could abort earlier if trying to write to a folder that is actually a file #671

@ColemanTom

Description

@ColemanTom

Using v0.12 mpifileutils. If I try to use dsync one file into a new directory path which is actually a file, dsync knows it failed early - in the walk phase, but then it still goes through the copy phase, and then the metadata adjustment phase. It should ideally abort straight after the walk phase. Similarly, if creation fails but walk passed, it should not try to adjust metadata. See the snippet below.

$ touch foo
$ touch bar
$ dsync bar foo/bar
[2026-02-04T23:13:43] Walking source path
[2026-02-04T23:13:43] Walking /home/user/mpifileutils/src/temp/bar
[2026-02-04T23:13:43] Walked 1 items in 0.047 secs (21.325 items/sec) ...
[2026-02-04T23:13:43] Walked 1 items in 0.047 seconds (21.248 items/sec)
[2026-02-04T23:13:43] Walking destination path
[2026-02-04T23:13:43] Walking /home/user/mpifileutils/src/temp/foo/bar
[2026-02-04T23:13:43] [0] [/home/user/mpifileutils/src/common/mfu_flist_walk.c:517] ERROR: Failed to stat: '/home/user/mpifileutils/src/temp/foo/bar' (errno=20 Not a directory)
[2026-02-04T23:13:43] Walked 0 items in 0.001 secs (0.000 items/sec) ...
[2026-02-04T23:13:43] Walked 0 items in 0.001 seconds (0.000 items/sec)
[2026-02-04T23:13:43] Started   : Feb-04-2026, 23:13:43
[2026-02-04T23:13:43] Completed : Feb-04-2026, 23:13:43
[2026-02-04T23:13:43] Seconds   : 0.000
[2026-02-04T23:13:43] Items     : 0
[2026-02-04T23:13:43] Item Rate : 0 items in 0.000165 seconds (0.000000 items/sec)
[2026-02-04T23:13:43] Copying items to destination
[2026-02-04T23:13:43] Copying to /home/user/mpifileutils/src/temp/foo/bar
[2026-02-04T23:13:43] Items: 1
[2026-02-04T23:13:43]   Directories: 0
[2026-02-04T23:13:43]   Files: 1
[2026-02-04T23:13:43]   Links: 0
[2026-02-04T23:13:43] Data: 0.000 B (0.000 B per file)
[2026-02-04T23:13:43] Creating 1 files.
[2026-02-04T23:13:43] [0] [/home/user/mpifileutils/src/common/mfu_flist_copy.c:1256] ERROR: File `/home/user/mpifileutils/src/temp/foo/bar' mknod() failed (errno=20 Not a directory)
[2026-02-04T23:13:43] Copying data.
[2026-02-04T23:13:43] [0] [/home/user/mpifileutils/src/common/mfu_flist_copy.c:2083] ERROR: Failed to open output file `/home/user/mpifileutils/src/temp/foo/bar' (errno=20 Not a directory)
[2026-02-04T23:13:43] [0] [/home/user/mpifileutils/src/common/mfu_flist_copy.c:2237] ERROR: Failed to copy `/home/user/mpifileutils/src/temp/bar' to `/home/user/mpifileutils/src/temp/foo/bar'
[2026-02-04T23:13:43] Copy data: 0.000 B (0 bytes)
[2026-02-04T23:13:43] Copy rate: 0.000 B/s (0 bytes in 0.001 seconds)
[2026-02-04T23:13:43] Syncing data to disk.
[2026-02-04T23:13:43] Sync completed in 0.053 seconds.
[2026-02-04T23:13:43] Setting ownership, permissions, and timestamps.
[2026-02-04T23:13:43] [0] [/home/user/mpifileutils/src/common/mfu_flist_copy.c:475] ERROR: Failed to change ownership on `/home/user/mpifileutils/src/temp/foo/bar' lchown() (errno=20 Not a directory)
[2026-02-04T23:13:43] [0] [/home/user/mpifileutils/src/common/mfu_flist_copy.c:501] ERROR: Failed to change permissions on `/home/user/mpifileutils/src/temp/foo/bar' chmod() (errno=20 Not a directory)
[2026-02-04T23:13:43] [0] [/home/user/mpifileutils/src/common/mfu_flist_copy.c:640] ERROR: Failed to change timestamps on `/home/user/mpifileutils/src/temp/foo/bar' utime() (errno=20 Not a directory)
[2026-02-04T23:13:43] Updated 1 items in 0.000 seconds (10402.862 items/sec)
[2026-02-04T23:13:43] Syncing directory updates to disk.
[2026-02-04T23:13:43] Sync completed in 0.028 seconds.
[2026-02-04T23:13:43] Started: Feb-04-2026,23:13:43
[2026-02-04T23:13:43] Completed: Feb-04-2026,23:13:43
[2026-02-04T23:13:43] Seconds: 0.083
[2026-02-04T23:13:43] Items: 0
[2026-02-04T23:13:43]   Directories: 0
[2026-02-04T23:13:43]   Files: 0
[2026-02-04T23:13:43]   Links: 0
[2026-02-04T23:13:43] Data: 0.000 B (0 bytes)
[2026-02-04T23:13:43] Rate: 0.000 B/s (000 bytes in 0.083 seconds)
[2026-02-04T23:13:43] Updating timestamps on newly copied files
[2026-02-04T23:13:43] Completed updating timestamps
[2026-02-04T23:13:43] Completed sync
$ echo $?
1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions