I am just trying my luck here with an issue that i have been unable to
resolve on my Qubes system for a long time now. I have been looking
into this problem quite a bit but i cannot seem to find a solution
anywhere. Perhaps someone on this list has experienced the same and
has found a solution.
When i open a text file that is located on a network share with gedit,
gedit is unable to save the file. When I click the save button, or
`Ctrl + s`, i can see gedit creates a temporary file named
".goutputstream-AO9U51" on the network share and in gedit i get a
message "Could not create a backup file while saving
"/home/user/data/test/file-name.txt"". If i launch gedit from cli i
see a message on cli when saving the file "Hit unhandled case 27
(Error renaming temporary file: Resource temporarily unavailable) in
I definitely have permissions on the network share as i can copy files
to it, delete, create directories, etc. I can also open a LibreOffice
document and save it. The problem appears to be specific to gedit.
Also, it happens with both a Fedora and Debian based VM.
In addition that i forgot to mention is, i can open edit and save the
same txt files with vi and it works.
I have read reports  dating as far back as 12 years with
the sshfs protocol (an abandoned project) being implicated as well.
On issue 438  that was reported on Gitlab it is reported that "As far
as I can tell, the problem is in the way glib saves a file by writing to
a temporary file and renaming to the final name." and "I'll take a more
serious look later but I'd start with gio/glocalfileoutputstream.c and
particularly the function _g_local_file_output_stream_really_close which
contains the error string "Error renaming temporary file".".
A duplicate issue 565  to issue 438  was opened and there a patch
is provided that is said to fix this issue although i have not tried it
because i don't know how to.
**Question:** Would anybody perhaps know how and where to do the patch,
attached for reference, on Fedora/Debian. As far as I can tell the patch
needs to be done on the client since the problem originates from the client.
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group and stop receiving emails from it, send an email
To view this discussion on the web visit
From 179812d0847af191e709539041a57d5779d847ed Mon Sep 17 00:00:00 2001
Date: Wed, 27 Jun 2012 19:35:33 +0200
Subject: [PATCH] gio: workaround for renaming files on filesystems not
This is a workaround for samba and "Virtual Box shared" filesystem which does not support renaming opened files and react on such attempt with ETXTBSY. It is also a solution proposal for:
Bug 678994 - Unable to overwrite files on vbox shared mounted filesystems
gio/glocalfileoutputstream.c | 90 +++-
1 file changed, 63 insertions(+), 27 deletions(-)
diff --git a/gio/glocalfileoutputstream.c b/gio/glocalfileoutputstream.c
index a310fcd..60e5f43 100644
@@ -223,6 +223,7 @@ _g_local_file_output_stream_really_close (GLocalFileOutputStream *file,
+ int smb_cifs_rename_workaround = 0;
if (file->priv->sync_on_close &&
@@ -318,17 +319,44 @@ _g_local_file_output_stream_really_close (GLocalFileOutputStream *file,
if (g_cancellable_set_error_if_cancelled (cancellable, error))
- /* tmp -> original */
- if (g_rename (file->priv->tmp_filename, file->priv->original_filename) != 0)
- int errsv = errno;
- g_set_error (error, G_IO_ERROR,
- g_io_error_from_errno (errsv),
- _("Error renaming temporary file: %s"),
- g_strerror (errsv));
- goto err_out;
+ res = g_rename (file->priv->tmp_filename, file->priv->original_filename);
+ /* tmp -> original */
+ if (res != 0 && errno == ETXTBSY)
+ // try to close the fd first and retry renaming
+ if (fstat (file->priv->fd, _stat) == 0)
+ file->priv->etag = _g_local_file_info_create_etag (_stat);
+ while (1)
+ res = close