VirtualBox

Ticket #1612 (closed defect: fixed)

Opened 6 years ago

Last modified 5 years ago

append does not work correctly on a vboxsf filesystem => Fixed in SVN

Reported by: matthijs Owned by:
Priority: major Component: shared folders
Version: VirtualBox 1.6.0 Keywords:
Cc: Guest type: Linux
Host type: other

Description

The following commands demonstrate that ticket 1178 is not correctly solved:

$ echo 'a very long line with text' >/XP/file.txt
$ echo 'a bit more' >>/XP/file.txt
$ cat /XP/file.txt
a bit more
 line with text
$ 

This is with a Debian/testing guest on a Windows XP/sp2 host, and /XP is the result of

# mount -t vboxsf -o defaults,uid=matthijs,gid=matthijs C_DRIVE /XP

Change History

comment:1 Changed 6 years ago by michael

Confirmed, but unfortunately we will not be able to fix this for 1.6.2.

comment:2 Changed 6 years ago by frank

  • Component changed from other to shared folders

comment:3 Changed 6 years ago by frank

  • Guest type changed from other to Linux

comment:4 Changed 5 years ago by travishein

I can confirm this is still present as of VirtualBox 2.0.6.

I first discovered this when running a PHP script that opens and appends to a file, where the file resides on a folder that is mounted as a vboxsf shared folder.

The code attempts to do a fopen("File.txt", a) so as to open in append mode.

The result of the open in append mode and writing to the file shows the new contents overlaid at the start of the file, as if the file was opened and was written to, but the file pointer was not moved to the end of the file.

I also thought it might have been because I was running VirtualBox 2.0.4 with the Linux guest VM using the Guest Additions from 1.6, and that it was just a mismatch of host and guest addition versions. But after upgrading both to the 2.0.6 version I still see the problem.

In my case I am able to work around this by

  • not using files on the shared file system that would be opened in append mode
  • modify the code to perform a fseek (handle, 0, SEEK_END) , so as to move the file pointer myself to the end of the file (which open in append mode should have been doing for us)

But clearly these workarounds for the lack of append file working on vboxsf are not helpful for others who have binary applications or shell script redirects.

I mainly just wanted to report that its still an issue on 2.0.6 Linux host with linux guest using vboxsf mount.

comment:5 follow-up: ↓ 6 Changed 5 years ago by frank

We still had no time to investigate into this issue. Any help is appreciated, the source code is available.

comment:6 in reply to: ↑ 5 Changed 5 years ago by baf

Replying to frank:

We still had no time to investigate into this issue. Any help is appreciated, the source code is available.

This patch seems to fix it.

module/vboxvfs$ diff -u regops.c.org regops.c
--- regops.c.org     2008-11-21 19:40:02.000000000 +0100
+++ regops.c         2009-01-11 01:06:01.000000000 +0100
@@ -123,7 +123,8 @@
         struct sf_glob_info *sf_g = GET_GLOB_INFO (inode->i_sb);
         struct sf_reg_info *sf_r = file->private_data;
         loff_t pos = *off;
-
+       if (file->f_flags & O_APPEND) //"borrowed" from linux-source-2.6.27/fs/udf/file.c
+         pos = inode->i_size;
         TRACE ();
         BUG_ON (!sf_i);
         BUG_ON (!sf_g);

comment:7 Changed 5 years ago by frank

  • Summary changed from append does not work correctly on a vboxsf filesystem to append does not work correctly on a vboxsf filesystem => Fixed in SVN

Thank you very much for that suggestion! I've applied a similar fix to the repository. The fix will be included in the next version. Users how want to try this out just need to fix the code in /usr/src/vboxvfs-2.1.0/regops.c like shown in the previous comment and recompile the guest additions modules with

/etc/init.d/vboxadd setup

comment:8 Changed 5 years ago by sandervl73

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

comment:9 Changed 5 years ago by BillBauman

  • Status changed from closed to reopened
  • Resolution fixed deleted

I specifically still have corruption issues if I download from Firefox directly to a shared folder. Any file large enough for FF to break up and use .part files is usually corrupt. Sometimes, if I immediately re-download the file, it will fix the original, often times, not. It seems that however FF is appending data to partials during downloads still does not work.

This is with VirtualBox 2.2.0 under Vista x64. I have had this problem all along, though, with every version of VBox to date.

comment:10 Changed 5 years ago by MrX1980

Please try it with v3.0.0 again.

comment:11 Changed 5 years ago by frank

  • Status changed from reopened to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use