Bug 493270 - "Extract here" will result in freeze when specific folders exist
Summary: "Extract here" will result in freeze when specific folders exist
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-17 14:59 UTC by Karl Gustav
Modified: 2024-11-13 09:03 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
with this file i'm able to reproduce the bug above (267 bytes, application/zip)
2024-09-17 14:59 UTC, Karl Gustav
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Karl Gustav 2024-09-17 14:59:04 UTC
Created attachment 173771 [details]
with this file i'm able to reproduce the bug above

Dolphin will become unsresponsive when using "extract here" or "extract here and delete archive" when a folder with the  name of the archive already exists and the zip file has a specific name and content. I'm not sure if it is because of the long file name or the signs used in the filename. I just created a file that would cause that behaviour and attached it.

STEPS TO REPRODUCE
1. Use the file i provide  (i placed it under ~/Downloads) 
2. Extract the file with "extract here" you now should have a folder called "lol.crash.filename(2024).dolphin(101001)"
3. Now do step 2 again.. Dolphin will become unresponsive and do nothing.

OBSERVED RESULT
Becomes unresponsive


EXPECTED RESULT
It should create another folder named like "lol.crash.filename(2024).dolphin(101001)  (1)" should be created or ask if files should be overwritten

SOFTWARE/OS VERSIONS
Operating System: EndeavourOS 
KDE Plasma Version: 6.1.5
KDE Frameworks Version: 6.6.0
Qt Version: 6.7.2
Kernel Version: 6.10.10-arch1-1 (64-bit)
Graphics Platform: offscreen
Processors: 4 × Intel® Core™ i5-2500K CPU @ 3.30GHz
Memory: 15.6 GiB of RAM
Comment 1 Nicolas Fella 2024-09-23 10:23:51 UTC
> It should create another folder named like "lol.crash.filename(2024).dolphin(101001)  (1)"

That's what it's trying to do, but the filename is so weird that KFileUtils::suggestName() goes into an infinite loop trying to create the new name
Comment 2 Akseli Lahtinen 2024-10-25 12:53:19 UTC
Can also confirm this issue with git master version of dolphin
Comment 3 Bug Janitor Service 2024-11-12 10:18:47 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kcoreaddons/-/merge_requests/464
Comment 4 Akseli Lahtinen 2024-11-13 09:03:50 UTC
Git commit 50c3c2ed1c7c03bacb47a1643741039b8cf274f0 by Akseli Lahtinen.
Committed on 13/11/2024 at 09:03.
Pushed by akselmo into branch 'master'.

kfileutils: compare to basename in makeSuggestedName

Instead of searching from oldName, search from baseName since that is what
we want to modify anyway.

When searching from oldName here and then modifying baseName, with
weird filenames like "super.weird.filename(123).txt(54321)" it gets
stuck in endless loop.

This also adds a test for above filename. The regex has an added space before
the parentheses match, since the number we append also has a space in front of it.

M  +1    -0    autotests/kfileutilstest.cpp
M  +3    -3    src/lib/io/kfileutils.cpp

https://invent.kde.org/frameworks/kcoreaddons/-/commit/50c3c2ed1c7c03bacb47a1643741039b8cf274f0