After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 771398 - crash on simple rename after batch rename
crash on simple rename after batch rename
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: File and Folder Operations
3.21.x
Other Linux
: Normal critical
: 3.22
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-09-14 02:41 UTC by Mohammed Sadiq
Modified: 2016-09-21 20:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
file: Complete operation if all files skipped (923 bytes, patch)
2016-09-15 08:19 UTC, Alexandru Pandelea
accepted-commit_after_freeze Details | Review
file: complete operation if all files skipped (940 bytes, patch)
2016-09-15 08:38 UTC, Alexandru Pandelea
committed Details | Review

Description Mohammed Sadiq 2016-09-14 02:41:58 UTC
In some cases, when batch rename executed without action, simple rename that follows segfaults Nautilus.


How to reproduce:

1. Create some files.
   touch test1.txt test2.txt
2. Select those files -> rename -> Click Rename (ie, no change is actually made)
3. Now select the last item from the last renamed list (probably test2.txt) -> right click -> Rename
4. Give some text (can be reproduced even no change is made) -> Rename

Result:
Nautilus now segfaults.

Expected result:
Nautilus should rename the selected file with no segfaults.
Comment 1 Mohammed Sadiq 2016-09-14 02:45:45 UTC
Forgot to add corresponding debug message for segfault: 
**
ERROR:/home/sadiq/jhbuild/checkout/nautilus/src/nautilus-file.c:2481:nautilus_file_cancel: assertion failed: (op->file == file)
Comment 2 Alexandru Pandelea 2016-09-15 08:19:12 UTC
Created attachment 335610 [details] [review]
file: Complete operation if all files skipped

If all files are skipped, then the batch rename operation would not end
appropriately.

To fix this, end the operation when all files are skipped.
Comment 3 Carlos Soriano 2016-09-15 08:26:43 UTC
Review of attachment 335610 [details] [review]:

Oh, big oversight. Thanks for the patch, feel free to commit after the following fixes:
in the commit message tittle use lowercase "file: complete".

::: src/nautilus-file.c
@@ +2358,3 @@
     }
+
+    if (op->skipped_files == g_list_length (files))

we use braces on single line ifs too now
so:
if
{
    meh ()
}
Comment 4 Carlos Soriano 2016-09-15 08:27:20 UTC
wait no, don't commit. We are in hard code freeze. I'm going to open a branch for developing soon.
Comment 5 Carlos Soriano 2016-09-15 08:27:37 UTC
Review of attachment 335610 [details] [review]:

after freeze
Comment 6 Alexandru Pandelea 2016-09-15 08:38:12 UTC
Created attachment 335611 [details] [review]
file: complete operation if all files skipped

If all files are skipped, then the batch rename operation would not end
appropriately.

To fix this, end the operation when all files are skipped.
Comment 7 Carlos Soriano 2016-09-15 09:34:56 UTC
Review of attachment 335611 [details] [review]:

LGTM, the branch is wip/csoriano/next-master, thanks!
Comment 8 Alexandru Pandelea 2016-09-21 20:52:01 UTC
Attachment 335611 [details] pushed as 802713a - file: complete operation if all files skipped