MSYS2 permissions

2

In Windows 10, with MSYS2 I set my fstab to:

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

I am unable to set execute permissions with chmod, despite having acl set in the fstab:

# echo > foo
# ls -l foo                              
-rw-r--r-- 1 ant None 1 Jun  1 19:18 foo 
# chmod +x foo
# ls -l foo                              
-rw-r--r-- 1 ant None 1 Jun  1 19:18 foo

In Cygwin, setting the same fstab, for the same file I get:

# ls -l foo                                         
-rwxrwx---+ 1 ant None 1 Jun  1 19:18 foo        

which is the expected behaviour.

antonio

Posted 2016-06-01T17:39:54.127

Reputation: 647

cygwin has it's own fstab. What makes you think the output should be the same? – DavidPostill – 2016-06-01T17:50:11.823

@DavidPostill: I clarified that it is the same. Anyway, contrary to Cygwin, MSYS2 uses noacl by default, that is why I originally stressed only the first fstab. – antonio – 2016-06-02T09:32:44.447

Cygwin knows how to map SIDs correctly (see POSIX accounts, permission, and security). Does MSYS2 have the same functionality?

– DavidPostill – 2016-06-02T09:38:26.853

See this open ticket #60 chmod being ignored: "Status: open"

– DavidPostill – 2016-06-02T09:46:43.570

And this one #158 issues with chmod and fstab: "Status: wont-fix"

– DavidPostill – 2016-06-02T09:50:36.583

As an aside, shouldn't your command be chmod +x foo? – DavidPostill – 2016-06-02T09:51:06.177

@DavidPostill: sorry just a typo: fixed +x – antonio – 2016-06-02T10:00:54.403

@DavidPostill: I actually read the wont-fix thread on SF before posting here. It seems that the actual problem there is not with permissions, but with wrong libraries. In the same thread a MSYS2 developer says "chmod works for me when I re-mount without noacl.". He restates the same here. As an extra test, I tried also totally removing the acl option, without success.

– antonio – 2016-06-02T10:19:17.623

Answers

2

Ok, I've wasted quite a bit of time on this, so let me capture my findings:

Changing fstab helps but you must chmod the file via a path that goes through the mount point. In other words:

mkdir /c/test # Outside MSYS2 root (/).
cd /c/test
touch foo
chmod +x foo # works but presumably won't if inside MSYS root.
chmod +x /c/test/foo # works and presumably will if inside MSYS root.
chmod +x c:\test\foo # does not work -- go figure.

Pretty brain-dead, if you ask my humble opinion. And the solution seems pretty simple: change from noacl to acl on all default MSYS2 mounts (the MSYS2 root mount is created automatically and there is no way to change to acl from fstab -- correction: supposedly possible with the override mount option).

Boris Kolpackov

Posted 2016-06-01T17:39:54.127

Reputation: 136

c:\test\foo # does not work is probably because MSYS2 bash interprets the backslash as escape character, and so \t becomes a TAB character. – sdbbs – 2019-12-03T15:29:08.160