Skip to content

Non-zero return code when copying a file from another user which is already present #669

@ColemanTom

Description

@ColemanTom

When I do something like dsync file destfile; echo $?; dsync file destfile; echo $? - both the echos show 0. But, if I do dsync ~another_user/file destfile; echo $?; dsync ~another_user/file destfile; echo$? - the first echo will be 0, and the second will be 1. This build is compiled with xattrs, lustre, etc. But, it does not appear to be lustre related. If I do -X none, it still returns 1.

I've tried a build with XATTRS off, but the same non-zero return code is provided.

The output from dsync is identical when copied from another user or my own space.

[2026-02-04T03:31:15] Walked 1 items in 0.001 secs (859.593 items/sec) ...
[2026-02-04T03:31:15] Walked 1 items in 0.001 seconds (835.713 items/sec)
[2026-02-04T03:31:15] Comparing file sizes and modification times of 1 items
[2026-02-04T03:31:15] Started   : Feb-04-2026, 03:31:15
[2026-02-04T03:31:15] Completed : Feb-04-2026, 03:31:15
[2026-02-04T03:31:15] Seconds   : 0.000
[2026-02-04T03:31:15] Items     : 1
[2026-02-04T03:31:15] Item Rate : 1 items in 0.000154 seconds (6507.841738 items/sec)
[2026-02-04T03:31:15] Updating timestamps on newly copied files
[2026-02-04T03:31:15] Completed updating timestamps
[2026-02-04T03:31:15] Completed sync

Given this was a success, it should be returning a 0 status.

A quick look, and it appears to be the int tmp_rc = dsync_strmap_compare area. That is returning a tmp_rc < 0 (actual value of -1). Specifically, it is this function

              /* copy metadata values from source to destination, if needed */
              tmp_rc = mfu_flist_file_sync_meta(src_list, src_index, dst_list,
                                                dst_index, mfu_dst_file);

Looking at that function, my guess would be

     /* get owner and group ids */
      uid_t src_uid = (uid_t) mfu_flist_file_get_uid(src_list, src_index);
      gid_t src_gid = (gid_t) mfu_flist_file_get_gid(src_list, src_index);

      uid_t dst_uid = (uid_t) mfu_flist_file_get_uid(dst_list, dst_index);
      gid_t dst_gid = (gid_t) mfu_flist_file_get_gid(dst_list, dst_index);

      /* update ownership on destination if needed */
      if ((src_uid != dst_uid) || (src_gid != dst_gid)) {
          tmp_rc = mfu_copy_ownership(src_list, src_index, dest_path, mfu_file);
          if (tmp_rc < 0) {
              rc = -1;
          }
      }

This is trying to force ownership to be identical. I do not understand why as people surely would want to copy data from other users? I can't see a way to disable this either.

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