Closed ar7eniyan closed 11 months ago
To help me understand the actual bug and fixing it, for your setup, do you have /tmp
and /home
mounted to different drives?
@MasterOdin Yes, /tmp
is tmpfs
and /home
is ext4
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.
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)
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 ...")
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.
Reproduction Rate
On each
tldr <command>
run without local databaseSteps to Reproduce
rm -rf ~/.tldrc
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
Arch Linux, tldr installed from tldr-git