Bug 117473 - "New folder" dialog results in unhelpful error message when creating a folder named as "~"
Summary: "New folder" dialog results in unhelpful error message when creating a folder...
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 2.1
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Peter Penz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-01 23:45 UTC by Travis Evans
Modified: 2012-08-23 06:11 UTC (History)
7 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Travis Evans 2005-12-01 23:45:29 UTC
Version:            (using KDE KDE 3.5.0)
Installed from:    SuSE RPMs

I discovered a minor problem with the "New folder" dialog.  This actually happens on the Desktop as well as in Konqueror (File Manager).  I experienced it in KDE 3.4.2 and KDE 3.5.

Steps to reproduce:
1. Right-click an empty space and choose "Create New" > "Folder" on the context menu
2. In the New Folder dialog, enter a name beginning with the '~' (tilde) character.  Example: ~testfolder

An error appears: "Could not create folder."

There are two things wrong with this:
1. The error message contains no useful information to the user--error messages should at the very least explain why the operation failed and what can be done about it.
2. I don't see any reason the folder can't be created.  If I create a folder with a "normal" name (e.g., "testfolder"), I can rename it to a name starting with ~ (as in "~testfolder") without an error, so it seems that creating a new folder starting with a '~' should also be legal.

I tried making folders starting with some other characters (like !, @, :, and -), and the problem doesn't seem occur with those characters.

It's a pretty minor problem, since the workaround is simply to create a folder with a normal name, then rename it to the intended name starting with '~'.
Comment 1 lexual 2006-10-17 06:26:18 UTC
confirming for 3.5.5
Comment 2 J Appel 2008-05-18 13:03:25 UTC
confirmed for 4.0.4
Comment 3 Travis Evans 2008-05-18 13:10:51 UTC
Come to think of it, I think what happens is that it tries to interpret '~' as the user's home folder when it shouldn't.  For instance, if I right-click the desktop and choose New Folder, and then enter something like '~/New', it actually creates a folder called 'New' in the root of my home folder instead of on the desktop.  And if I enter '~New' instead, it gets confused.
Comment 4 Travis Evans 2008-05-18 13:31:40 UTC
I played with it some more--it works just like in Bash.  If you enter '~Foo', it really tries to create '/home/Foo' and (most likely) fails.  This is where the strange error messages are coming from.  I'm not sure whether this is what the developers intended, especially from KDesktop's New Folder dialog.
Comment 5 FiNeX 2009-08-04 11:41:07 UTC
Moved to dolphin: this behaviour is still reproducible and now the file management is done by dolphin.

I don't know what could be the better solution of this situation.
Comment 6 Frank Reininghaus 2009-10-15 14:38:52 UTC
'~testfolder' is actually a short-hand notation for the home directory of the user 'testfolder'. If a user with that name exists, even bash refuses to create a directory named '~testfolder' in my home directory. Probably that's related to the problem.
Comment 7 Travis Evans 2009-10-15 17:05:20 UTC
Yes, it appears that in Bash, if I try to create a directory named "~user" where "user" is the name of a user on the system, it fails; otherwise it succeeds.  In KDesktop, if I use a user name, I get a different message (either access denied if the user's home directory doesn't exist, or folder exists if it does), but the message I originally reported if it's anything else.  Also, the former two errors do display the name or path of the directory it's trying to create which helps to understand what it's doing, but in the latter case, it gives no clue.

Come to think of it, on KDE 3.5.10 (yes, I really need to upgrade one of these days), the message seems to have changed to "Could not make folder ." with a space before the ending period.  I'm not sure if this is a typo or because it's trying to display a folder name or something at the end but getting a null string somehow.
Comment 8 Mark 2010-08-29 17:26:03 UTC
Issue confirmed in KDE 4.5.0 and it's a bug.
Why? If you type this on the console: mkdir "~" (with the quotes!) then it just creates the folder like expected and in the current location like expected. Dolphin sees the folder just fine and enters it just fine. It's just the making it is the problem.
Comment 9 Mark 2010-08-29 18:25:28 UTC
And i made a patch for it : http://reviewboard.kde.org/r/5186/
Just a simple one liner.
Comment 10 Dawit Alemayehu 2010-09-13 02:02:29 UTC
SVN commit 1174616 by adawit:

- Allow the creation of files/directories that start with "~".

BUG:117473


 M  +9 -2      knewfilemenu.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1174616
Comment 11 Raphael Kubo da Costa 2010-09-13 02:23:33 UTC
Any intention to backport?
Comment 12 Mark 2010-09-13 02:54:48 UTC
@Dawit,

Thank you for patching it. i was actually gonna make a new attempt today.. I kinda forgot about this issue the last few days.

@Raphael
I don't think this will be backported or is _that_ important to be backported.
I rather fix bugs then backporting existing fixes that end up in kde 4.6 anyway.
Comment 13 Raphael Kubo da Costa 2010-09-13 03:11:35 UTC
Well, IMO if it is a bug fix and does not introduce new strings or a big amount of untested code, it does not matter if it is deemed important or not -- just backport it.

As for fixing bugs rather than backporting, I don't see how one excludes the other.
Comment 14 Dawit Alemayehu 2010-09-13 10:01:50 UTC
SVN commit 1174761 by adawit:

- Make the previous commit r1174616 work for file names as well. Now using escaped 
  tilde mark ("\~") works properly when creating filenames as well.

CCBUG:117473


 M  +17 -11    knewfilemenu.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1174761
Comment 15 Mark 2010-09-14 15:02:09 UTC
Just tested it out again and making a new folder with just "~" is still resulting in: "A folder named <users home folder> already exists."

Thus the bug is not resolved.

However, making a new folder and typing: "\~" is working and makes a folder with the name: "~" but that's not what this bug is about and not something you can expect the user to know (adding a "\" before "~").
Comment 16 FiNeX 2011-08-24 13:18:21 UTC
I confirm the initally reported bug has been fixed and I also confirm that creating a directory with only "~" still return the error.
Comment 17 Frank Reininghaus 2012-08-23 06:11:12 UTC
(In reply to comment #15)
> Just tested it out again and making a new folder with just "~" is still
> resulting in: "A folder named <users home folder> already exists."

IMHO, this is expected behaviour. That folder really does exist, doesn't it? And it's also consistent with what bash does.(In reply to comment #15)

> However, making a new folder and typing: "\~" is working and makes a folder
> with the name: "~" but that's not what this bug is about and not something
> you can expect the user to know (adding a "\" before "~").

Also consistent with bash, therefore, I consider this issue resolved.