GNOME Bugzilla – Bug 573349
Impossible to create a new folder in a ftp emplacement if there's already a folder named "new folder"
Last modified: 2009-04-09 17:01:36 UTC
1) In Nautilus, open a ftp connection. 2) In this remote emplacement, create a new folder. Keep the default name "new folder". 3) In the same emplacement, create another new folder. Actual result: the new folder isn't created, and this error message appears: Erreur lors de la création du répertoire nouveau dossier. Erreur lors de la création du répertoire dans ftp://user@ftp.host.ext/path. Afficher plus de détails L'opération a échoué Expected result: we should be able to create a new folder even if there's already a folder named "new folder". A number should simply be added to the folder name, for example "new folder 2", as it's the case for local emplacement.
*** Bug 330926 has been marked as a duplicate of this bug. ***
I filed this bug back in 2006 but I'm marking it as dup because yours it's more descriptive and has a ftp account where the bug can be tested.
(In reply to comment #2) > yours it's more descriptive and has a ftp account where the bug can be tested. The ftp account in the bug description his fictive, so just for example.
-> gvfs I think this is due to some operation not implemented inside the FTP backend, as it works fine with local files. Reassigning to gvfs.
(In reply to comment #4) > -> gvfs > > I think this is due to some operation not implemented inside the FTP backend, > as it works fine with local files. Reassigning to gvfs. > But this same bug existed when nautilus had gnome-vfs, and it remains the same now with gio, so at first sight seems a nautilus issue, but I've not done further investigation.
I'm pretty sure the propblem is that the gvfs backend reports the wrong error when creating a new directory and one already exists.
do_make_directory() in daemon/gvfsbackendftp.c probably needs to gain the ability to somehow tell if a 550 error response code was because of permission failure or already existing directory.
Out of interest, in what order should which errors be reported upon failures? The gio docs only talk about NOT_FOUND and NOT_SUPPORTED, whcih the ftp backend is missing, too, but which are not the ones we want.
Created attachment 130250 [details] [review] Return proper GIO error codes when MKD fails. we need to check if the 550 failure means "directory already exists", "file already exists", "permission denied" or what.... Previously we only returned a generic error for all cases, now we atleast detect if the directory already exists or else return the generic GIO error code..... This solves the immediate problem, but the new function error_550_exists in the patch should still have additional "check if regular file exists" code as well.
I'll mark the patch as needs-work so it doesn't show up as unreviewed or sth - and it's obviously not complete yet. I'd like a patch that contains at least a proper EXISTS test and the NOT_FOUND test (should be just try_cd() to parent directory) so that g_file_make_directory_and_parents() works, too.
Created attachment 132261 [details] [review] Improved path, still needs work. NOT_FOUND implemented (for "gvfs-mkdir -p"), file check on sites that support SIZE feature, still needs work...
A modified patch for this landed in svn trunk, and it should now work properly on most ftp servers.