-
Notifications
You must be signed in to change notification settings - Fork 66
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
mfu_param_path: fix cutting root component #536
Conversation
Even when `! copy_into_dir`, we still still shouldn't cut the root component. Signed-off-by: Dalton Bohning <dalton.bohning@intel.com>
Thanks, @daltonbohning and @wiliamhuang . To help me work through the cases, would you mind also describing some example usage scenarios that this is fixing? |
@adammoody You probably wouldn't run into it with POSIX/Lustre unless you're copying the root filesystem and the root has files and directories, so I'll use a DAOS example:
If container1 has this structure:
The simplified flow is something like:
Hence, we |
@adammoody Does this make sense? |
Yes, thanks. I wanted to review it again with that kind of example in mind, but I got pulled on to something else. I'll get back to it today. |
@daltonbohning , I finally found some time to dig into this. Sorry for the delay. In your example above, it seems like the existing code would work if the destination was identified as a directory from this check: mpifileutils/src/common/mfu_param_path.c Lines 512 to 520 in 6230ed2
Can you verify whether that is true if the destination container already exists? I do see the problem if the destination container does not already exist. The copy_into_dest flag will not be set since the list of source paths is a single item ("/"). In this case, the user wants dcp to copy all children of the given directory ("/") rather than the directory itself. Some have asked for this kind of feature to apply to all directories, so we may even want to generalize this. For example, from the rsync man page, a trailing slash on a source path means to copy the "contents of the directory" rather than to copy the "directory" itself.
We could delay that generalization to later, just thinking out loud ... |
src/common/mfu_param_path.c
Outdated
if (cut > 0 && strcmp(paths[i].orig, "/") == 0) { | ||
cut--; | ||
} | ||
if ((cut > 0) && mfu_copy_opts->copy_into_dir && | ||
(mfu_copy_opts->do_sync != 1) && (paths[i].orig[strlen(paths[i].orig) - 1] != '/')) { | ||
cut--; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the source path is "/"
and copy_into_dir == 1
here, I think both if blocks would execute, so that we'd keep two components from the destination item. Is that intended? Maybe it wouldn't make a difference, but the code might be clearer to just execute one or the other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think they would both execute, because of the paths[i].orig[strlen(paths[i].orig) - 1] != '/')
check in the second statement. But you're right - I should just make this else if
to be clear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right. I misread that code as =='/'
.
@adammoody It doesn't seem to matter if the destination container exists, but rather if the destination directory (DAOS or POSIX) does.
|
I'm not sure if we should or shouldn't do this :) |
Let's not worry about generalizing here, since it would change the user interface on people. |
Signed-off-by: Dalton Bohning <dalton.bohning@intel.com>
Thanks, @daltonbohning . Looks good. |
Thanks @adammoody ! |
Even when
! copy_into_dir
, we still still shouldn't cut the root component.Signed-off-by: Dalton Bohning dalton.bohning@intel.com