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

'Invalid cross-device link' when renaming directories on an aufs volume #35

Closed
OmegaPhil opened this issue Feb 22, 2015 · 7 comments
Closed

Comments

@OmegaPhil
Copy link

This error happens when the directory to rename has children on multiple branches merged in the aufs volume, and essentially sounds to be a temporary failure state that the file manager needs to specially deal with (source) - mv already copes.

I'll see how to fix this now.

@IgnorantGuru
Copy link

In a way I'm surprised this isn't already happening because EXDEV is already handled in a special way because it was sometimes occuring when not expected (stat's st_dev is not always accurate), so it uses move-as-copy as a fallback...
https://github.com/IgnorantGuru/spacefm/blob/d702501f95b9e1c1cc1b83d04fbf83db745f94be/src/vfs/vfs-file-task.c#L749
and
https://github.com/IgnorantGuru/spacefm/blob/d702501f95b9e1c1cc1b83d04fbf83db745f94be/src/vfs/vfs-file-task.c#L825

Those functions in the vfs are recursive so you'll want to only grab the uppermost function of the initial rename attempt (which is already done?) If you need to get into the recursion (EXDEV on the children) it could get a bit messier, but it seems like it wouldn't be trying to rename children anyway, since only topmost is renamed, else it's a copy-as-move. So that's a mystery why it's not already handling this.

@OmegaPhil
Copy link
Author

Thanks, I havent quite got to the point where I was going to ask, but the key is that the error happens on ptk-file-misc.c:3166 which does a raw rename with the error condition resulting in the dialog I see - I'm planning to use vfs_file_task_move there after one failure to see if it fixes stuff (yeah I noticed the vfs code was already well aware of EXDEV).

@IgnorantGuru
Copy link

oic - from that dialog it's different. You can see the move task right above it in the if-block. It actually runs mv there rather than using a vfs task (for assorted reasons). So you can just use a goto. ;) I recommend just using the EXDEV to trigger a move task fallback rather than trying to anticipate it based on fs, etc.

@OmegaPhil
Copy link
Author

Are you sure I shouldn't just spin the code out to another function and call it twice rather than use a goto?...

@OmegaPhil
Copy link
Author

Did it with goto as suggested. I can rename my directory now!!

@BwackNinja
Copy link
Owner

Merged. Closing issue.

@IgnorantGuru
Copy link

I think the goto is a clear enough patch there - it's a very linear function. As for named constants, I'm deeply offended. ;) Actually that original EXDEV change goes way back, maybe to PCManFM-Mod.

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