Skip to content
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

Potential issue with rename system call #170

Open
SleepyMug opened this issue Jul 23, 2024 · 2 comments
Open

Potential issue with rename system call #170

SleepyMug opened this issue Jul 23, 2024 · 2 comments
Assignees

Comments

@SleepyMug
Copy link
Collaborator

SleepyMug commented Jul 23, 2024

If the command being run has rename in it, while the renaming target is an existing directory, try gives EXDEV (Invalid cross-device link)

Potentially related to redirect_dir feature (https://docs.kernel.org/filesystems/overlayfs.html#renaming-directories)

To recreate:

Create rename.c:

#include <stdio.h>
#include <unistd.h>

int main(void)
{
    int ret;
    ret = link("x", "y");
    printf("link ret=%d\n", ret);
    ret = unlink("x");
    printf("unlink ret=%d\n", ret);
}

Then do the following:

$ gcc rename.c -o rename
$ mkdir x
$ ./rename
rename: Success
$ rmdir y; mkdir x
$ try ./rename
rename: Invalid cross-device link
@kwakubiney
Copy link

Can i pick this up? Assign to me if possible :)

@ezrizhu
Copy link
Collaborator

ezrizhu commented Nov 2, 2024

Can i pick this up? Assign to me if possible :)

Sure thing, please make a PR when it's ready.

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

No branches or pull requests

3 participants