fix: Renames if source and destination are on different filesystems - #503
fix: Renames if source and destination are on different filesystems#503js-murph wants to merge 2 commits into
Conversation
|
How can those two files possibly be on different file systems? |
I've dropped you a message with a more thorough history of the investigation. But the tldr is that if you place a hermit package in a docker image, run that image as a container and it hits this block of code the package will be on the lowerdir of overlayfs but new data when os.Rename() runs is written to the upperdir resulting in the error in the original comment. This PR is possibly not for merging, there might be a better way to fix this, I just wanted to share a possible solution. |
|
Ah! Somewhat surprisingly, your comment in here makes more sense than the other one! 😂 So the problem is caused by Hermit trying to update itself from within Docker? Maybe we should add a flag to disable updates... or step back and think. |
I find if I write a sentence enough times it will eventually make sense to someone 😂. Disabling the updates would fix this I think, there are also times where we've relied on that auto-updating feature to roll out fixes. I'm ok either way but it may have implications for releasing hermit changes. Perhaps @wsutina or @mpeyper should weigh in as this affects them more. |
What?
Has a fallback strategy for moving files when it's unable to perform an
os.Rename()Why?
If the source and destination are on different mount locations then the Rename will fail with an error like...
rename /root/.cache/hermit/pkg/hermit@square /root/.cache/hermit/pkg/.hermit@square.old: invalid cross-device linkThis has a fallback to copy the file if it fails to perform the rename.