[Xfce-bugs] [Bug 15727] Replacing a file via Cut and Paste in the same filesystem makes a copy

bugzilla-daemon at xfce.org bugzilla-daemon at xfce.org
Tue Aug 13 00:03:52 CEST 2019


https://bugzilla.xfce.org/show_bug.cgi?id=15727

--- Comment #3 from alexxcons <alexxcons at xfce.org> ---
Created attachment 8871
  --> https://bugzilla.xfce.org/attachment.cgi?id=8871&action=edit
very incomplete demonstartor

In "thunar_transfer_job_execute" Thunar just calls "g_file_move" without
checking if the target already exists.
If I add the G_FILE_COPY_OVERWRITE flag, the move is just performed, replacing
any existing target file.

Without overwrite flag "g_file_move" will return FALSE (failure)

Only afterward  "thunar_transfer_job_verify_destination" and inside
"thunar_transfer_job_copy_node" and than "thunar_transfer_job_copy_file" are
called .. where finally the dialog is launched with "thunar_job_ask_replace".
(But thunar_transfer_job_copy_file does not know much about move operations, so
the file will be just copied)

The doc of "g_file_query_exists ()" tells that it is correct to try & fail,
instead of doing pre-checks, which potentially will cause race conditions. (And
I think which requires gvfs)

The attached patch just demonstrates how a fix could look like. It spawns a
"thunar_job_ask_replace" dialog and re-executes the move with
G_FILE_COPY_OVERWRITE if "overwrite" was selected (warning, this patch is very
incomplete !!)
This should be called in a loop, possibly in a seperate method, since the
dialog offers "retry".

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Xfce-bugs mailing list