Skip to content
This repository has been archived by the owner on Oct 2, 2022. It is now read-only.

TMPDIR fails when on separate partition #51

Open
ckolivas opened this issue Jan 22, 2020 · 6 comments
Open

TMPDIR fails when on separate partition #51

ckolivas opened this issue Jan 22, 2020 · 6 comments

Comments

@ckolivas
Copy link
Contributor

On linux when TMPDIR is mounted on a different partition it fails to move the file due to it being across partitions with the error:
[anirip] Error: rename /tmp/anirip/episode.mkv $newfilename.mkv: invalid cross-device link
Altering TMPDIR to a directory on the same partition helps as a workaround for now.

@turtletowerz
Copy link

There are a few cases where manipulating files across partitions causes problems in Golang (example). I'm not sure there is an easy fix for this outside of checking for that specific error and creating the TMPDIR in the current working directory. I could make a PR for this but it's a very specific case that I doubt most people will have to deal with.

@ckolivas
Copy link
Contributor Author

It's not that uncommon in linux to mount the home directory on a separate partition to the root directory. Is there any reason the anirip temporary directory can't simply be placed in the output directory?

@jhgorse
Copy link

jhgorse commented Apr 23, 2020

Can confirm this occurs in macOS as well. Temporary directory should be in PWD or app resilient enough to move (copy/delete) between mounted partitions.

Error reported is:

[anirip] Downloading video... [anirip] Downloading subtitles...en-US [anirip] Merging subtitles into MKV container... [anirip] Error: rename /var/folders/wv/h3m89k8959z6sx012m8v6ljc0000gn/T//anirip/episode.mkv $$$$/Season One/$$$$ - S01E111 - %%%%.mkv: cross-device link [anirip] Downloading and merging completed successfully! [anirip] Retrieving Episode Info...

@jhgorse
Copy link

jhgorse commented Apr 24, 2020

Well, it also appears that this is also the architecture used by FreeNAS and Jails: a mount point back to the storage volume. So this will not work there, either.

@turtletowerz are you still game for that PR?

@turtletowerz
Copy link

I could change the Rename function to move files a bit more properly, similar to the answer here, but I don't believe the issue is related to the temporary directory, as this is more related to how unix systems rename files.

I'll make a PR sometime today, but I don't have any unix-based OS to test a new change on so if the PR gets approved I would like some feedback as to whether it worked or not.

@jhgorse
Copy link

jhgorse commented Apr 25, 2020

// TempDir returns the default directory to use for temporary files. // // On Unix systems, it returns $TMPDIR if non-empty, else /tmp. // On Windows, it uses GetTempPath, returning the first non-empty // value from %TMP%, %TEMP%, %USERPROFILE%, or the Windows directory. // On Plan 9, it returns /tmp. // // The directory is neither guaranteed to exist nor have accessible // permissions. func TempDir() string { return tempDir() }

So maybe I just define $TMPDIR. Testing.

cd path/to/dir mkdir .tmp/anirip export TMPDIR=.tmp anirip username password http://www.crunchyroll.com/miss-kobayashis-dragon-maid

This appears to resolve the issue for macOS.

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

No branches or pull requests

3 participants