VirtualBox

Opened 16 years ago

Closed 15 years ago

#1612 closed defect (fixed)

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

Reported by: Matthijs Melchior Owned by:
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 (11)

comment:1 by Michael Thayer, 16 years ago

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

comment:2 by Frank Mehnert, 16 years ago

Component: othershared folders

comment:3 by Frank Mehnert, 16 years ago

Guest type: otherLinux

comment:4 by travishein, 15 years ago

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 by Frank Mehnert, 15 years ago

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

in reply to:  5 comment:6 by Bengt-Arne Fjellner, 15 years ago

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 by Frank Mehnert, 15 years ago

Summary: append does not work correctly on a vboxsf filesystemappend 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 by Sander van Leeuwen, 15 years ago

Resolution: fixed
Status: newclosed

comment:9 by Bill Bauman, 15 years ago

Resolution: fixed
Status: closedreopened

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 by MrX1980, 15 years ago

Please try it with v3.0.0 again.

comment:11 by Frank Mehnert, 15 years ago

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use