VMware, Inc [Tue, 28 Jun 2011 19:53:49 +0000 (12:53 -0700)]
Unity/X11: Make annoying logs opt-in.
Noisy logging isn't just annoying. By drowning out useful stuff and
slowing things down, it's harmful. From now on, users can opt in to
annoying Unity logging by setting the VMWARE_UNITY_VERBOSE_LOGGING
environment variable before running vmusr.
VMware, Inc [Tue, 28 Jun 2011 19:53:24 +0000 (12:53 -0700)]
Unity/X11: More dirty hacks to match executables to .desktop files.
Summary:
o Now recognizing "gnome-" prefix for .desktop entries.
o Matching Firefox and Thunderbird to mozilla-{firefox,thunderbird}.
o All pattern matching stuff is setup once in WindowPathFactory's constructor.
Details:
Unity/X11 wasn't returning icons for Firefox, Nautilus, and GNOME's calculator.
Turns out what RHEL packaged some GNOME apps with their .desktop files
including a gnome- prefix. This is similar to the kde4- prefix we saw with
OpenSUSE. The Mozilla apps were packaged with mozilla- prefixes.
VMware, Inc [Tue, 28 Jun 2011 19:51:56 +0000 (12:51 -0700)]
Remove the X{Grab,Ungrab}Server calls in resolutionSet
When using vesa X was getting into a sort of race condition because we were
not calling XSync after the X{Grab,Ungrab}Server calls. This was causing X
to appear to hang. Really since we aren't setting anything (only reading values)
I don't see a reason to keep these calls. Hence remove them and fix the bug.
VMware, Inc [Tue, 28 Jun 2011 19:50:55 +0000 (12:50 -0700)]
File_MakeTempEx2 race
There is a nasty race when two threads/processes call
File_MakeTempEx2. It is possible for one caller to be creating
files while the other is creating directories. Since there is
one "name space" there can be collisions that are a pain to deal
with.
The solution is simple - files are created with odd numbers,
directories with even numbers. This way the available exclusions
(via O_EXCL and mkdir) provide reliable collision detection. We
never have a possibility of attempting an open on a directory.
XComposite since 0.3 provides composite overlay windows, or windows whose
geometry match the root windows', are stacked above applications but below
the screensaver, don't appear in QueryTree requests, etc. They're intended
for use by compositing managers to redirect contents to and draw upon.
When Unity/X11 encountered such a window, it would treat it as a regular
override redirect window. In other words, it'd tell the host UI that the
VM has a window whose geometry takes up the entire screen. This resulted
in bug 690447, where the guest's entire desktop appears onscreen.
My fix was to ask XComposite for the IDs of these windows, and then just
ignore any events related to them.
VMware, Inc [Tue, 28 Jun 2011 19:37:21 +0000 (12:37 -0700)]
Fixing problems with change notifications.
invalidateObjects functions deletes all change notification watches.
Thus after this function is invoked notifications are not delievered any more
and directory handle re-open is needed for notifications to resume.
invalidateObjecs is wrong place to cleanup change notifications related to a
session. Move this call to channelExit just before call to detroy session.
VMware, Inc [Tue, 28 Jun 2011 19:35:56 +0000 (12:35 -0700)]
vSockets should attach itself to VMCI and support detaching.
The drivers are still merged, but with this change,
vSockets now supports attaching on-demand to VMCI,
and also enables the detach callback so that VMCI
can dynamically unload.
VMware, Inc [Tue, 28 Jun 2011 18:57:52 +0000 (11:57 -0700)]
Fix issues discoved using Coverity.
In a specific function i.e. HgfsServerSearchRead, we check if an
a variable of type unsigned int is less than zero which is clearly
a no-op. Fixed this code.
VMware, Inc [Tue, 28 Jun 2011 18:57:20 +0000 (11:57 -0700)]
More tools documentation re-org.
Separate logging and i18n docs and functions into separate sections of the
generated documentation. This means moving a function to a different header
file, so some '#include's had to be added around the place.
VMware, Inc [Tue, 28 Jun 2011 18:55:42 +0000 (11:55 -0700)]
Unity/X11: Clear tools.capability.unity in response to X I/O errors.
Summary:
desktopEvents:
- No longer reloading self in X I/O error handler.
- Emitting GLib signal prior to shutting down RPC channel.
unity:
- Attach to new XIOError signal a callback which clears the Unity
capability.
Long version:
In response to an X I/O error, cleanup of the vmtoolsd container is
kinda hard. From the plugin providing the X I/O error handler, we
can't directly call the cleanup routines, and even if we could,
there's nothing to prevent any of them from attempting additional
X calls during cleanup, bringing us back to square 1.
For the most part, this lameness hasn't caused any serious problems.
One annoyance, however, is that if our user was in Unity mode at the
time, vmusr's untimely termination wouldn't inform the host UI that
vmusr was on its way out, leaving the host UI believing it should
remain in Unity mode.
While we can't perform a full, correct cleanup, we can at least undo
a few small critical things, such as saying, "Hey, host UI. Please
to be doing the needful and bumping us out of Unity now, kthx." This
is accomplished by a) emitting a GLib signal in the XIO error handler,
and b) connecting that to a Unity plugin callback which clears the
capability.
Brownie points: I got rid of the dumb call to Reload_Do that I was
responsible for years ago. There really isn't a good reason for an
X client to restart itself in response to an X I/O error, so let's
just stop, yeah?
VMware, Inc [Tue, 28 Jun 2011 18:47:41 +0000 (11:47 -0700)]
vmtoolsd: separate loading and initializing plugins.
Currently the code that loads the plugins also initializes them right
away. This is undesired when using appLoader, since in the process of
figuring out dependencies, it may fork the process again and cause
the same plugin to be initialized multiple times.
This doesn't cause any issues other than a few (one time) memory leaks
and wasted work, but it's better to avoid this.
VMware, Inc [Tue, 28 Jun 2011 17:57:36 +0000 (10:57 -0700)]
Make RpcChannel_Start() idempotent.
The code wasn't well behaved if RpcChannel_Start was called multiple
times. Since there's no way to know whether the channel has been
started, just make subsequent calls do nothing.
VMware, Inc [Tue, 28 Jun 2011 17:56:10 +0000 (10:56 -0700)]
IOLockAlloc can fail (according to the documentation). We should handle the errors gracefully.
We use IOLockAlloc() to allocate locks on VMCI on OS X.
But we assume the function always succeeds when in reality
it is allowed to fail and return NULL. Fixed so that
we check this.
VMware, Inc [Tue, 28 Jun 2011 17:55:37 +0000 (10:55 -0700)]
Fix unescaping of character sequences when it should not
The HGFS server when reading directory entries checks for
an escape character sequence and if found unescapes it before
sending the entry to the HGFS client. However, if the sequence
happens to be one generated by a user legitimately on the host
and not because the HGFS server found an illegal character, the
unescape mechanism has no way to tell and currently does more
undo operations than the escape. This leads to some file
names being mistranslated and therefore inaccessible e.g.
Here is an overview of the current scheme as best I could tell.
The escape character is the percent.
The character to escape the escape character is the right square
parenthesis.
Escape looks for the following characters or sequences:
platform illegal char -> platform substitute char and '%'
']%' - > ']]%'
platform substitute char and '%' -> substitute char and ']%'
Windows reserved names or ending with a period
Currently the unescaping code checks for the ']%' character
sequence resulting from item 2 or 3 above is preceded by a
character to replace an illegal one from a client. The code
simply assumes the preceding character is of the right type,
and so modifies the string.
A file "@]%.txt" on the host is unescaped in a directory read to
the client as "@%.txt" where the client will escape it again if
required. When a client application tries to open the file, the
HGFS client returns the "@%.txt" to the host HGFS server. There
the escape mechanism for Linux/OSX does not see this as a
sequence requiring escaping as the '@' is not a substitute
character. This means the file name is not the same as the original
on the host and it either fails to open or the server will create
a new file with the modified name.
The escape undo code now only strips out the escape-escape character
if it is preceded by the same character or a platform substitute
character (i.e. a sequence that the escape mechanism generated).
VMware, Inc [Tue, 28 Jun 2011 17:49:19 +0000 (10:49 -0700)]
Switch to Super User if futimes() fail.
Even if the userid of the VMX process matches the userid of the file
residing on the file system, futimes fails in few scenarios. In such
case, we should switch to superuser and try one more time.
VMware, Inc [Sat, 28 May 2011 20:18:55 +0000 (13:18 -0700)]
Fix race condition when disabling shared folders.
HGFS server must stop generating change directory notifications
before releasing objects that notification delivery code may use.
Moving call to stop notifications before invoking HgfsInvalidateSessionObjects
instead of doing it at the very end of session deleting sequence.
VMware, Inc [Sat, 28 May 2011 20:17:42 +0000 (13:17 -0700)]
Refreshing list of shared folders.
MacOS keeps root directory opened indefinitly. When guest enumerates
shared folders HGFS server always returns cached entries. As a result if shared folders
configuration is change this change is not reflected in the guest.
The short term solution is to refresh list of shared folders every time when
reading the first directory entry in the root directory.
In the long term we need to stop caching directory entries in HGFS server since it is
almost impossible to keep cahced entrie list consistent with underlying file system.
File systems has support to resume directory enumeration from a arbitrary point
and HGFS server should use this feature to handle searchRead requests.
VMware, Inc [Sat, 28 May 2011 20:14:16 +0000 (13:14 -0700)]
Cleanup some tools log messages.
(i) demote Log() to "info" level.
Lots of places in our internal code use Log() to report uninteresting things.
Having "message" as the mapping for Log() means our default configuration on
non-release builds will spit out all those messages to syslog / event log.
(ii) Demote some log entries in vmtoolsd and plugins.
These shouldn't really be logged by default, since they may show up in
normal operation. Leave "g_message" for less serious errors only, and
move "status report"-type messages to the info level.
It refers to a XSMP session manager client ID which shouldn't be
passed to children. Having this environment variable breaks launching
nautilus w/o arguments. (Aside, GNOME fixed this upstream in response to
https://bugzilla.gnome.org/show_bug.cgi?id=649063.)
VMware, Inc [Sat, 28 May 2011 20:09:58 +0000 (13:09 -0700)]
Make the rpc channel reset check a high priority task.
The reset check is an "idle" task, whose default priority is
G_PRIORITY_DEFAULT_IDLE. That's lower than the default timeout
priority (G_PRIORITY_DEFAULT), so when dispatching the glib main
loop will give priority to the timeout sources being triggered;
since we're servicing RPCs, this means that the idle task will
never run until the host stops sending RPCs. So the guest apps
will see the "reset" way later than they should.
So make the idle task's priority be higher than the rpc channel's
timeout source's priority, to make sure it executes first.
VMware, Inc [Sat, 28 May 2011 19:56:50 +0000 (12:56 -0700)]
shutdownDgramTest fails for ubuntu9 guest
We fixed shutdown() recently so that it kicks DGRAM sockets
even if they are unconnected. But to be truly consistent
with UDP, we should still return an error if they are
unconnected. Fixed so that we kick the socket and
then fail.
VMware, Inc [Sat, 28 May 2011 19:56:22 +0000 (12:56 -0700)]
Make PAM files to use relative paths
Ever since we started using PAM we have been using FQ paths instead
of relative paths. This works but is apparently unnecessary. Now
that Ubuntu 11.04 moved modules around, the FQ paths no longer work.
So instead use only relative paths.
VMware, Inc [Sat, 28 May 2011 19:52:58 +0000 (12:52 -0700)]
lib/string: BSD vsnprintf improvements
We found a printf test suite and our BSD printf did OK but
had a few problems. Several of the problems occurred in the
floating point area, handling zeros, INF, -INF and NAN.
VMware, Inc [Sat, 28 May 2011 19:51:41 +0000 (12:51 -0700)]
Fix saving MS Project files in a folder on a NFS server
The files appeared as read only because the set attributes
call to update the file modification time was failing.
This occurred due to the Posix HGFS server switching to
running as super user when updating the file timestamps by
calling futimes. This was done if the VMX was the file owner
or running as root. This is okay for local file systems but
not for network shares. In this case the VMX was indeed the
file owner and so switching to super user was not necessary.
Fix is to not switch to super user if the VMX is the file
owner.