GNOME Bugzilla – Bug 522532
POSIX semantics when creating files
Last modified: 2018-09-21 16:19:53 UTC
Issue raised by Yann Rouillard. I quote him from the mail he sent me: The try_create_tested_existence doesn't really create the file on the server. The file will be created later when the input stream is closed. It seems to cause an ordering problem with a program like touch. touch creates the file and then test is existence, but practically the file creation is done by gvfs after the test existence, so touch thinks the creation failed.
Some more of the mail: And here is the apache log: > > 127.0.0.1 - - [29/Feb/2008:18:49:41 +0100] "PROPFIND /test HTTP/1.1" 404 > 282 "-" "gvfs/0.1.9" -> touch test if the file exists > 127.0.0.1 - - [29/Feb/2008:18:49:41 +0100] "HEAD /test HTTP/1.1" 404 - > "-" "gvfs/0.1.9" -> try_create test the file existence > 127.0.0.1 - - [29/Feb/2008:18:49:41 +0100] "PROPFIND /test HTTP/1.1" 404 > 282 "-" "gvfs/0.1.9" -> touch test if the file has been created (!) > 127.0.0.1 - - [29/Feb/2008:18:49:41 +0100] "PUT /test HTTP/1.1" 201 259 > "-" "gvfs/0.1.9" -> the file is created by gvfs > > The attached patch create a zero-length file in the > try_create_tested_existence to ensure the file is immediately created on > the server.
I don't think its right to handle this in the http backend. i.e. i don't think we can guarantee this behaviour with all backends, and would like to avoid ugly hacks that do weird operations just to expose this backends. For instance, g_file_replace() regularly writes to another file and doesn't replace the final one until close. However, we might want to make the fuse backend do some ugly workarounds to make apps expecting posix semantics work better.
*** Bug 575150 has been marked as a duplicate of this bug. ***
Alex is right, we don't guarantee POSIX semantics for g_file_create etc. pp. (maybe we should note that in the docs?). Moving to fuse component.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gvfs/issues/43.