bash /cmd disagree about owner and permissions to executable

Enrique Perez-Terron enrique@perezterron.net
Mon Dec 30 03:37:00 GMT 2019


Den 2019-12-26 22:00, skrev Andrey Repin:
> Greetings, Enrique Perez-Terron!
Thanks.
[snip]
> Problem reports:       http://cygwin.com/problems.html
See attached cygcheck.out, unaltered.

> In particular, show "mount" output and check that you don't have
> /etc/{passwd,group} files

Heidi@panter ~
$ mount
C:/cygwin64/bin on /usr/bin type ntfs (binary,auto)
C:/cygwin64/lib on /usr/lib type ntfs (binary,auto)
C:/cygwin64 on / type ntfs (binary,auto)
C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)

Heidi@panter ~
$ /bin/ls -ld /etc/{passwd,group}
/bin/ls: klarte ikke å åpne '/etc/passwd': No such file or directory
/bin/ls: klarte ikke å åpne '/etc/group': No such file or directory

("klarte ikke å åpne" = "Could not open")

Looking around for other symptoms/non-symptoms

Heidi@panter ~
$ cmd /C 'dir /Q C:\Users\Heidi\AppData\Local\Microsoft\WindowsApps'
  Volume in drive C is Acer
  Volume Serial Number is 3A2C-1A76

  Directory of C:\Users\Heidi\AppData\Local\Microsoft\WindowsApps

26.12.2019  19.18    <DIR>          PANTER\Heidi           Backup
13.12.2019  22.52                 0 PANTER\Heidi           excel.exe
13.12.2019  14.28                 0 PANTER\Heidi           
GameBarElevatedFT_Alias.exe
26.12.2019  19.25                 0 PANTER\Heidi           idle.exe
26.12.2019  19.25                 0 PANTER\Heidi           idle3.8.exe
26.12.2019  19.25                 0 PANTER\Heidi           idle3.exe
12.11.2019  20.45    <DIR>          PANTER\Heidi           
Microsoft.MicrosoftEdge_8wekyb3d8bbwe
13.12.2019  22.52    <DIR>          PANTER\Heidi           
Microsoft.Office.Desktop_8wekyb3d8bbwe
13.12.2019  14.28    <DIR>          PANTER\Heidi           
Microsoft.XboxGamingOverlay_8wekyb3d8bbwe
12.11.2019  20.45                 0 PANTER\Heidi           
MicrosoftEdge.exe
13.12.2019  22.52                 0 PANTER\Heidi           msaccess.exe
13.12.2019  22.52                 0 PANTER\Heidi           msosync.exe
13.12.2019  22.52                 0 PANTER\Heidi           msouc.exe
13.12.2019  22.52                 0 PANTER\Heidi           msoxmled.exe
13.12.2019  22.52                 0 PANTER\Heidi           mspub.exe
13.12.2019  22.52                 0 PANTER\Heidi           outlook.exe
26.12.2019  19.25                 0 PANTER\Heidi           pip.exe
26.12.2019  19.25                 0 PANTER\Heidi           pip3.8.exe
26.12.2019  19.25                 0 PANTER\Heidi           pip3.exe
13.12.2019  22.52                 0 PANTER\Heidi           powerpnt.exe
13.12.2019  22.52                 0 PANTER\Heidi           
protocolhandler.exe
26.12.2019  19.25                 0 PANTER\Heidi           python.exe
26.12.2019  19.25                 0 PANTER\Heidi           python3.8.exe
26.12.2019  19.25                 0 PANTER\Heidi           python3.exe
26.12.2019  19.25    <DIR>          PANTER\Heidi           
PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0
26.12.2019  19.25                 0 PANTER\Heidi           pythonw.exe
26.12.2019  19.25                 0 PANTER\Heidi           
pythonw3.8.exe
26.12.2019  19.25                 0 PANTER\Heidi           pythonw3.exe
13.12.2019  22.52                 0 PANTER\Heidi           sdxhelper.exe
13.12.2019  22.52                 0 PANTER\Heidi           selfcert.exe
13.12.2019  22.52                 0 PANTER\Heidi           winword.exe
               26 File(s)              0 bytes
                5 Dir(s)  156 728 102 912 bytes free

