Bug 77902 - Device I/O error when appending to log file from Linux to Samba share
Summary: Device I/O error when appending to log file from Linux to Samba share
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Network
  Show dependency treegraph
 
Reported: 2014-04-24 17:03 UTC by Jeff H
Modified: 2022-10-23 03:55 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Attempts an append to a log file on a Samba share (9.51 KB, application/vnd.oasis.opendocument.spreadsheet)
2014-04-24 17:03 UTC, Jeff H
Details
BasicIOError.png: screenshot of the error message from 6.0alpha1 (6.74 KB, image/png)
2017-10-21 16:16 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff H 2014-04-24 17:03:35 UTC
Created attachment 97912 [details]
Attempts an append to a log file on a Samba share

Running LO 4.1.3.2 (release version) on Linux Mint 16, when I run LO BASIC code that attempts to append some text to a log file on a Samba share, I get a Device I/O error. No, there are no access or permission issues - I can read the log file just fine, and I can create files in that directory using Nautilus.

The attached Calc file has a button that runs some sample code. On my network, I can run the program fine from a Windows machine - it reads the first few lines from the log file, then appends a line at the end of the log file. When I run the code on a Linux machine, the following line gives me a Device I/O error:

Open sPath For Append As #1

But the Open sPath For Input As #1 just above that line works fine.

Obviously if others want to test this code, you would need to change the path to a Samba server that you have access to on your network. On my Linux systems, I access our server using smb://cdb.sil.org/server. Just FYI, the ConvertToURL line in the code changes the "//cdb.sil.org/server" path to different things on different OS's. On Windows it changes it to "file://cdb.sil.org/server" and on Linux it changes it to "smb://cdb.sil.org/server".

This is NOT a duplicate of bug#67527. I also had some problems with LO not creating lock files on our Samba share and applied the workaround in Comment #15, and that solved that problem. With that workaround applied, however, the bug described here still occurs.
Comment 1 Jeff H 2014-05-16 10:46:23 UTC
I have found a work-around to this bug, but it is messy and probably very dependent on the version of Linux being used. The work-around is described here:
http://ask.libreoffice.org/en/question/32488/calc-basic-cant-append-to-network-text-file-from-linux/

I would appreciate it if someone could confirm this bug, so that maybe we could move towards a solution.

To recap, I access our server from Calc BASIC with a path like this: "file://cdb.sil.org/server/folder/file". I run this path through ConvertToURL before using it; on Windows machines the "file:" prefix stays the same, on Linux machines it changes to "smb:". In this way, all of our API file accesses to our server (StoreAsURL, StoreToURL, LoadComponentFromURL, etc.) work on both systems. But if I use the basic Open For Append or Open For Output BASIC commands with these same paths, Linux access to the "smb://cdb..." paths will fail with a Device I/O error. I can use Open For Input with the "smb://cdb..." paths successfully, but not Append or Output.

My work-around starts with the fact that any Linux "smb://" access on a mounted share actually has a "normal" file access somewhere in the system, if you can find it. On our Linux Mint 16 systems, the Samba file access to our server gets converted at some level to this "normal" Linux path:

/run/user/1000/gvfs/smb-share:server=cdb.sil.org,share=server/

So my work-around code manually builds up this server path, and whenever I want to use smb:// (which LibreOffice refuses to convert for the Open Append or Output commands), I manually put in this long, messy path for direct access to the file.
Comment 2 Joel Madero 2014-11-20 18:33:38 UTC
Jeff - I'm going to attempt this one probably over the weekend (no promise though...might be December as I'm swamped). That being said - clearer reproducible steps would be helpful....I don't use Samba generally so I'll be setting it up and what not....assume I know nothing - how do I reproduce the problem.
Comment 3 Justin L 2014-11-21 05:25:04 UTC
This also happens against a regular windows share - so you can test without Samba.  Just have a windows machine available with a share that you can interactively browse to "smb://myServer/myShare" in your file manager.

Steps I took to reproduce.
1.)  Open Test Append.ods
2.)  Edit Macros (Tools->Macros->Organize Macros->LibreOffice Basic, Edit Main macro in Module1
3.)  change 	sPath = "//<myServer>/<myShare>/"
4.)  Run Macro


Results:
Msgbox:  smb://myServer/myShare/Reconcile.log  (OK)
crash to Macro IDE on line "Open sPath For Append As #1":  LibreOffice 4.3.3.2  BASIC runtime error. Device I/O error. (OK)
Comment 4 Jeff H 2014-11-21 14:19:20 UTC
Thanks for your efforts to fix this bug. I am not in a place right now where I have the equipment to be able to test this bug. Hopefully Justin's comments can help you move things along.
Comment 5 Joel Madero 2014-11-21 16:38:35 UTC
What about if you mount the server share through fstab? Does it also happen with NFS?
Comment 6 Joel Madero 2014-11-21 17:26:58 UTC
I'm still really confused about this one. I changed the location to a local folder and got the same error...are we 100% sure that this is related to anything dealing with a network? Have either one of you tried pointing it to a local folder to see what happens?
Comment 7 Justin L 2014-11-21 19:00:42 UTC
I tried pointing to /tmp (sPath = "/tmp/") and it works.

I tried pointing incorrectly (sPath = "/tmp") without the ending slash, and get the same "Basic Runtime Error. Device I/O Error." since it is trying to write to the root directory where I have no permission.


OK.  Back to network stuff.
If I mount the path, it works.  (mount -o username=myuser,password=mypassword,uid=myUnixName "//myServer/myShare" /mnt/myMount) [sPath = "/mnt/myMount/"].   Reconcile.log is read and appended to with no error message.

If I browse with Nautilus/Nemo to "smb://myServer/myShare", verify that I can access and write to Reconcile.log, and then set sPath = "//myServer/myShare/", I get the error.

P.S.  For this macro example to work, either Reconcile.log should NOT already exist, or else it should have AT LEAST three lines in it.  Otherwise you will get an error about not being able to read the first three lines before even getting to the "append" error.  (The error message is different: Reading exceeds EOF.)

About NFS:  Sorry - I've never setup or used NFS.
Comment 8 Justin L 2014-11-21 19:13:51 UTC
/etc/fstab worked fine too.

//myServer/myShare    /mnt/myMount    cifs    username=myUser,password=myPassword,uid=myUnixName
Comment 9 QA Administrators 2015-12-20 16:10:04 UTC Comment hidden (obsolete)
Comment 10 QA Administrators 2017-01-03 19:47:23 UTC Comment hidden (obsolete, spam)
Comment 11 Justin L 2017-10-21 16:16:18 UTC
Created attachment 137189 [details]
BasicIOError.png: screenshot of the error message from 6.0alpha1

bibisect43all shows that this has always happened.  Still happening in Ubuntu 16.04 and LO6.0alpha1.
Comment 12 QA Administrators 2018-10-22 02:51:05 UTC Comment hidden (obsolete, spam)
Comment 13 QA Administrators 2020-10-22 04:29:51 UTC Comment hidden (obsolete)
Comment 14 QA Administrators 2022-10-23 03:55:56 UTC Comment hidden (spam)