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

Error: Could Not Rename: ... to ... #95

Closed
ar7eniyan opened this issue Dec 24, 2022 · 6 comments · Fixed by #100
Closed

Error: Could Not Rename: ... to ... #95

ar7eniyan opened this issue Dec 24, 2022 · 6 comments · Fixed by #100
Labels

Comments

@ar7eniyan
Copy link
Contributor

ar7eniyan commented Dec 24, 2022

Reproduction Rate

On each tldr <command> run without local database

Steps to Reproduce

  1. rm -rf ~/.tldrc
  2. tldr tldr

Result

Couple seconds of delay (downloading the tldr database), then the error message Error: Could Not Rename: /tmp/tldrXXXXXX/tldr-main to /home/<user>/.tldrc/tldr/, then the actual tldr page.
strace shows that the rename call fails with EXDEV (Invalid cross-device link).

Expected Result

Normal output witout error

Additional Information

$ tldr --version
tldr v1.5.0 (v1.5.0-3-g903b38d)
Copyright (C) 2016 Arvid Gerstmann
Source available at https://github.com/tldr-pages/tldr-c-client

Arch Linux, tldr installed from tldr-git

@ar7eniyan ar7eniyan changed the title Error: Could Not Rename: /tmp/tldrXXXXXX/tldr-main to /home/<user>/.tldrc/tldr/ Error: Could Not Rename: ... to ... Dec 24, 2022
@MasterOdin
Copy link
Contributor

To help me understand the actual bug and fixing it, for your setup, do you have /tmp and /home mounted to different drives?

@ar7eniyan
Copy link
Contributor Author

@MasterOdin Yes, /tmp is tmpfs and /home is ext4

@eliminmax
Copy link

Ran into this issue myself, and found another project with the same issue. Apparently, it's a limitation of the rename() library call, which can be worked around by copying the source to the destination, then deleting the source once it succeeds. This is what the mv command does.

My experience with C is very limited, and given that it does not seem like there's a simple, standard, cross-platform way to copy a file, I don't think I am the right person to fix this.

@github-actions github-actions bot added the Stale label Jan 17, 2023
@MasterOdin MasterOdin added bug and removed Stale labels Jan 31, 2023
@bric3
Copy link

bric3 commented Apr 11, 2023

I noticed this on a fedora, when doing an update with tldr --update.

The mount output shows indeed the different volumes, which is quite common for /tmp regardless of the distribution.

tmpfs on /tmp type tmpfs (rw,nosuid,nodev,seclabel,nr_inodes=1048576,inode64)

@ar7eniyan
Copy link
Contributor Author

ar7eniyan commented Apr 12, 2023

After some research, I haven't found any reliable cross-platform way to move a directory between different FS, doing it manually in C is error-prone and complicated. Seems like the best way to deal with it is to download a zip file to $HOME/.tldrc/tmp/main.zip. Or if it really needs to be in /tmp (which it doesn't), directory moving can be done using system("/bin/mv ...")

@dylanmtaylor
Copy link

I'm also hitting this.

Error: Could Not Rename: /tmp/tldrFB8aMw/tldr-main to /home/taylord/.tldrc/tldr/

My /home is on a separate partition as well.

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.

5 participants