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 (os error 18) #3092

Closed
ilgazil opened this issue Oct 10, 2019 · 3 comments · May be fixed by #19879
Closed

Invalid cross-device link (os error 18) #3092

ilgazil opened this issue Oct 10, 2019 · 3 comments · May be fixed by #19879
Labels

Comments

@ilgazil
Copy link

ilgazil commented Oct 10, 2019

const { makeTempDirSync, cwd, renameSync } = Deno;

const from = makeTempDirSync();
const to = `${cwd()}/foo`;

renameSync(from, to);

The code above results with this error:
Uncaught Other: Invalid cross-device link (os error 18)

It seems to be because of my device mount config. If rename is asked inside the same device, everything is fine.

$ df -h
Filesystem                  Size  Used Avail Use% Mounted on
tmpfs                       7.9G   53M  7.8G   1% /tmp
/dev/mapper/vg0-home        197G   59G  129G  32% /home

Any plan to implements shutil.rename instead or being complementary to os.rename?

@golavr
Copy link

golavr commented Jul 19, 2020

same problem for me.
running deno inside docker container with volume mounted.

@jingkaimori
Copy link

The answer is given by TTTie in discord:

You must copy the file from the first FS to the second FS and remove it from the original FS afterwards as it is the OS which does not allow rename() across devices.

but can we implement this procedure in std/fs/move.ts ?

@stale
Copy link

stale bot commented Jan 6, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 6, 2021
@stale stale bot closed this as completed Jan 13, 2021
fourside added a commit to fourside/podcast that referenced this issue Jan 13, 2022
joehillen added a commit to joehillen/deno that referenced this issue Jul 19, 2023
Rather than expect the user to know that they need to handle a special
case when renaming across filesystems, we can just handle it for them.

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

Successfully merging a pull request may close this issue.

3 participants