Javascript corrupted with illegal characters/truncation

Discussions related to using VirtualBox on Mac OS X hosts.

Javascript corrupted with illegal characters/truncation

Postby davidbjames » 23. Nov 2009, 02:09

I am having continual Javascript problems when I browse to a web page served from my Debian 32 virtual machine which is using Apache server. I am working on Mac OSX 10.6.2 using a SMB/AFP shared folder and Virtual Box 3.0.8

The Javascript files are getting corrupted with "illegal characters" appended to them OR characters truncated off the end. At first this was happening almost randomly, but now I think it is related to file changes. For instance if I edit the files, then I get the corruption immediately. This occurs if I edit in my IDE (Zend Studio) or by ssh'ing in and editing with vim or simply using TextEdit. "touch"ing the file doesn't cause the problem. But any changes to the file does cause the problem. The corruption (garbage characters/missing characters) is only visible if I open the Javascript "file" from my browser (Firefox using Firebug console) and not in the editors themselves (although sometimes I have seen a new blank line at the end of the file).

I thought it was a browser caching issue, so I disabled cache in my browser without any luck. I have also tried other browsers and had the same issue.

I have also tried every possible combination of permissions on the shared folder.

The only solution I have found is "shutdown -r now" :(

How are the files getting corrupted? Can anyone help me?
davidbjames
 
Posts: 2
Joined: 23. Nov 2009, 01:06
Primary OS: Mac OS X Leopard
VBox Version: PUEL
Guest OSses: Debian

Re: Javascript corrupted with illegal characters/truncation

Postby Brainscape » 24. Nov 2009, 17:03

I am having the exact same problem with Virtualbox 3.0.12 r54655 running Ubuntu 9.04 as a guest OS but with Windows Server 2008 Enterprise as host OS so I'm guessing it is not an OS related problem. I noticed that if I create a new file and paste the javascript content I am able to use the file but as soon as I edit an already shared file I get illegal characters/truncation.

Any help to resolve this would be greatly appreciated, really slows down my development cycles.
Brainscape
 
Posts: 1
Joined: 24. Nov 2009, 16:58
Primary OS: MS Windows 2008
VBox Version: OSE other
Guest OSses: Ubuntu 9.04

Re: Javascript corrupted with illegal characters/truncation

Postby davidbjames » 25. Nov 2009, 19:04

I think I figured this out! (with the help of some others)

In the VM file /etc/fstab I set the credentials to allow the host system access to the shared folder (last line of this example)

Code: Select all   Expand viewCollapse view
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/hda1       /               ext3    errors=remount-ro 0       1
/dev/hda5       none            swap    sw              0       0
/dev/hdc        /media/cdrom0   udf,iso9660 user,noauto     0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0
//192.168.56.1/namehere       /mnt/namehere cifs credentials=/etc/samba/user,defaults,uid=33,gid=33,file_mode=0777,dir_mode=0777 0 0


I also made sure that /etc/samba/user had my username and password in it.
Code: Select all   Expand viewCollapse view
username=<username>
password=<password>
davidbjames
 
Posts: 2
Joined: 23. Nov 2009, 01:06
Primary OS: Mac OS X Leopard
VBox Version: PUEL
Guest OSses: Debian

Re: Javascript corrupted with illegal characters/truncation

Postby dlouwers » 20. Jan 2010, 12:33

Hi,

I am using v3.1.2 (on Snow Leopard) and I am having the same issues using an Ubuntu LTS 8.04 guest OS with Apache 2. The issue is fixed when renaming the js file, refreshing the browser and giving the js file the original name again. I have to do this upon every edit of a js file otherwise it gets truncated or illegal characters get appended.

I have tried different browsers, restarting the web server on the virtual machine, using other editors, nothing helps. It makes development so slow that it's become an unusable development platform.

I will try again with on my Linux host operating system, but I have a hunch this is related to OS X looking at the previous posters.

I am using shared folders so cifs is not an option here. I am mounting the shared folder in rc.local using:
mount -t vboxsf -o rw,uid=www-data,gid=www-data <share_name> <mount_point>

Hope someone can help me with this. And if not perhaps recommend a reliable vm client I can use until this is fixed.

Best,

Dirk Louwers
dlouwers
 
Posts: 1
Joined: 27. Oct 2009, 17:29
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: Ubuntu Server 8.04 LTS

Re: Javascript corrupted with illegal characters/truncation

Postby costmo » 15. Feb 2010, 23:45

I started with VBox 3.1.2 on Mac OSX host. Same problem in both Leopard and Snow Leopard. Guest: CentOS 5.4 running Apache 2.0.x. In VBox 3.1.2, I did not see this problem because a bug in VBox's native file sharing that made symbolic links not work forced us to use NFS to load the files from the MacOS host.

The symbolic link problem was fixed in 3.1.4, so we switched to using VBox file sharing. Now when updating javascript files, they seem to be cached in Apache forever and illegal characters are added to the end of the file. I thought at first that it was a browser cache issue, but switched to a browser that hadn't been used ever on the machine, and it showed the same out-of-date file with illegal characters. There were two short-term remedies:
1. Unmount and remount the file system
2. Shut down and restart apache

But that has to be done EVERY time a javascript file is updated. One long-term solution:
1. Use NFS for file sharing

This is a horribly unstable solution, especially when we want to be able to suspend and resume the guest regularly. The NFS mount seems to crash about every four or five resumptions and the only remedy it to force power-down the guest.

This is obviously a bug that people have known about and complained about for quite a while (as early as 3.0?). Does a bug report need to be filed?
costmo
 
Posts: 2
Joined: 15. Feb 2010, 23:32
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: Windowx XP, CentOS

Re: Javascript corrupted with illegal characters/truncation

Postby mbarr » 15. Mar 2010, 20:48

The fix is to include

EnableSendfile Off

in the httpd.conf file- it's not the JS, or css, or anything- it's just the apache server doing something Virtualbox isn't happy with. Might be nice to have a FAQ about it, though... for vboxsf, at least.
mbarr
 
Posts: 1
Joined: 15. Mar 2010, 19:28
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Centos 5.4


Return to VirtualBox on Mac OS X Hosts

Who is online

Users browsing this forum: No registered users and 19 guests