Skip to content

mv: gnu test case to-symlink compatibility #6577

@matrixhead

Description

@matrixhead

Currently, the GNU test case to-symlink for mv is failing. This test case checks whether mv unlinks the destination symlink before moving a file to a symlink in another partition. If it does not unlink, then the "copy code" used to copy the file to another partition would follow the symlink and replace the file it's pointing to instead of the symlink itself.
for example

echo local > file
mkdir -p  /dev/shm/test/
echo remote > /dev/shm/test/rem_file
ln -rs /dev/shm/test/rem_file /dev/shm/test/rem_symlink
mv file /dev/shm/test/rem_symlink
ls  -l /dev/shm/test/

should give us

total 8
-rw-r--r-- 1 mhead mhead 6 Jul 17 21:01 rem_file
-rw-r--r-- 1 mhead mhead 6 Jul 17 21:03 rem_symlink

notice that the rem_symlink is now a file and if we cat rem_symlink it would have the contents of file
but in our case

total 4
-rw-r--r-- 1 mhead mhead 6 Jul 17 21:01 rem_file
lrwxrwxrwx 1 mhead mhead 8 Jul 17 20:59 rem_symlink -> rem_file

rem_symlink is still a symlink, what happened is uu_mv followed the symlink replaced the rem_file instead of rem_symlink

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions