gedit fails to save files over smbfs/cifs

Bug #34813 reported by Dhonn
338
This bug affects 43 people
Affects Status Importance Assigned to Milestone
SSHFS Mounter
Confirmed
Undecided
Unassigned
gedit
Expired
Medium
gedit (CentOS)
New
Unknown
gedit (Ubuntu)
Triaged
Low
Ubuntu Desktop Bugs

Bug Description

Saving files over a cifs/smbfs server doesnt work. You can open file, edit then save perfectly. But repeated saves after give you this error:

"The file /home/dhonn/website/arrays.php has been modified since reading it. If you save it, all the external changes could be lost. Save it anyway?"

The think is lying to me because I havent made any external changes.

When I click "Save Anyway", i get this error:

"Could not save the file /home/dhonn/website/arrays.php."

But on the third try it works just fine.

Here are the error messages, btw there are also GUI glitches too:
http://dhonn.com/images/gedit-0.jpg
http://dhonn.com/images/gedit-1.jpg

Tags: metabug patch
Revision history for this message
Phil Bull (philbull) wrote :

Thanks for the report.

What versions of the following packages do you have installed?

gedit
libgnome-vfs0
libgnome-vfs-common
libsmbclient

If you run gedit in the terminal and reproduce this issue, are there any useful error messages?

Thanks

Changed in gedit:
status: Unconfirmed → Needs Info
Revision history for this message
Dhonn (dhonn) wrote :

This happens to all my installations and only with gedit. Other editors are all fine.

I ran gedit in terminal and theres no error output.

Also the weird thing is that the permissions on the file change from the default setting that it was.

Its like gedit is renaming the file to a back up file, then creating a new file and dumping text to it.

Here are the versions that im running:

gedit 2.13.93-0ubuntu1
gnome-vfs 1.0.5-5.3
libgnome-vfs 1.0.5-5.3
libsmbclient 3.0.21b-1ubuntu2

Revision history for this message
Phil Bull (philbull) wrote :

gedit does save a file called 'filename.ext~' when you edit a document, so it could be this which is causing the problem.

Can you update to the latest, 2.14.0-0ubuntu1, gedit version please?

Revision history for this message
Dhonn (dhonn) wrote :

I've upgraded to 2.14.0-0ubuntu1. Nothing new I still get the same problem.

Revision history for this message
Phil Bull (philbull) wrote :

Thanks.

Can anyone else confirm this issue?

Revision history for this message
Sebastien Bacher (seb128) wrote :

Do you have the issue if you don't use the automatic backup file option? How does smbfs/cifs work, could you describe a simple way to set up it to figure if that happens for somebody else too?

Revision history for this message
Dhonn (dhonn) wrote :

Automatic backup has been off the whole time. I turned it off because of this and still it has the problem.

I simply made a folder website
I then have an init.d script that executes this code
mount -t cifs -o password= //192.168.1.100/website /home/dhonn/website

I now can edit any file in the website folder with any program other than gedit just fine.

Here is my simple smb.conf file:

I've omitted all but the changes Ive personally made

security = share

[website]
        comment = Website
        guest ok = yes
        read only = no
        path = /home/dhonn/website
        force user = dhonn
        force group = dhonn
        case sensitive = yes
        public = yes
        browseable = no

this smb.conf file is on my server

I have no clue what gedit is doing but its not acting right. And yes its just gedit. No other program has this problem.

I'll give you a run down of what im doing:

Create a new text file in gedit.
Save it in the website folder.
Click save again and its giving me an error like I've shown you before and I click Save Anyway.

Now if i start to edit the file then save. It gives me the same error again and at the same time changing the file to excutable.

Here is the error again:

"The file /home/dhonn/website/Unsaved Document 1 has been modified since reading it.

If you save it, all the external changes could be lost. Save it anyway?"

There is nothing externally making changes to my file.

So could the problem be samba altering the file after Ive made ive saved the file?

1 comments hidden view all 149 comments
Revision history for this message
Dhonn (dhonn) wrote :

I think the problem is how gedit detects changes.

Phil Bull (philbull)
Changed in gedit:
assignee: nobody → desktop-bugs
status: Needs Info → Unconfirmed
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for the details on that, it does open the dialog about external changes on my box but does open the "Could not save the file ..." one, I've forwarded it upstream: http://bugzilla.gnome.org/show_bug.cgi?id=336738

Changed in gedit:
status: Unconfirmed → Confirmed
Revision history for this message
Matt Zimmerman (mdz) wrote :

This bug has an invalid bug watch. Please check it, and either correct or
remove it as appropriate.

04:18:11 WARNING Didn't find bug u'38091' on http://bugzilla.gnome.org

Revision history for this message
Matt Zimmerman (mdz) wrote :

Sorry, that error message should have been:

04:18:11 WARNING Didn't find bug u'34813' on http://bugzilla.gnome.org

Changed in gedit:
status: Unconfirmed → Confirmed
Revision history for this message
Glutexo (glutexo) wrote :

I use gedit-2.16.1-0ubuntu2 and I can confirm this issue: any attempt to save a file placed on cifs fails with an error message.

I would personally mark this bug with high or even critical priority as the text-editor (in this case the default text-editor in Ubuntu) and its capability to save files is an essential function on every system.

Revision history for this message
Kuropka (d2) wrote :

I second the proposal from Glutexo to mark this as a critical bug.

Revision history for this message
Daniel Holbach (dholbach) wrote :

From: https://wiki.ubuntu.com/Bugs/Importance

Critical: A bug which has a severe impact on a large portion of Ubuntu users
Medium: A functionality bug of the standard variety. Most bugs are of Medium severity, for example:
    * Has moderate impact on a core application
    * Has a severe impact on a non-core application

It's a bug causing problems, but it's not a critical bug as it won't stop Ubuntu from being released.

Revision history for this message
Sebastien Bacher (seb128) wrote :

That bug is not high priority because only few people use a mount like that

Revision history for this message
Peter Würtz (pwuertz) wrote :

I disagree, this bug renders Ubuntu/Gnome useless in situations when working with other workstations in a domain.

Having a central file server for user and group data is very common, like pam-mounting a users home when logging in or just using a common cifs share for a group of workers.

From: https://wiki.ubuntu.com/Bugs/Importance
High - Has a severe impact on a small portion of Ubuntu users

In my opinion, being unable to save textfiles is a severe impact, this bug should be marked as high.
This bug is pending long over one year now and we are talking about a text editors vital function!

Revision history for this message
Peter Würtz (pwuertz) wrote :

this is what happens when saving a file in gedit

[-1179854107.516901 (0.000281)] gedit-document-saver.c:1444 (gedit_document_saver_save)
[-1179854107.516884 (0.000017)] gedit-prefs-manager.c:528 (gedit_prefs_manager_get_backup_extension)
[-1179854107.516873 (0.000011)] gedit-prefs-manager.c:232 (gedit_prefs_manager_get_string)
[-1179854107.516859 (0.000015)] gedit-prefs-manager.c:522 (gedit_prefs_manager_get_create_backup_copy)
[-1179854107.516845 (0.000013)] gedit-prefs-manager.c:204 (gedit_prefs_manager_get_bool)
[-1179854107.516824 (0.000021)] gedit-document-saver.c:976 (save_local_file)
[-1179854107.516811 (0.000014)] gedit-document.c:1094 (document_saver_saving)
[-1179854107.516793 (0.000018)] gedit-document.c:1141 (document_saver_saving) save progress: 0 of 0
[-1179854107.516776 (0.000017)] gedit-tab.c:1084 (document_saving) 0/0
[-1179854107.509657 (0.007119)] gedit-document-saver.c:501 (save_existing_local_file)
[-1179854107.508032 (0.001625)] gedit-document-saver.c:598 (save_existing_local_file) tmp file moving strategy
[-1179854107.499098 (0.008934)] gedit-document-saver.c:197 (write_document_contents)
[-1179854106.405315 (1.093783)] gedit-document-saver.c:670 (save_existing_local_file) could not rename original -> backup

Revision history for this message
Peter Würtz (pwuertz) wrote :

in line 670, gedit tries to rename the file to a backup file... like moving "testfile" to "testfile~"

if (rename (saver->priv->local_path, backup_filename) != 0)

I checked "local_path" and "backup_filename", they are correct. I also wrote a small test application using "rename()" from stdio.h and renamed the same files on the mounted cifs filesystem, which works.

I'm not a gnome developer, could someone help me out here please? I assume the rename() function is not the rename function from stdio.h, does gnome implement its own rename?

Revision history for this message
Peter Würtz (pwuertz) wrote :

Ok, this is the problem:

Gedit opens a file, moves the original file to a backup file while keeping the file open, and finally deletes the backup file if you choose not to keep backups.
The rename method sets errno = ETXTBSY, so moving the original file fails.

I don't think moving/deleting open files on purpose is a good idea, although it works for most linux file systems. But its definitely a bad idea for network file systems like sshfs and cifs, which of course fails.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Discussing the bug setting will not make the bug fixed faster there is thousand of desktop bugs open at the moment and the desktop team are limited ressources, thank you for working on it though

Revision history for this message
Tim Butler (timbutler) wrote :

Sebastien: From reading the comments Peter has added some useful information to the bug report to assist in fixing the bug.

The importance is a hard one to gauge, but it certainly heavily affects corporate / business users (including myself).

Revision history for this message
Sebastien Bacher (seb128) wrote :

