25 September, 2010

Fixing the Cygwin ACL Problem

Cygwin is always one of the best tools for me. It provide an emulated *nix like environment include a shell environment, POSIX path, etc. Of all the emulation provided, however, the POSIX-like permission is the only thing I am not appreciated.

The purpose of permission and ACL is for controlling access of files under a multi-user environment. Whilst it will be useful for running network services, it is pointless for most development use cases. Files are mostly accessed by only one user, that is me!

When Cygwin is emulating POSIX permission using Windows ACL, it can easily caused undesirable trouble when one is trying to access the files from both Cygwin environment and ordinary Windows based tools. To get rid of this, Cygwin provided means for disabling this. Unfortunately, the mechanism is different between 1.5.x and 1.7x. And this can even more frustrating when you are trying to upgrade from 1.5.x to 1.7.x.

All the details below can be found on Cygwin manual. But it may take sometimes to dig it out even with the help of google. So, here we go!

For version prior to 1.7, the method is setting the following environment variable:

    CYGWIN=nontsec

Since 1.7, the method is setting 'noacl' as part of the mount point options in fstab. You should have a line like this:

    none /cygdrive cygdrive noacl,binary,posix=0,user 0 0

Note that, no extra entries should present for all mount point which can be mount up automatically.

For upgrading from 1.5 to 1.7, you should also clean up the mount point defined in the registry. From Cygwin 1.7, registry is only used for defining the installation directory of Cygwin itself.
When in doubt, use cygcheck to have a look, which can shows the mount point configuration inherited from registry.

No comments: