Bug 471363 - Mkdir FN bar button does not do tilde expansion
Summary: Mkdir FN bar button does not do tilde expansion
Status: CONFIRMED
Alias: None
Product: krusader
Classification: Applications
Component: general (other bugs)
Version First Reported In: 2.8.0
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: Krusader Bugs Distribution List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-23 04:29 UTC by Henryk Hecht
Modified: 2024-10-15 12:52 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henryk Hecht 2023-06-23 04:29:27 UTC
When creating a directory with the F7 Mkdir button, tildes are treated as literal strings, rather than being expanded to a user's home directory.  ~/additional/paths and ~user/additional/paths should work as expected: i.e., they should be expanded to the correct home directory.  This expansion works for copy and move, which makes mkdir even more surprising.

It is possible that this is really a KIO bug.  From briefly looking at the krusader source, it looks like it goes:
ListPanelFunc::mkdir
files->mkDir
whence maybe: 
DefaultFileSystem::mkDir
KIO::mkpath

I am not familiar with either the krusader or kio source, however, so this may not be correct.  All I'm certain of is that it doesn't work properly as an end user.

STEPS TO REPRODUCE
1. Open krusader, navigate to a writable directory other than $HOME.
2. Hit F7 or press the Mkdir button on the FN bar
3. Enter, e.g., ~/foo

OBSERVED RESULT
The directory ~ is created in the current directory, with foo beneath it.

EXPECTED RESULT
The directory foo should be created in the user's home directory.

SOFTWARE/OS VERSIONS
Linux: 6.3.6
KDE Plasma Version: NA
KDE Frameworks Version: 5.102.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION
Comment 1 Pedro V 2024-01-24 01:49:25 UTC
Interesting, didn't even know that Mkdir could do more than just creating a directory in the current directory, but `test/test` works creating a nested directory, and even `../test` works creating a directory outside the current one. Even absolute paths work like `/home/username/test` , therefore I'd conclude that the user is right to expect tilde expansion to also work, but I can confirm in the following environment that it doesn't:
Operating System: Kubuntu 23.10
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.10

It's still not necessarily a bug as tilde expansion is a feature which is definitely not universally supported, therefore I believe that importance should be set to wishlist.
Comment 2 Henryk Hecht 2024-02-01 23:41:56 UTC
The bug priority is probably a matter of project standards, with which I am not familiar.  Similar bugs, open and closed, on bugs.kde.org seem to all be "normal".

I do not believe there is any governing standard for *nix GUIs here, nor have I done an exhaustive survey, but I did check a few different toolkits and programs, and everything from Tk to JavaFX seems to support tilde expansion where it is applicable.  This accords with my own expectation, which is that it should work in (almost) any interactive context.  This is a bit of a nuisance to implement, as it is a platform convention without platform support, but Qt, kdelibs, and krusader manage it well (mostly!).

Unfortunately, I have not had the time to investigate whether my hypothesis about KIO in the original report is correct; I was hoping someone more familiar with the source and libraries (I haven't really done any KDE development since 3.x) would take a look.
Comment 3 Alex Bikadorov 2024-10-15 12:52:33 UTC
I'm considering this to be a feature request. Tilde expansion is a feature of the shell and the current behavior of KIO::mkpath() and KIO::mkdir() of creating a directory named "~" is not exactly wrong.

Note that Dolphin does the tilde expansion because it is implemented in KIOs KNewFileMenu (see https://invent.kde.org/frameworks/kio/-/blob/master/src/filewidgets/knewfilemenu.cpp#L1265 ).