Tim, I didn't say the comments were not useful, discussing the settings is not really though. Maybe somebody could discuss that upstream, they know the code better since they write it, we mainly distribute it and fix bugs when there is one we want to get fixed for next Ubuntu version

Revision history for this message
darko (darko2) wrote :

I have the major problem with this bug too. It is very disturbing since gedit is default text editor. I believe there is many people affected by this bug.

Revision history for this message
Ignacio Lago Fontán (nacho-exr) wrote :

It's NOT a Gedit bug. It's a Samba (cifs-protocol) bug. The same result using Geany, Vim and Eclipse working with files over CIFS (Windows 2003 Server). All of them applications with file-changes detection.

The issue is reported in several forums and lists:
http://www.nabble.com/multiple-problems-moving-up-from-smbfs-to-cifs-t3884792.html
https://bugzilla.samba.org/show_bug.cgi?id=3551
https://bugzilla.samba.org/show_bug.cgi?id=4076

For people working in a mixed net (linux & windows machines) over a Windows 2003 file-server it's a BIG issue. Very very annoying. I work as app/web developer using Eclipse, everytime I save a file I have an alert when I write something "The file has been changed on the filsesystem, do you want to overwrite the changes?", then I choose "Yes/No", then another alert "The file has been changed on the filesystem. do you want to load the changes?". If reload latest changes (after save) will be lost.

Everytime you save, everytime you see the alerts (even if you only change to another application and back after save). Think about it working in a project, saving and testing every code change.

Severe impact on professionals/developers working with Ubuntu over Smb/Cifs file server.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Does anybody still get the bug with the cifs version from gutsy?

Revision history for this message
jaroslav (mojzis) wrote :

I still have that kind of problem. I am able to edit text files with vim on a windows fileserver mounted like
/sbin/mount.cifs //serverName ./localFolderName iocharset=utf8, username=myUserName
but while trying to edit them with Gedit I get the error Can not save file xxx.

Revision history for this message
Massimo32 (massimo-modica) wrote :

I have the same problem in Feisty using gedit and eclipse, but not with vi and nano.
The file server is Debian Sarge.

Revision history for this message
Laurynas Butkus (laurynas-butkus) wrote :

I also get the same problem (warning that someone else modified file after save) in Feisty with Eclipse. Somehow I guess that it migth be cause with server/client time sync, because after running ntpdate on both, it happens only occasionally. Maybe when part or the second differs. But that's just my guess.

I see a note about someone fixing this compiling latest cifs module:
https://bugzilla.samba.org/show_bug.cgi?id=4076#c14

Revision history for this message
Laurynas Butkus (laurynas-butkus) wrote :

also, I guess this could be related with:

from 'man smb.conf'
--------------
 dos filetimes (S)
          Under DOS and Windows, if a user can write to a file they can change the timestamp on it. Under POSIX semantics, only the owner of the file or
          root may change the timestamp. By default, Samba runs with POSIX semantics and refuses to change the timestamp on a file if the user smbd is
          acting on behalf of is not the file owner. Setting this option to
           yes allows DOS semantics and smbd(8) will change the file timestamp as DOS requires. Due to changes in Microsoft Office 2000 and beyond, the
          default for this parameter has been changed from "no" to "yes" in Samba 3.0.14 and above. Microsoft Excel will display dialog box warnings
          about the file being changed by another user if this parameter is not set to "yes" and files are being shared between users.

          Default: dos filetimes = yes
--------------

but changing dos filetimes option does not solve the problem

Changed in gedit:
importance: Medium → Low
status: Confirmed → Triaged
Revision history for this message
acabre (acabre-eli) wrote :

I also get the same problem in Fiesty w/ gedit. As a couple of the duplicate bugs indicate, the same problem exists with sshfs, which i believe is based on fuse, for what its worth.

Revision history for this message
acabre (acabre-eli) wrote :

Above I meant to say that the problem exists in Gutsy... it is broken in fiesty though :)

Revision history for this message
unclebob (ralfhedenhos) wrote :

