Closed SleepyMug closed 1 week ago
Can i pick this up? Assign to me if possible :)
Can i pick this up? Assign to me if possible :)
Sure thing, please make a PR when it's ready.
Which Linux environment (probably version?) did you run the rename
binary on? @SleepyMug
Can you also share your kernel config options for overlay? Perhaps the output of cat /boot/config-$(uname -r) | grep OVERLAY_FS
Sorry for the late reply. I think the key here is that x/
and y/
lives on a different FS as /tmp
.
For some reason I could not recreate the problem with link
anymore, but rename
does trigger the issue.
#include <stdio.h>
#include <unistd.h>
int main(void)
{
int ret;
ret = rename("x", "y");
if (ret < 0) {
perror("rename");
}
}
This is the kernel config in case it's useful.
$ grep /boot/config-$(uname -r) -e 'OVERLAY'
CONFIG_EFI_CUSTOM_SSDT_OVERLAYS=y
CONFIG_OVERLAY_FS=m
# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set
CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y
# CONFIG_OVERLAY_FS_INDEX is not set
CONFIG_OVERLAY_FS_XINO_AUTO=y
# CONFIG_OVERLAY_FS_METACOPY is not set
Haha, yes. Thanks for the reply. I was able to reproduce your issue with rename
and came across this in the kernel
* Directory renames only allowed on "pure upper" (already created on
* upper filesystem, never copied up). Directories which are on lower or
* are merged may not be renamed. For these -EXDEV is returned and
* userspace has to deal with it. This means, when copying up a
* directory we can rely on it and ancestors being stable.
Attempting a fix on #184
Closing this as WONTFIX. This is an applicaiton-level issue and there's nothing we can do to fix broken applications.
I've been thinking about this, and doesn't try
sort of guarantee that whatever outcome you'd get on your machine without try
would be the same you'd get on try
? The usage of overlays is an implementation detail the user shouldn't really care about or?
An application using rename
would have the same issue if the user tried to work across multiple partitions, not just in an overlay. Basically, rename
is not mv
and an application that thinks so is simply broken---and trying to fix it for them could break things worse.
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
:Then do the following: