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

EXDEV: cross-device link not permitted, rename #8

Open
ci010 opened this issue Jan 10, 2024 · 2 comments
Open

EXDEV: cross-device link not permitted, rename #8

ci010 opened this issue Jan 10, 2024 · 2 comments

Comments

@ci010
Copy link

ci010 commented Jan 10, 2024

I use this library to safe user json config file.

The full error is like:

EXDEV: cross-device link not permitted, rename 'C:\Users<username>\AppData\Roaming\xmcl\user.json.tmp-48051806880cfebe' -> 'C:\Users<username>\AppData\Roaming\xmcl\user.json'

I only observe this issue in telemetry. I cannot repro this in my environment.

Any idea about this issue?

I'm using atomically 2.0.1. Currently the users encountered this issue are using Windows.

@fabiospampinato
Copy link
Owner

fabiospampinato commented Mar 22, 2024

I think this error is about renaming across different volumes, which in general is not an atomic operation so the OS says it can't do it, or at least that's how I understood it.

In the sanitized paths you provided I'm assuming the <username> and <user> placeholders are supposed to be the same string, right? If so then it seems weird that this error is thrown when renaming a file within the same folder, which I don't see how it could trigger that error. Maybe the user.json file is a symlink or something? I've no idea on how to reproduce this issue 🤔 And either way I'm not sure there are alternative strategies that could be used, we just need the rename to work for the write to be actually atomic.

Potentially what you could do is catching that error and falling back to regular writing, but obviously that's not great if you want your writes to not corrupt the file.

@ci010
Copy link
Author

ci010 commented Mar 29, 2024

I think this error is about renaming across different volumes, which in general is not an atomic operation so the OS says it can't do it, or at least that's how I understood it.

In the sanitized paths you provided I'm assuming the <username> and <user> placeholders are supposed to be the same string, right? If so then it seems weird that this error is thrown when renaming a file within the same folder, which I don't see how it could trigger that error. Maybe the user.json file is a symlink or something? I've no idea on how to reproduce this issue 🤔 And either way I'm not sure there are alternative strategies that could be used, we just need the rename to work for the write to be actually atomic.

Potentially what you could do is catching that error and falling back to regular writing, but obviously that's not great if you want your writes to not corrupt the file.

Yes, the error should represent the cross volumes error, but I'm pretty sure both files are on the same folder. Currently I try to fallback to directly write the file back as workaround and it works okay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants