LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   gedit: can not modify files on CIFS filesystem (https://www.linuxquestions.org/questions/linux-desktop-74/gedit-can-not-modify-files-on-cifs-filesystem-785406/)

slacker_et 01-28-2010 12:42 PM

gedit: can not modify files on CIFS filesystem
 
I'm having issues with gedit saving files on a CIFS mounted share.
The system I'm using is an OpenSuse 10.3. And I have my Windows shared mounted as a CIFS filesystem.
I am mounting the CIFS with default permissions/parameters.
And the "mount" command displays it mounted as:

"type cifs (rw,mand)"

What I'm encountering is that gedit can not modify any files on this CIFS filesystem; not even a file it just created.
Gedit can create a file on this CIFS filesystem. But it can only save the file once. Any additional saves will fail.
The message that gets displayed is a non-informative:

"Could not save the file: $FILENAME"

I can not find ANY errors in log files OR even at the commandline when I start gedit from the prompt.

BUT all other programs; vi, touch, cat, emacs, sed, etc..; do not have any problems making changes to these very same files.

Has anyone else experienced this behavior from gedit ?

Thanks;
--ET

David1357 01-28-2010 01:07 PM

Quote:

Originally Posted by slacker_et (Post 3843932)
Has anyone else experienced this behavior from gedit?

I could not duplicate the problem on Ubuntu 8.10 and RedHat El5.4.

slacker_et 01-29-2010 09:22 AM

I'm probably not the only person who has ever encountered this situation.
So just in case someone else ever encounters the same situation; I'll post some of my own investigation.

Running an strace on gedit during one of these failures and logging it. I've noticed this output:

Starting a log and using strace:
Code:

> script -a eric.log 2>&1
> strace gedit eric.tmp

Portion of log where I think it is failing to save the file:
Code:

8749 open("/SFS/user/wp/trimmer/windows/eric.tmp", O_WRONLY|O_CREAT|O_EXCL, 0666) = -1 EEXIST (File exists)
 8750 open("/SFS/user/wp/trimmer/windows/eric.tmp", O_RDWR) = 16
 8751 gettimeofday({1264708337, 189926}, NULL) = 0
 8752 gettimeofday({1264708337, 190045}, NULL) = 0
 8753 fstat(16, {st_mode=S_IFREG|0644, st_size=5, ...}) = 0
 8754 lstat("/SFS/user/wp/trimmer/windows/eric.tmp", {st_mode=S_IFREG|0644, st_size=5, ...}) = 0
 8755 umask(077)                              = 022
 8756 gettimeofday({1264708337, 190294}, NULL) = 0
 8757 open("/SFS/user/wp/trimmer/windows/.gedit-save-RWYA7U", O_RDWR|O_CREAT|O_EXCL, 0600) = 17
 8758 umask(022)                              = 077
 8759 fchown(17, 4086, 1001)                  = 0
 8760 fchmod(17, 0100644)                    = 0
 8761 lseek(17, 0, SEEK_SET)                  = 0
 8762 ftruncate(17, 0)                        = 0
 8763 write(17, "dddd", 4)                    = 4
 8764 write(17, "\n", 1)                      = 1
 8765 rename("/SFS/user/wp/trimmer/windows/eric.tmp", "/SFS/user/wp/trimmer/windows/eric.tmp~") = -1 ETXTBSY (Text file busy)
 8766 close(17)                              = 0
 8767 unlink("/SFS/user/wp/trimmer/windows/.gedit-save-RWYA7U") = 0
 8768 close(16)                              = 0

I think it's "-1 ETXTBSY (Text file busy)" that is the clue to the problem. But not being a programmer by trade; I'm not certain what it means.

I'll continue to investigate.
In the mean time; doesn't anyone else know what might be going wrong ?


Thanks;
--ET

jschiwal 01-30-2010 04:57 AM

What kind of windows system is this. There is a bug with the Windows home server that doesn't allow you to edit files, even using Windows. You need to copy the file to your client machine, edit it, and then replace the original.

It sounds like it may be a locking problem.

From the Samba HOWTO & Reference Guide:
Code:

The second class of locking is the deny modes. These are set by an application
when it opens a file to determine what types of access should be allowed
simultaneously with its open. A client may ask for DENY NONE, DENY READ,
DENY WRITE, or DENY ALL. There are also special compatibility modes called
DENY FCB and DENY DOS.

I'm not sure if this is the responsibility of the client or the cifs kernel driver.

From "Advanced Programming in the Unix Environment"

Code:

O_CREAT  Create the file if it doesn't exist. ...

O_EXCL  Generate an errro if O_CREAT is also specified and the file already exists.

Notice the first two lines of your strace segment. The first call fails. That is because the file already existed and tlhe O_CREAT & O_EXCL flags were used. So gedit tried again. This time in Read/Write mode. So far, this looks OK.

Code:

8765 rename("/SFS/user/wp/trimmer/windows/eric.tmp", "/SFS/user/wp/trimmer/windows/eric.tmp~") = -1 ETXTBSY (Text file busy)
This error occurred when gedit tried to rename the file to a temporary name "eric.tmp~". This file has a file handle (fd) of 16. I think that for windows, the file should be closed before renaming. For an inode based filesystem, this wouldn't be a problem. You can rename a file, but still retain the same inode that you opened. (even if you deleted the file)

Note that you could have left out later lines where gedit handled this situation.

One problem may be Windows' CIFS support not being up to par.

Can you try a different editor? (Or rhetorically, a Samba server :) )


All times are GMT -5. The time now is 04:12 AM.