gfile: Do not follow symlinks when moving

It is expected that `g_file_move()` moves symlink file itself, not its
target. Unfortunately, copy and delete fallback passes `GFileCopyFlags`
and don't explicitly use `G_FILE_COPY_NOFOLLOW_SYMLINKS`. This may cause
that symlink target is copied and symlink itself is removed. Let's
explicitly pass `G_FILE_COPY_NOFOLLOW_SYMLINKS` to the copy operation to
prevent this unexpected behavior.

https://gitlab.gnome.org/GNOME/glib/issues/986
This commit is contained in:
Ondrej Holy 2019-06-06 16:55:25 +02:00
parent 6694172014
commit f17055f593

View File

@ -3736,7 +3736,7 @@ g_file_move (GFile *source,
return FALSE; return FALSE;
} }
flags |= G_FILE_COPY_ALL_METADATA; flags |= G_FILE_COPY_ALL_METADATA | G_FILE_COPY_NOFOLLOW_SYMLINKS;
if (!g_file_copy (source, destination, flags, cancellable, if (!g_file_copy (source, destination, flags, cancellable,
progress_callback, progress_callback_data, progress_callback, progress_callback_data,
error)) error))