Heidi@panter ~
$ ls -l /cygdrive/c/Users/Heidi/AppData/Local/Microsoft/WindowsApps
totalt 12K
drwx------+ 1 Heidi        Ingen         0 des 26 19:18 Backup/
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 13 22:52 excel.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 13 14:28 
GameBarElevatedFT_Alias.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 26 19:25 idle.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 26 19:25 idle3.8.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 26 19:25 idle3.exe*
drwx------+ 1 Heidi        Ingen         0 nov 12 20:45 
Microsoft.MicrosoftEdge_8wekyb3d8bbwe/
drwx------+ 1 Heidi        Ingen         0 des 13 22:52 
Microsoft.Office.Desktop_8wekyb3d8bbwe/
drwx------+ 1 Heidi        Ingen         0 des 13 14:28 
Microsoft.XboxGamingOverlay_8wekyb3d8bbwe/
-rwxr-x---  1 Unknown+User Unknown+Group 0 nov 12 20:45 
MicrosoftEdge.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 13 22:52 msaccess.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 13 22:52 msosync.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 13 22:52 msouc.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 13 22:52 msoxmled.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 13 22:52 mspub.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 13 22:52 outlook.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 26 19:25 pip.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 26 19:25 pip3.8.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 26 19:25 pip3.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 13 22:52 powerpnt.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 13 22:52 
protocolhandler.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 26 19:25 python.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 26 19:25 python3.8.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 26 19:25 python3.exe*
drwx------+ 1 Heidi        Ingen         0 des 26 19:25 
PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0/
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 26 19:25 pythonw.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 26 19:25 pythonw3.8.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 26 19:25 pythonw3.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 13 22:52 sdxhelper.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 13 22:52 selfcert.exe*
-rwxr-x---  1 Unknown+User Unknown+Group 0 des 13 22:52 winword.exe*

I suspect it's Windows 10 playing some games. Are the files here some 
kind of junctions/symbolic links?
Why do all the files have zero bytes?

Heidi@panter ~
$ cmd /C 'dir /A C:\Users\Heidi\AppData\Local\Microsoft\WindowsApps'
  Volume in drive C is Acer
  Volume Serial Number is 3A2C-1A76

  Directory of C:\Users\Heidi\AppData\Local\Microsoft\WindowsApps

26.12.2019  19.25    <DIR>          .
26.12.2019  19.25    <DIR>          ..
26.12.2019  19.18    <DIR>          Backup
13.12.2019  22.52                 0 excel.exe
13.12.2019  14.28                 0 GameBarElevatedFT_Alias.exe
26.12.2019  19.25                 0 idle.exe
26.12.2019  19.25                 0 idle3.8.exe
26.12.2019  19.25                 0 idle3.exe
12.11.2019  20.45    <DIR>          
Microsoft.MicrosoftEdge_8wekyb3d8bbwe
13.12.2019  22.52    <DIR>          
Microsoft.Office.Desktop_8wekyb3d8bbwe
13.12.2019  14.28    <DIR>          
Microsoft.XboxGamingOverlay_8wekyb3d8bbwe
12.11.2019  20.45                 0 MicrosoftEdge.exe
13.12.2019  22.52                 0 msaccess.exe
13.12.2019  22.52                 0 msosync.exe
13.12.2019  22.52                 0 msouc.exe
13.12.2019  22.52                 0 msoxmled.exe
13.12.2019  22.52                 0 mspub.exe
13.12.2019  22.52                 0 outlook.exe
26.12.2019  19.25                 0 pip.exe
26.12.2019  19.25                 0 pip3.8.exe
26.12.2019  19.25                 0 pip3.exe
13.12.2019  22.52                 0 powerpnt.exe
13.12.2019  22.52                 0 protocolhandler.exe
26.12.2019  19.25                 0 python.exe
26.12.2019  19.25                 0 python3.8.exe
26.12.2019  19.25                 0 python3.exe
26.12.2019  19.25    <DIR>          
PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0
26.12.2019  19.25                 0 pythonw.exe
26.12.2019  19.25                 0 pythonw3.8.exe
26.12.2019  19.25                 0 pythonw3.exe
13.12.2019  22.52                 0 sdxhelper.exe
13.12.2019  22.52                 0 selfcert.exe
13.12.2019  22.52                 0 winword.exe
               26 File(s)              0 bytes
                7 Dir(s)  156 728 201 216 bytes free

I'm not sure if DIR /A is reliable in this context. A different 
approach:

Heidi@panter ~
$ locate python3.8.exe | xargs -d '\n' /bin/ls -l
-rwxrwx---+ 1 SYSTEM       SYSTEM        226888 des 26 19:25 
'/cygdrive/c/Program 
Files/WindowsApps/PythonSoftwareFoundation.Python.3.8_3.8.496.0_x64__qbz5n2kfra8p0/python3.8.exe'
-rwxr-x---  1 Unknown+User Unknown+Group      0 des 26 19:25  
/cygdrive/c/Users/Heidi/AppData/Local/Microsoft/WindowsApps/python3.8.exe
-rwxr-x---  1 Unknown+User Unknown+Group      0 des 26 19:25  
/cygdrive/c/Users/Heidi/AppData/Local/Microsoft/WindowsApps/PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0/python3.8.exe

So here is finally a file with a positive byte count.

Heidi@panter ~
$ ls -l '/cygdrive/c/Program Files/WindowsApps'
ls: klarte ikke å åpne mappa '/cygdrive/c/Program Files/WindowsApps': 
Permission denied

(Could not open the folder ...)

Running mintty as Administrator, I do get...
[snip many other directories, a few owned by TrustedInstaller, most by 
SYSTEM]
drwxrwx---+ 1 SYSTEM                      SYSTEM                      0 
des 26 19:25 
PythonSoftwareFoundation.Python.3.8_3.8.496.0_x64__qbz5n2kfra8p0/
[snip]

Yet it does not work to run python in the elevated bash.

This python was installed using Microsoft Store. I will probably have to 
revert to the regular download from python.org
However, it remains interesting that I can run this python from an 
un-elevated cmd, not from mintty/bash, not even if elevated.

Update: I tried this in an elevated mintty/bash:

Heidi@panter ~
$ fsutil.exe reparsepoint query 
'C:\Users\Heidi\AppData\Local\Microsoft\WindowsApps\python3.exe'
Reparse Tag Value : 0x8000001b
Tag value: Microsoft

