Bug ID | 1126429 |
---|---|
Summary | gio mount smb can result n corrupted files if they are opened in 'w+' mode |
Classification | openSUSE |
Product | openSUSE Distribution |
Version | Leap 15.0 |
Hardware | Other |
OS | Other |
Status | NEW |
Severity | Normal |
Priority | P5 - None |
Component | GNOME |
Assignee | bnc-team-gnome@forge.provo.novell.com |
Reporter | wagner-thomas@gmx.at |
QA Contact | qa-bugs@suse.de |
Found By | --- |
Blocker | --- |
I have a network share on a Windows 2012 server and openSUSE 15.0 as well as Tumbleweed clients. I use "gio mount smb://server/share" to access the files on the share. While most applications can read/write well on the mounted share, some application crashed or produced corrupted files, e.g. https://github.com/h5py/h5py/issues/1170 I could reproduce the problem using the 'w+' file access mode (open file for reading and writing). Seeking in the file once forth and then back again will produce errors on subsequent reads. At the end of this bugreport, I listed a small C and a Python3 example to reproduce the error. Running the C example, wrong data is read, whereas the Python3 example quits with OSError due to unsuccessful reads. When I mount the share via mount.cifs the tests work as intended. So there is no problem with the samba server but with "gio mount". The problem appears on Leap 15.0 as well as latest Tumbleweed. --------------------------------------------------------------------- #include<stdio.h> void main() { FILE *fp; char ch; fp=fopen("testfile_c.bin", "w+"); if(fp==NULL) printf("file cannot be opened"); else { fseek(fp, 1000, 0); fwrite("test", 1, 4,fp); fseek(fp, 0, 0); fwrite("test", 1, 4,fp); fseek(fp, 0, 0); ch = getc(fp); printf("%c",ch); /* "t" should appear, but only garbage chars appears */ fseek(fp, 0, 0); fwrite("abcd", 1, 4,fp); fseek(fp, 0, 0); ch = getc(fp); printf("%c",ch); /* "a" should appear, but only garbage chars appears */ printf("\n"); } fclose(fp); } --------------------------------------------------------------------- with open('testfile_py.bin', 'w+b') as f: f.seek(1000) f.write(b'test') f.seek(0) f.write(b'test') f.seek(0) print(f.read(5)) f.seek(0) f.write(b'abcd') f.seek(0) print(f.read(10)) # segfault during read ---------------------------------------------------------------------