I have got this same problem also .... very irritating :(

Revision history for this message
Ignacio Lago Fontán (nacho-exr) wrote : Re: [Bug 34813] Re: gedit fails to save files over smbfs/cifs

Two things:

1. The problem is not in gedit, it's in SAMBA (smbfs) over CIFS
2. Priority Low? There is no way to have an hybrid network with this
problem. A windows 2003 as server with CIFS is more than usual in many
companies nowadays. It's a very big syncronization/data loss problem for
desktop users, administrators and automatic applications/scripts.

A fix is a must IMO.

Revision history for this message
Sebastien Bacher (seb128) wrote :

This bug should have an another task or be reassigned if that's not a gedit bug or the corresponding maintainer will not receive the bug and comments. What is lacking there is somebody with a setup to trigger the issue wanting to debug it, not a settings change.

Revision history for this message
Crashmaxx (crashmaxx) wrote :

I don't think this is a samba bug, as I can confirm the bug, but with sshfs instead. It may be a fuse bug, though since it seems to effect only gedit, I still would think that gedit has the bug. I can repeat this one all day long, so let me know if you need some debugging logs.

Revision history for this message
acabre (acabre-eli) wrote :

I just want to bump what Crashmaxx says. All that is necessary to reproduce this error is to mount a remote share to a folder with sshfs, and try to save with a modified file with Gedit. I just checked Emacs, KDevelop, and even OpenOffice Writer. All can open, read, and write a file over sshfs. Gedit cannot. I'm with Crashmaxx too, if there is anything I can do to make debugging this easier, I'm all for it!

Revision history for this message
Laurynas Butkus (laurynas-butkus) wrote :

I was experiencing this problem with Eclipse. File was saved, but there were occasional alerts about file being modified. I guess it has something to do with file timestams handling.

Revision history for this message
Ignacio Lago Fontán (nacho-exr) wrote :

As Laurynas Batkus said it's present in Eclipse too. At work I've reproduced
the error everyday. I can reproduce the error with Gedit, Geany and Eclipse.

At work I'm using Gutsy, the server is a Windows 2003 Server with all the
employees folders and a shared space. In my case a total of 4 mounted
(smbfs) CIFS filesystems with authentication. No sshfs at all.

Revision history for this message
Peter Würtz (pwuertz) wrote :

Guys, please actually read the stuff others wrote before...

As I said, the problem with gedit is the "save" routine. It relies on moving the file that is being edited while the filehandle is kept open. This works for most filesystems, but it fails on cifs and sshfs (by the way, it works with smbfs). There are 2 ways to fix this:
1. do not move open files
2. fix support for moving open files in cifs and sshfs

I would just change the save procedure and go with the first solution, but the gedit devs don't like the idea of changing their way of saving files because any other solution would require a full copy of the text file (for backup) or open up racing conditions if someone else tries to edit the same file.

Changed in sambaserver:
status: New → Invalid
Changed in gedit:
status: Triaged → Incomplete
Changed in gedit:
milestone: none → ubuntu-9.04-beta
status: Incomplete → Confirmed
Changed in gedit (Ubuntu):
milestone: ubuntu-9.04-beta → ubuntu-9.04
elatllat (elatllat)
Changed in sshfs-mounter:
status: New → Confirmed
69 comments hidden view all 149 comments
Revision history for this message
Sebastien Bacher (seb128) wrote :

Changing to triaged

Changed in gedit (Ubuntu):
milestone: ubuntu-9.04 → none
status: Confirmed → Triaged
Revision history for this message
Sebastien Bacher (seb128) wrote :

Changing to triaged

Revision history for this message
Alex Meakins (alex-meakins) wrote :

I'm seeing this behavior with a fresh install of 9.10 (64bit) . It is incredibly irritating. That fact it has been >three years is stunning.

Revision history for this message
Sebastien Bacher (seb128) wrote :

> That fact it has been >three years is stunning.

There is thousands of bugs opened every months and limited ressources to work on those and smbfs is a power user thing and not something most users will experience with when using ubuntu you are welcome to work on the change though there

Revision history for this message
MountainX (dave-mountain) wrote :

> There is thousands of bugs opened every months and limited ressources to work on those and smbfs is a power user thing and not something most users will experience with when using ubuntu

See comment #108:
Don't you want Ubuntu to integrate smoothly into a Windows-centric environment? See Bug #1.

Revision history for this message
Daevid Vincent (dae51d) wrote :

Sebastien, your comment made me laugh. Linux *is* for power users. My grandmother or parents or even sister (who is on myspace all day long) would not use Linux. Anyone using gedit is most likely a power user as well because if they were just a "dumb user" typing a paper for school or a letter to a friend, they would be using Open Office write or some email front end or website front end to enter the text. Next, SAMBA is hardly a power user thing. If you're on ANY kind of network/LAN, you are no doubt using samba or the Microsoft equivalent of it. Lastly, the damn bug is THREE years old and NO other program has this problem. This is just typical of Linux developers. They always want to claim it's a desktop replacement and how great it is over Windows or OS-X, but then refuse to fix things as it's much sexier to implement new features than work on bugs. Or my other favorite is how they throw back the "why don't YOU fix it and submit a patch".

Revision history for this message
Robie Basak (racb) wrote :

I did post a patched version a long time ago that worked for some people but it was for Intrepid so is now out of date. I'm still running Intrepid so that makes it difficult for me to help.

It appears to me that there is more than one bug if a fix works for some but not for all. This makes the issue very confusing to a developer to fix.

Can I suggest that anyone who still has the bug does the following;

Install strace if it isn't already installed
Close all gedits
From a terminal, run: "strace gedit 2>&1|grep -v strace > /tmp/strace.log"
In the gedit that runs, do as little as possible to reproduce the fault
As soon as the fault occurs, go back to the terminal and press Ctrl-C to stop the logging immediately

Then post the files /tmp/strace.log and /proc/mounts making sure that they don't contain any confidential information you don't want to reveal, as well as the filename and location that you were saving to so the logs can be searched easily. strace.log will be quite large.

This information is essential for a developer to figure out what is going on without just guessing. I can't promise anything though - the amount of effort required all depends on the results.

Revision history for this message
acabre (acabre-eli) wrote :

I've attached two strace logs in case anybody is interested.

strace_first.log contains a strace of launching GEdit, opening a file over sshfs that had not been opened previously, making a change, successfully saving it, making another change, and being unable to save.

strace_second.log contains a strace of launching GEdit, opening this file that had been opened over sshfs before, and getting an error on trying to save

I'm on 9.04. In both tests, the "Create a backup copy of files before saving" as in the Editor preferences was checked. Unchecking this box solves this problem for me.

The file I'm opening is /home/straceuser/stracedir/stracemnt/test.txt , where stracemnt is a sshfs fuse mount.

I'm sure there are several people here, myself included, who would be willing to help troubleshoot this problem, if a dev was interested in un-triaging it.

Revision history for this message
elatllat (elatllat) wrote :

Thanks for that I was about to reboot to do just that;
because of this problem I use OS X for my laptop ATM

On Tue, Nov 10, 2009 at 10:25 PM, acabre <email address hidden> wrote:

> I've attached two strace logs in case anybody is interested.
>
> strace_first.log contains a strace of launching GEdit, opening a file
> over sshfs that had not been opened previously, making a change,
> successfully saving it, making another change, and being unable to save.
>
> strace_second.log contains a strace of launching GEdit, opening this
> file that had been opened over sshfs before, and getting an error on
> trying to save
>
> I'm on 9.04. In both tests, the "Create a backup copy of files before
> saving" as in the Editor preferences was checked. Unchecking this box
> solves this problem for me.
>
> The file I'm opening is /home/straceuser/stracedir/stracemnt/test.txt ,
> where stracemnt is a sshfs fuse mount.
>
> I'm sure there are several people here, myself included, who would be
> willing to help troubleshoot this problem, if a dev was interested in
> un-triaging it.
>
> ** Attachment added: "strace.tar.gz"
> http://launchpadlibrarian.net/35512943/strace.tar.gz
>
> --
> gedit fails to save files over smbfs/cifs
> https://bugs.launchpad.net/bugs/34813
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in Light-Weight Text Editor for Gnome: Confirmed
> Status in SambaServer: Invalid
> Status in SSHFS Mounter: Confirmed
> Status in “gedit” package in Ubuntu: Triaged
>
> Bug description:
> Saving files over a cifs/smbfs server doesnt work. You can open file, edit
> then save perfectly. But repeated saves after give you this error:
>
> "The file /home/dhonn/website/arrays.php has been modified since reading
> it. If you save it, all the external changes could be lost. Save it
> anyway?"
>
> The think is lying to me because I havent made any external changes.
>
> When I click "Save Anyway", i get this error:
>
> "Could not save the file /home/dhonn/website/arrays.php."
>
> But on the third try it works just fine.
>
> Here are the error messages, btw there are also GUI glitches too:
> http://dhonn.com/images/gedit-0.jpg
> http://dhonn.com/images/gedit-1.jpg
>
>

Revision history for this message
Sebastien Bacher (seb128) wrote :

> Don't you want Ubuntu to integrate smoothly into a Windows-centric environment?

using GNOME to edit smb document over gvfs mount works fine which is the recommended desktop way, the issue is with fstab command line mounts there

> Linux *is* for power users.

Good, so power users should know how to use an another editor or workaround the issue

> Next, SAMBA is hardly a power user thing. If you're on ANY kind of network/LAN, you are no doubt using samba or the Microsoft equivalent of it.

Right, that's why GNOME can mount smb shares in an easy way and editing txt using gedit works just fine there, the issue is when you use command line to mount samba mounts in a system specific way

> but then refuse to fix things as it's much sexier to implement new features than work on bugs. Or my other favorite is how they throw back the "why don't YOU fix it and submit a patch".

the comment is not very useful when you comment on a distribution bug tracker and not to the software writer and the issue is a lack of manpower one

Revision history for this message
Sean G (sean-gilbertson) wrote :

Unless there are issues I'm not aware of, we could fix this by always
enabling the behavior triggered when enabling the "Create a backup copy of
files before saving" option, and then removing the capability for the user
to disable that functionality. (Note that this is a workaround that works
the last time I tried it, and is documented.)

It'd be an easy fix.

Sean

On Tue, Nov 10, 2009 at 11:41 PM, Sebastien Bacher <email address hidden>wrote:

> > Don't you want Ubuntu to integrate smoothly into a Windows-centric
> environment?
>
> using GNOME to edit smb document over gvfs mount works fine which is the
> recommended desktop way, the issue is with fstab command line mounts
> there
>
> > Linux *is* for power users.
>
> Good, so power users should know how to use an another editor or
> workaround the issue
>
> > Next, SAMBA is hardly a power user thing. If you're on ANY kind of
> network/LAN, you are no doubt using samba or the Microsoft equivalent of
> it.
>
> Right, that's why GNOME can mount smb shares in an easy way and editing
> txt using gedit works just fine there, the issue is when you use command
> line to mount samba mounts in a system specific way
>
> > but then refuse to fix things as it's much sexier to implement new
> features than work on bugs. Or my other favorite is how they throw back
> the "why don't YOU fix it and submit a patch".
>
> the comment is not very useful when you comment on a distribution bug
> tracker and not to the software writer and the issue is a lack of
> manpower one
>
> --
> gedit fails to save files over smbfs/cifs
> https://bugs.launchpad.net/bugs/34813
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in Light-Weight Text Editor for Gnome: Confirmed
> Status in SambaServer: Invalid
> Status in SSHFS Mounter: Confirmed
> Status in “gedit” package in Ubuntu: Triaged
>
> Bug description:
> Saving files over a cifs/smbfs server doesnt work. You can open file, edit
> then save perfectly. But repeated saves after give you this error:
>
> "The file /home/dhonn/website/arrays.php has been modified since reading
> it. If you save it, all the external changes could be lost. Save it
> anyway?"
>
> The think is lying to me because I havent made any external changes.
>
> When I click "Save Anyway", i get this error:
>
> "Could not save the file /home/dhonn/website/arrays.php."
>
> But on the third try it works just fine.
>
> Here are the error messages, btw there are also GUI glitches too:
> http://dhonn.com/images/gedit-0.jpg
> http://dhonn.com/images/gedit-1.jpg
>
>

Revision history for this message
Robie Basak (racb) wrote :

@acabre:

Thanks for the strace file.

This is exactly what is needed but unfortunately there's a small issue. Because gedit seems to be aware of the file the strace output was being redirected to, my instructions included filtering out all mentions of the word "strace" from the log. Except that you called your mountpoint and directories strace too which I wasn't expecting. So the messages that I actually needed got filtered out too.

Could you please do it again, but this time use a command like this:

strace gedit 2>&1|grep -v filterthisaway > /tmp/filterthisaway.log

...and make sure that you don't mention the word filterthisaway anywhere else.

Thanks

Robie

Revision history for this message
acabre (acabre-eli) wrote :

@robie:

Sorry for complicating things. I've run a new test on an installation of 9.10 following your directions. After creating the tar, I realized that I should have called my user something other than tmp. Let me know if this causes problems and I can re-run the tests, since the box is already set up.

And thanks for looking at this!!!

Revision history for this message
tim pezarro (tim-pezarro) wrote :

Hello,

I have also added a strace file for the error I experience.

This is the error message for the file "samba_error.txt"

"Could not save the file /media/webteam
pezarro/tmp/samba_error.txt.
Unexpected error: Text file busy"

The attached zip file "gedit-error.zip" has strace log called "filterthisaway.log" and mount listing called "mounts.txt"

I hope this helps correct the gedit bug.

Cheers,

Revision history for this message
Robie Basak (racb) wrote :

@acabre and @tim pezarro:

Both of your strace files suggest the the problem is the same as the one that I fixed in a patch for the Intrepid package in 2008. Please try these packages for 9.10:

i386: https://launchpad.net/~racb/+archive/fixes/+files/gedit_2.28.0-0ubuntu2~basak1_i386.deb
amd64: https://launchpad.net/~racb/+archive/fixes/+files/gedit_2.28.0-0ubuntu2~basak1_amd64.deb

Revision history for this message
tim pezarro (tim-pezarro) wrote :

Robie,
Thanks for taking the time to review my log files. I believe i am guilty of not reading the details and understang that you have already created a patch for this problem.

I shall give your patch a try.

Cheers,
Tim Pezarro
Manager, Web Services
<email address hidden>
Phone: +1-604-415-6044
Cell: +1-604-762-1000
Fax: +1-604-415-6602
PMC-Sierra, Inc.
8555 Baxter @lace
Burnaby, BC, Canada
V5A 4V7

----- Original Message -----
From: <email address hidden> <email address hidden>
To: Tim Pezarro
Sent: Wed Nov 18 14:48:24 2009
Subject: [Bug 34813] Re: gedit fails to save files over smbfs/cifs

@acabre and @tim pezarro:

Both of your strace files suggest the the problem is the same as the one
that I fixed in a patch for the Intrepid package in 2008. Please try
these packages for 9.10:

i386: https://launchpad.net/~racb/+archive/fixes/+files/gedit_2.28.0-0ubuntu2~basak1_i386.deb
amd64: https://launchpad.net/~racb/+archive/fixes/+files/gedit_2.28.0-0ubuntu2~basak1_amd64.deb

--
gedit fails to save files over smbfs/cifs
https://bugs.launchpad.net/bugs/34813
You received this bug notification because you are a direct subscriber
of the bug.

Revision history for this message
Vito Botta (vito-botta) wrote :

Robie,

would love to have you here so that I could give you a big hug :D
After spending some time on this, I found your comments here and can confirm that your package fixes the issue for me on 9.10.

I am using the same user folders (Documents, Pictures, Music, etc) between Ubuntu and Windows (through Virtualbox's shared folders) and that was a pain.

Thanks!

Revision history for this message
Ronoaldo Pereira (ronoaldo) wrote :

Robie,

I can confirm that this package also fixed the problem for me on 9.10.

Thanks for the fix!!!

Revision history for this message
Gustaf (g-rantila) wrote :

There seems to be a regression issue here. I have never had issues with gedit and sshfs, until I recently upgraded from 9.10 to Lucid Alpha 3. Now my gedit will not save any file over sshfs, although any other editor does just fine.

Revision history for this message
Teoh Han Hui (teohhanhui) wrote :

This happens with vboxsf mounts as well. Affects Nautilus too as mentioned in bug 323091.

Revision history for this message
Id2ndR (id2ndr) wrote :

It appears that this bug is fix for cifs mount in 2.30 (according to https://bugzilla.gnome.org/show_bug.cgi?id=336738#c35).
I still encountered this bug using sshfs with 2.30 (Ubuntu 10.04).

So I'm not sure that the sshfs and cifs/smbfs trouble is the same one and maybe there should be 2 separate bugs.

I also would like to know if the patch applied in Robie Basak's package can still be use for gedit 2.30 ?
The patch isn't attached to this bug, so where can I grab it ?

Revision history for this message
Robie Basak (racb) wrote :

@Id2ndR

From a quick look, I think this is the patch I used. I've not checked it.

tags: added: patch
papukaija (papukaija)
tags: added: metabug
Changed in gedit:
importance: Unknown → Medium
Revision history for this message
Vide (vide80) wrote :

I'm using Ubunto 10.10 and the bug, with gedit and a fstab mounted CIFS share, is still there.
Steps to reproduce (the usuals):
- create a new file with gedit in the remote share
- type something
- Ctrl+S to save
- type something
- Ctrl+S to save: bug happens!

And to all the people/developers saying we should use gvfs+cifs... well, I'll do it when I'll get the same performances as with kernel mode CIFS (50MB/s (fifty) against 6MB/s (six))

Revision history for this message
Brad Richards (bradley-kri) wrote :

Please note that this bug affects more than just gedit - similar bugs have been reported against other applications, including eclipse: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=137011

Because of this, I think the priority should be increased!

Revision history for this message
fabioxxxx (fabioxxxx) wrote :

2006-2011 ... oh crap

Revision history for this message
yaztromo (tromo) wrote :

This bug also effects the geany editor when saving over cifs.

1. Open a file and modify it
2. Save it
3. Modify it some more
4. Save
5. BAM! File has been modified dialog. Usually the time difference between local and remote is 1 second.

My cifs server is Ubuntu 10.04 and my client machine is 10.10. Anyone know of a workaround? Is this a server problem or a client problem?

Revision history for this message
yaztromo (tromo) wrote :

update: Solved my own problem.

Simply changing the fstab entry from type cifs to smbfs fixed the problem for me.

Not ideal but it works.

Revision history for this message
Crates (typing) wrote :

My fstab already has this set as "smbfs" (not cifs), I already have the backup option unchecked, and this is still a problem for me (and has been on every Ubuntu installation I've ever had for the past five years). It ONLY happens with gedit, and ONLY when saving to a Samba filesystem.

The NAS (network attached storage device) that I use is a Data Robotics DroboFS Pro. I use it to store files collaboratively across five or six computers. On all other programs in Linux, as well as every program I use on Mac OSX and any version of Windows, my files are stored and retrieved just fscking fine. No problems.

So, when I hear people complaining about how this is a bug with Samba, CIFS, NFS, Windows architecture, NetBIOS protocols, the Linux kernel, underpants gnomes, whatever... I have to laugh, because this is clearly a gedit bug. One that has been active for OVER FIVE YEARS.

I'm going to implement my own solution going forward: I'll simply use a text editor that isn't total bullshit. But at any rate, maybe you guys might consider fixing the problem rather than trying to defer blame onto everyone else.

Here are some details. Hope they help.

Gedit version: 2.30.3

Ubuntu version: 10.04

Kernel version: 2.6.32-34-generic

Architecture: amd64

Revision history for this message
elatllat (elatllat) wrote :

well said Crates,
I also opted to use a different editor (vim) as a solution a long long time ago.

Revision history for this message
fabioxxxx (fabioxxxx) wrote :

switched to kate ...

Revision history for this message
Peter Würtz (pwuertz) wrote :

Ok this is getting nasty. The latest experience with this bug (Ubuntu 11.10) when trying to edit/save a textfile is a dialog popping up, telling me that gedit is unable to save the file. If you decide to close the editor for some reason now, the file is completely gone. You didn't just loose your changes, you lost the complete text file. There might be an invisible ~backup file around, but from a users point of view, the file is gone.

Can we please make that bug critical?

Revision history for this message
Peter Würtz (pwuertz) wrote :

Still happening on 12.10.
Users can loose whole text files when trying to save changes with gedit!

Changed in gedit (CentOS):
status: Unknown → New
Revision history for this message
Traducao Freire (traducaofreire) wrote :

I have the same problem in Oracle Linux 5 and 6; CentOS 5 and 6 and in RedHat 5

Here is how to reporoduce the error

/etc/fstab
//192.168.1.100/Oracle /mnt/Oracle cifs username=orcl,password=orcl 0 0
/dev/sda1 /mnt/sda1 ntfs defaults 0 0

When you save a file to /mnt/Oracle or /mnt/sda1, gedit immediately wants you to reload it. If you reload, you lost your ability of undo any changes prior to the save, if you don't do what gedit wants, you may end up with an empty file "Save Anyway"

But if you save the file to any Linux partition such /u01/app/oracle... gedit works fine

Revision history for this message
Daniel (hackie) wrote :

The problem still exists in Ubuntu 13.10 (Linux 3.11.0-20-generic x86_64) with gedit 3.8.3-0ubuntu3

My fstab:
//ourserver.local/myshare /mnt/mymount cifs uid=1001,file_mode=0600,dir_mode=0700,credentials=/myhome/.smbcredentials,iocharset=utf8,sec=ntlm,nounix 0 0

I found an interesting link which assumes that the reason is a time-synchronization problem: https://forums.gentoo.org/viewtopic-t-495454-start-0.html#3567475. This makes sense since our NAS is a Netgear ReadyNAS with a time drift of ~20s per day and NTP doesn't seem to work on it. Latter means that I cannot do any serious tests on it.

Revision history for this message
TimSC (timsc) wrote :

This might be similar to the Virtualbox/gedit fails to save bug (https://bugs.launchpad.net/ubuntu/+source/gedit/+bug/341725) which I suspect is caused by glib and the way it saves to a temporary file, then renames without closing the file. The bug has been recorded as: https://bugzilla.gnome.org/show_bug.cgi?id=656225

Revision history for this message
JP Vossen (jp-jpsdomain) wrote :

My use case is a Mint 17.x VM using a VirtualBox vboxsf to a Win8.1 host. I had this same problem in Geany and it was driving me insane until I found http://wiki.geany.org/config/all_you_never_wanted_to_know_about_file_saving and then "Edit > Prefs > Various > use_atomic_file_saving: checked" fixed it for me. Be sure to read the URL as there are implications. Obviously this does not fix Gedit but it may be an acceptable work-around for some people.

Changed in gedit:
status: Confirmed → Expired
Revision history for this message
elatllat (elatllat) wrote :

Yes this seems to be resolved now.

> gedit -V
gedit - Version 3.28.1

> sshfs -V
SSHFS version 2.8
FUSE library version: 2.9.7
fusermount version: 2.9.7
using FUSE kernel interface version 7.19

> uname -r
4.15.0-20-generic

> cat /etc/issue
Ubuntu 18.04 LTS \n \l

Revision history for this message
Laurent Dinclaux (dreadlox) wrote :

On Ubuntu 19.10 it fails saying "Cannot handle “file:” locations in write mode. Please check that you typed the location correctly and try again."

Revision history for this message
Nicolas Göddel (ngoeddel) wrote :

This bug also affects Ubuntu 19.10 with

$ gedit -V
gedit - Version 3.34.0

$ sshfs -V
SSHFS version 2.10.0
FUSE library version: 2.9.9
fusermount version: 2.9.9
using FUSE kernel interface version 7.19

$ uname -r
5.3.0-46-generic

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 19.10
Release: 19.10
Codename: eoan

I can not confirm what @elatllat was saying 2 years ago.

Revision history for this message
Dark Dragon (darkdragon-001) wrote :

This bug also affects me. For another bug, I created instructions on how to reproduce my samba setup via docker: https://gitlab.gnome.org/GNOME/gedit/-/issues/322#steps-to-reproduce

This might help reproducing this bug.

Displaying first 40 and last 40 comments. View all 149 comments or add a comment.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.