os.Rename is just a thin wrapper around syscall.Rename which errors if source and destination are not on the same filesystem.
Possible quickfixes that I see after glancing over it:
Initialize the tmp directory next to the destination so that they live on the same filesystem. This however could mean that orphaned files remain in edge case crash scenarios as there is no os cleanup mechanism like for /tmp present.
Handle the rename error via a errors.Is(syscall.EXDEV) check and fallback to copying. This of course looses the integrity guarantees renaming brings for systems where /tmp is not on the same filesystem.
Bug Report
1. Minimal reproduce step (Required)
Use the kcl cli and have on linux /tmp on a tmpfs (or any filesystem separate from where the cli will be executed)
Relevant excerpt from
mount
:2. What did you expect to see? (Required)
No error ;)
3. What did you see instead (Required)
4. What is your KCL components version? (Required)
kcl cli is
0.9.0-rc.1-linux-amd64
5. Error origin
The bug originates from here.
os.Rename
is just a thin wrapper aroundsyscall.Rename
which errors if source and destination are not on the same filesystem.Possible quickfixes that I see after glancing over it:
/tmp
present.errors.Is(syscall.EXDEV)
check and fallback to copying. This of course looses the integrity guarantees renaming brings for systems where/tmp
is not on the same filesystem.