Reparse Data Length: 0x000001b6
Reparse Data:
0000:  03 00 00 00 50 00 79 00  74 00 68 00 6f 00 6e 00  
....P.y.t.h.o.n.
0010:  53 00 6f 00 66 00 74 00  77 00 61 00 72 00 65 00  
S.o.f.t.w.a.r.e.
0020:  46 00 6f 00 75 00 6e 00  64 00 61 00 74 00 69 00  
F.o.u.n.d.a.t.i.
0030:  6f 00 6e 00 2e 00 50 00  79 00 74 00 68 00 6f 00  
o.n...P.y.t.h.o.
0040:  6e 00 2e 00 33 00 2e 00  38 00 5f 00 71 00 62 00  
n...3...8._.q.b.
0050:  7a 00 35 00 6e 00 32 00  6b 00 66 00 72 00 61 00  
z.5.n.2.k.f.r.a.
0060:  38 00 70 00 30 00 00 00  50 00 79 00 74 00 68 00  
8.p.0...P.y.t.h.
0070:  6f 00 6e 00 53 00 6f 00  66 00 74 00 77 00 61 00  
o.n.S.o.f.t.w.a.
0080:  72 00 65 00 46 00 6f 00  75 00 6e 00 64 00 61 00  
r.e.F.o.u.n.d.a.
0090:  74 00 69 00 6f 00 6e 00  2e 00 50 00 79 00 74 00  
t.i.o.n...P.y.t.
00a0:  68 00 6f 00 6e 00 2e 00  33 00 2e 00 38 00 5f 00  
h.o.n...3...8._.
00b0:  71 00 62 00 7a 00 35 00  6e 00 32 00 6b 00 66 00  
q.b.z.5.n.2.k.f.
00c0:  72 00 61 00 38 00 70 00  30 00 21 00 50 00 79 00  
r.a.8.p.0.!.P.y.
00d0:  74 00 68 00 6f 00 6e 00  00 00 43 00 3a 00 5c 00  
t.h.o.n...C.:.\.
00e0:  50 00 72 00 6f 00 67 00  72 00 61 00 6d 00 20 00  P.r.o.g.r.a.m. 
.
00f0:  46 00 69 00 6c 00 65 00  73 00 5c 00 57 00 69 00  
F.i.l.e.s.\.W.i.
0100:  6e 00 64 00 6f 00 77 00  73 00 41 00 70 00 70 00  
n.d.o.w.s.A.p.p.
0110:  73 00 5c 00 50 00 79 00  74 00 68 00 6f 00 6e 00  
s.\.P.y.t.h.o.n.
0120:  53 00 6f 00 66 00 74 00  77 00 61 00 72 00 65 00  
S.o.f.t.w.a.r.e.
0130:  46 00 6f 00 75 00 6e 00  64 00 61 00 74 00 69 00  
F.o.u.n.d.a.t.i.
0140:  6f 00 6e 00 2e 00 50 00  79 00 74 00 68 00 6f 00  
o.n...P.y.t.h.o.
0150:  6e 00 2e 00 33 00 2e 00  38 00 5f 00 33 00 2e 00  
n...3...8._.3...
0160:  38 00 2e 00 34 00 39 00  36 00 2e 00 30 00 5f 00  
8...4.9.6...0._.
0170:  78 00 36 00 34 00 5f 00  5f 00 71 00 62 00 7a 00  
x.6.4._._.q.b.z.
0180:  35 00 6e 00 32 00 6b 00  66 00 72 00 61 00 38 00  
5.n.2.k.f.r.a.8.
0190:  70 00 30 00 5c 00 70 00  79 00 74 00 68 00 6f 00  
p.0.\.p.y.t.h.o.
01a0:  6e 00 33 00 2e 00 38 00  2e 00 65 00 78 00 65 00  
n.3...8...e.x.e.
01b0:  00 00 30 00 00 00                                 ..0...

I downloaded junction.exe from sysinternals, but...

Heidi@panter ~
$ junction 
'C:\Users\Heidi\AppData\Local\Microsoft\WindowsApps\python3.exe'

Junction v1.07 - Creates and lists directory links
Copyright (C) 2005-2016 Mark Russinovich
Sysinternals - www.sysinternals.com

C:\Users\Heidi\AppData\Local\Microsoft\WindowsApps\python3.exe: UNKNOWN 
MICROSOFT REPARSE POINT

So I did a quick perl hack:

$ fsutil.exe reparsepoint query 
'C:\Users\Heidi\AppData\Local\Microsoft\WindowsApps\python3.exe' | perl 
-ne '/^\d/ || next; for(/\b([0-9a-f]{2})\b/g) {print chr(hex($_)) if 
hex($_)>31;}'
PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0!PythonC:\Program 
Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.496.0_x64__qbz5n2kfra8p0\python3.8.exe0

Greetings from
Enrique Perez-Terron
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20191230/75cfce3e/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0xD6B3CEE5.asc
Type: application/pgp-keys
Size: 3107 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20191230/75cfce3e/attachment.bin>
-------------- next part --------------

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


More information about the Cygwin mailing list