PGTS PGTS Pty. Ltd.   ACN: 007 008 568

point Site Navigation

point Other Blog Threads



  Valid HTML 4.01 Transitional

   Stop Spam! Stop Viruses!
   Secure And Reliable Ubuntu Desktop!

   Ubuntu

   If you own a netbook/laptop~
   Download Ubuntu Netbook!






PGTS Humble Blog

Thread: Tips/Tricks For Programming etc

Author Image Gerry Patterson. The world's most humble blogger
Edited and endorsed by PGTS, Home of the world's most humble blogger

Upgrading To Cygwin 1.7


Chronogical Blog Entries:



Date: Thu, 11 Mar 2010 22:18:33 +1100

Version 1.7 of cygwin has a number of significant changes. When you install it, a little window pops up warning you that it is a "major" release. In not so many words the message implies that you should expect trouble ... And the warning should be heeded. There are several things that can make cygwin 1.7 somewhat less than a smooth and painless upgrade.

On the purely "annoying" front is the little message that is printed in the console when an MS-DOS style path is first encountered. It looks something like this:

cygwin warning:
  MS-DOS style path detected: c:/foo
  Preferred POSIX equivalent is: /cygdrive/c/foo
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames

The grammar in that message is a little imprecise. And if you make the same mistake as I did, you might waste some time trying to add lines to your .bash_profile which attempt to use the environment variables "nodosfilewarning" and/or "CYGWIN" etc. ... But it will all be to no avail!

After scratching my head for a little while, I recalled encountering a Windows environment variable %cygwin%, in a previous incarnation of cygwin. I used to set it to some value in order to modify the behaviour with NTFS and FAT files. The variable had to be set in the grand master script ... cygwin.bat which launches the cygwin shell. If you use a stock standard release with the default pathnames this script will be called C:\cygwin\cygwin.bat. You can edit it with vi as "/cygwin.bat". To turn off those annoying little warnings you need to add a line such as the following, to your cygwin.bat file:

set CYGWIN=nodosfilewarning

Or if you have admin access to your windows workstation, add it to the system environment variables in "My Computer" ... Note: Additional options can be added to the CYGWIN environment variable separated by spaces. There are new options for 1.7 and a few old options have been dropped. And of course, it is all documented. If you want to read more about the CYGWIN environment variable, go to the web page at: http://www.cygwin.com/cygwin-ug-net/using-cygwinenv.html, which is more useful than the URL quoted in the warning message above.

However, more serious than "just annoying" are the problems with "permissions". These really can be show-stoppers if you have lots of applications written as scripts for bash, perl and/or other Unix like shells.

For example, you may find that cygwin 1.7 reports that you don't have permission to copy, move, delete or modify a file when you know for a fact that you really do have permission to carry out the operation! This is especially the case if you have windows shares in the mix. It is very worrying if you have a lot of perl scripts that use the "File::Copy" module. "Copy" and "Move" commands in these scripts might suddenly and inexplicably fail. Some bash commands might (sort of) work but generate errors or warnings which go to STDERR, or they may just fail altogether.

When I first encountered these problems, they were so severe that I contemplated trying to roll-back the upgrade -- Even though I had only installed it on a TEST instance. Then I decided to calm down, take a few deep breaths and do a little investigation and RTFM.

As it turns out, it is not as bad as it first seems. It is possible to upgrade to 1.7 without re-writing all those hundreds of scripts to be POSIX compliant ... Also it is a good idea to upgrade, because Microsoft is continually rolling out updates. As we all know (or at least suspect) those updates aren't all for the benefit of the poorly informed, mooing microsoft herd. ... Many of the changes are just gratuitous, frivolous and or totally unnecessary frills crafted to introduce subtle incompatibilities with previous versions of their own product or anything generated by another operating system (especially Linux) ... But they keep on coming, nevertheless ... So, if your windows team is being diligent about applying patches, it is a good idea to keep your cygwin distribution up to date ... Otherwise your carefully crafted cygwin application could become a lonely island in an unfriendly updated neighbourhood, with a rough road to compatibility.

Here is a list of things that will help navigate the rocky road of cygwin, permissions and ACLs:

It will be worth it. Cygwin 1.7 has a lot of bug fixes and improvements. And, as usual, the whole package is tightly integrated. It is much easier to go with the flow and keep the whole distribution up to date.


Other Blog Posts In This Thread:

Copyright     2010, Gerry Patterson. All Rights Reserved.