VirtualBox

Opened 9 years ago

Last modified 9 years ago

#14852 new defect

Grouped command output lost when redirecting to file on shared folder

Reported by: Eric Sproul Owned by:
Component: shared folders Version: VirtualBox 5.0.10
Keywords: solaris shell redirect Cc:
Guest type: Solaris Host type: other

Description

I am not entirely sure how to describe this issue, but see the comments in the attached test file on how to reproduce. What appears to happen is that I have a group of commands in a shell script that produce output that is redirected to a file, e.g.

{
  command1
  command2
} > some_file.txt

regardless of whether the commands are shell built-ins or external, only the output of the last command ends up in the redirect file. This only happens when the redirect file is on a shared-folder mount within the guest. It does not happen in other directories within the guest. It also does not happen if the commands are not grouped, i.e. they do not share access to the output file.

In all cases, the test script is run from within the guest, the difference being the current working directory. I have observed this behavior on both Oracle Solaris 11.3 and OmniOS r151006 guests. OmniOS is an illumos distribution, similar to Solaris. In both cases, the Solaris Guest Additions are installed:

# modinfo | grep vbox
187 fffffffff8115000  29210 265   1  vboxguest (VirtualBox GstDrv 5.0.10r104061)
200 fffffffff8151000   3b28 266   1  vboxms (VBoxMouseIntegr 5.0.10r104061)
201 fffffffff8155000   88a8  24   1  vboxfs (VirtualBox ShrdFS 5.0.10r104061)

This was discovered while trying to run an autoconf "configure" script, which tried to echo a string, pipe it to sed, echo something else, and redirect all the output to a file. The output from sed never made it to the file. The attached test script is a condensed version of this. The effect is that we cannot run configure in a shared folder.

I have verified with truss(1M) that in both cases, identical write(2) syscalls are issued with the same arguments, and succeed in all cases. I also cannot reproduce this on a Linux guest. I therefore suspect that the issue lies in the particular VFS implementation provided by the vboxfs Solaris driver.

Attachments (1)

vbbug.sh (661 bytes ) - added by Eric Sproul 9 years ago.
Reproduces grouped-command output loss

Download all attachments as: .zip

Change History (2)

by Eric Sproul, 9 years ago

Attachment: vbbug.sh added

Reproduces grouped-command output loss

comment:1 by Eric Sproul, 9 years ago

A clarification: if all the commands in the group are shell builtins, then this issue does not manifest. If one or more of the commands are external, the issue is present. In discussion with other illumos developers, we speculate that since the shell must duplicate its file descriptors into the process for the external command, that when the command exits and the fd's are closed (decrementing the refcount in VFS), the data buffers associated with those fd's are dropped instead of being flushed to disk. A bug like this would produce the behavior we see.

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use