Ticket #4862 (reopened defect)

Opened 9 years ago

Last modified 15 months ago

Files in shared folder which open in mode "w+b"(Linux guest) could not be read(Protocol Error)

Reported by: future0906 Owned by:
Priority: major Component: shared folders
Version: VirtualBox 3.0.4 Keywords:
Cc: Guest type: Linux
Host type: Windows


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") 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.


VBox.log.1 Download (39.3 KB) - added by future0906 9 years ago.
test.c Download (347 bytes) - added by MatthewWilkes 15 months ago.
Minimal reproducer in C. Run twice.

Change History

Changed 9 years ago by future0906

comment:1 Changed 9 years ago by frank

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.

comment:2 Changed 9 years ago by future0906

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 Changed 8 years ago by frank

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 Changed 8 years ago by frank

  • Status changed from new to closed
  • Resolution set to fixed

Please reopen if still relevant (use VBox 3.1.4 now).

comment:5 Changed 15 months ago by MatthewWilkes

  • Status changed from closed to reopened
  • Resolution fixed deleted

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

Last edited 15 months ago by MatthewWilkes (previous) (diff)

Changed 15 months ago by MatthewWilkes

Minimal reproducer in C. Run twice.

Note: See TracTickets for help on using tickets.
ContactPrivacy policyTerms of Use