Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In my quest to better my experience in my windows 7 environment, I have installed cygwin and have started using mintty as my command line interface tool. This has been nice and takes me back to my more productive days in working in a unix environment.

There is one annoying thing however, that I can't seem to get working correctly. Batch files (i.e. *.bat) will not auto complete on the command line, nor will they show up properly colored when ls --color is used. I've tracked this down (I think) to the fact that the bat files are showing up as rw-r--r--. I can do something like ./run_my_batch_file.bat from the command line and the batch file will properly run, but I have to type the full filename or else auto complete will not pick it up.

I did try running 'chmod 750' (as well as various other file modes) to change the batch file to sport the 'x' bit, but their mode bits did not change. I'm pretty sure that I can attribute this to the fact that I am mounting my local drives with the 'noacl' option. Here is the relevant line from my fstab:

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

I put the 'noacl' in because without it, the file mode bits seems all screwed up. Here is an example listing without the 'noacl' parameter.

-r-x------+ 1 Administrators Domain Users 209K Jul 18 16:46 some.dll
-rwx------+ 1 Administrators Domain Users 867K Aug 22 11:21 binary_filea
-rwx------+ 1 Administrators Domain Users 736K Aug 28 18:02 binary_fileb
-rwx------+ 1 Administrators Domain Users 736K Aug 28 17:43 binary_filec
-rwx------+ 1 Administrators Domain Users  14K Jan 21  2010 cache_00.bak
-r-x------+ 1 Administrators Domain Users 354K Jun  6 22:42 cdb.exe
-rwx------+ 1 Administrators Domain Users   22 Mar 14 08:05 cleanup_scratch_folder.bat
drwx------+ 1 Administrators Domain Users    0 Mar  3 14:59 code
-rwx------+ 1 Administrators Domain Users 1.8K Aug 12 14:34 config.txt
-rwx------+ 1 Administrators Domain Users   52 Aug 28 19:05 console_history
-rwx------+ 1 Administrators Domain Users 3.8M Aug 23 09:46 copy_files.bat

(note that the directory listing above is from my /cygdrive/d drive - which is a local NTFS filesystem). That seemed pretty messed up so I went with the 'noacl' mount option to get me accurate file modes for the files in my directories.

One last note - I do have the full bash completion package installed. I briefly looked to see if I could modify one of the completion packages to get at least part of what I want (which is batch file auto completion), but I didn't find anything that would be relevant there.

So my questions can I properly change the batch file file modes to include 'x' so that I can get proper bash command line completion on them (as well as get proper directory coloring on them because they are executable files). Auto-complete is more important FWIW.

Thanks.

share|improve this question
    
Believe it or not, when you mount without the noacl option, you are seeing accurate permissions. The devil is in the details. The files you show in your directory listing are all owned by group Administrators (yes, groups can be the primary owner of files in Windows). The trailing + on the permissions means that there are permissions which cannot be encoded in the classic UNIX rwxrwxrwx syntax. Those permissions are encoded in the ACL (Access Control List). You can see the full ACL for a file or directory by typing icacls FILE. –  Fran May 16 '12 at 17:49
    
FYI, the "permissions which cannot be encoded in the classic UNIX rwxrwxrwx syntax" that I refer to in my previous comment are things like the ACE granting SYSTEM full control of your files. Nothing prevents you from removing those extra permissions using the setfacl command: setfacl -s user::rw-,group::r--,other:r-- FILE The -s option to setfacl means to set the ACL to exactly what is shown, replacing the existing ACL. Cygwin's setfacl will do this by eliminating inherited ACLs. –  Fran May 28 '12 at 21:16

1 Answer 1

I'm not sure of the answer to your question, but here are a few things that might help:

  • Check that the PATHEXT environment variable includes .BAT.
  • Read about the noacl option here. It seems that you might do better to remove noacl, and spend some time getting the real permissions right.
  • Ask on the cygwin mailing list. There are many experts there who can almost certainly answer your question.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.