Opened 15 years ago
Last modified 8 years ago
#4862 reopened defect
Files in shared folder which open in mode "w+b"(Linux guest) could not be read(Protocol Error)
Reported by: | Yao | Owned by: | |
---|---|---|---|
Component: | shared folders | Version: | VirtualBox 3.0.4 |
Keywords: | Cc: | ||
Guest type: | Linux | Host type: | Windows |
Description
I am using a python programe(ZODB) to read file's content in shared folder.But I got a [IOError]Protocl Error when I run the programe.And I check out the source,found that ZODB open this file in "w+b" mode.I write a very simple test programme(also python),and got the same problem.Here is the source:
#Test programme f = open("Data.fs",mode="w+b") f.read(10)#got error here
Data.fs is the file in shared folder.I also test in mode "r+b",it's ok for both write and read.
Attachments (2)
Change History (7)
by , 15 years ago
Attachment: | VBox.log.1 added |
---|
comment:1 by , 15 years ago
comment:2 by , 15 years ago
Sure i did.I tested on ext3 filesystem and it work fine.Seems like some function is missing for file operation, but don't know what.As I told, open file in mode "r+b" is OK."r+" mode also provide read and write simultaneously.What difference between "r+" and "w+"?Any trick to make "w+" mode work?
comment:3 by , 15 years ago
Works fine here with a Linux guest on a Vista host. Could you check if this problem persists with VBox 3.1.2? Please update the guest additions as well!
comment:4 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Please reopen if still relevant (use VBox 3.1.4 now).
comment:5 by , 8 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
I'm reopening this ticket, apologies for raising it from the dead so much.
I can reliably reproduce this error. The w+b Python mode is translated to w+ for fopen, meaning 'Open for reading and writing, truncating existing'. The error only occurs when the truncation path is taken.
Attached is a minimal reproducer written in C that succeeds the first time it's run and fails the second time, unless file.txt is removed from the working directory.
Output is as follows:
ubuntu@ubuntu-xenial:/vagrant$ gcc test.c -o 4862 ubuntu@ubuntu-xenial:/vagrant$ ./4862 Read: Hello. ubuntu@ubuntu-xenial:/vagrant$ ./4862 Error reading file: Protocol error
I'm running this on a Ubuntu Xenial 64bit host and Ubuntu Xenial64 bit guest. I've verified this on two computers, with the underlying storage being ext4 or zfs.
Virtualbox version is 5.1.6_Ubuntur110634
Well, did you test the same on an ext3 file system? If you open a file only for writing but not for reading, then you will not be able to read from the file.