mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
fish: edit: write to the real file name
When saving, resolve the path of the file being edited and use that as real target to write to. Otherwise, if the file name is a symlink then it will be replaced by a regular file with the new content, leaving the old file untouched. Extend test-edit.sh to check for this situation.
This commit is contained in:
@@ -43,6 +43,12 @@ cat /file.txt
|
||||
stat /file.txt | grep mode:
|
||||
stat /file.txt | grep uid:
|
||||
stat /file.txt | grep gid:
|
||||
echo ==========
|
||||
write /file-2.txt "symlink test\n"
|
||||
ln-s /file-2.txt /symlink-2.txt
|
||||
edit /symlink-2.txt
|
||||
is-symlink /symlink-2.txt
|
||||
cat /symlink-2.txt
|
||||
EOF
|
||||
)
|
||||
|
||||
@@ -51,7 +57,11 @@ second line of text
|
||||
|
||||
mode: 33152
|
||||
uid: 10
|
||||
gid: 11" ]; then
|
||||
gid: 11
|
||||
==========
|
||||
true
|
||||
symlink test
|
||||
second line of text" ]; then
|
||||
echo "$0: error: output of guestfish after edit command did not match expected output"
|
||||
echo "$output"
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user