php / php-sdk-binary-tools

Tool kit for building PHP under Windows
BSD 2-Clause "Simplified" License
87 stars 33 forks source link

Windows permissions incorrect after clean clone of repository #23

Closed gwharton closed 1 month ago

gwharton commented 1 month ago

Clone repository Try to launch phpsdk-vs17-x64.bat (or any batch file)

image

graham@DESKTOP-IAGIISG ~/php-sdk-binary-tools
$ ./phpsdk-vs17-x64.bat
bash: ./phpsdk-vs17-x64.bat: Permission denied

graham@DESKTOP-IAGIISG ~/php-sdk-binary-tools
$ icacls phpsdk-vs17-x64.bat 
phpsdk-vs17-x64.bat NULL SID:(DENY)(Rc,X,DC)
                    DESKTOP-IAGIISG\graham:(R,W,D,WDAC,WO)
                    NT AUTHORITY\SYSTEM:(DENY)(X)
                    BUILTIN\Administrators:(DENY)(X)
                    DESKTOP-IAGIISG\None:(R)
                    NT AUTHORITY\SYSTEM:(RX,W)
                    BUILTIN\Administrators:(RX,W)
                    Everyone:(R)

Successfully processed 1 files; Failed processing 0 files

graham@DESKTOP-IAGIISG ~/php-sdk-binary-tools
$ icacls "*" /q /c /t /reset
Successfully processed 384 files; Failed processing 0 files

graham@DESKTOP-IAGIISG ~/php-sdk-binary-tools
$ icacls phpsdk-vs17-x64.bat 
phpsdk-vs17-x64.bat NULL SID:(I)(DENY)(Rc,REA,X,DC)
                    DESKTOP-IAGIISG\graham:(I)(F)
                    DESKTOP-IAGIISG\None:(I)(RX)
                    NT AUTHORITY\SYSTEM:(I)(RX,W,DC)
                    BUILTIN\Administrators:(I)(RX,W,DC)
                    Everyone:(I)(RX)

Successfully processed 1 files; Failed processing 0 files

graham@DESKTOP-IAGIISG ~/php-sdk-binary-tools
$ ./phpsdk-vs17-x64.bat
[vcvarsall.bat] Environment initialized for: 'x64'

PHP SDK 2.3.1-dev

OS architecture:    x64 
Build architecture: x64
Visual C++:         14.41.34120.0
PHP-SDK path:       C:\Users\GrahamWharton\php-sdk-binary-tools

C:\Users\GrahamWharton\php-sdk-binary-tools

I can now use the SDK after resetting permissions.

cmb69 commented 1 month ago

It never occured to me to want to install the PHP SDK binary tools in a users home directory, but yeah, why not. I wonder whether this permission issue would already happen on Windows 10 (or even older systems), or whether this is a Windows 11 only thing. Is it even a default setting?

Anyway, the only thing we could do is to mark relevant files as executable in the repo. Would that solve the issue for you?

Other than that, we could only document that this may need to be done (or maybe add a respective script which changes the execution permissions, but then again, that script would need to have appropriate permissions in the first place).

gwharton commented 1 month ago

This is just an annoyance really, raised in haste. If i clone the repo i get permissions errors, but if I download the zip and extract it, everything is fine. I'm gonna close this as its so easy to get around, but maybe having the executable bits set on the batch files may not hurt?????

cmb69 commented 1 month ago

[…], but maybe having the executable bits set on the batch files may not hurt?????

No, of course not. Can you please try #24 (that may not be sufficent, but at least a start)?

gwharton commented 1 month ago

Your branch helps, I can now run the batch file after a clean clone, but the batch file still errors due to also needing

chmod 755 bin/.exe chmod 755 bin/.bat chmod 755 bin/php/do_php.bat chmod 755 bin/php/php.exe

Maybe also the msys2 stuff, but I have cygwin installed, so maybe those aren't used on my setup.

If I make all the above changes, the SDK initialises with a single click from explorer on the relevant starter batch file no problems. If you update your branch, I'll test again if you like.

cmb69 commented 1 month ago

Thank you for checking.

I've updated the PR now (and included the msys2/usr/bin/*exe files right away).

cmb69 commented 1 month ago

[…], but I have cygwin installed, so maybe those aren't used on my setup.

Ah, that could be the reason for the behavior. :)

Anyway, if you have time, please test again.

gwharton commented 1 month ago

Yep, your latest commit to cmb/perms branch fixes everything for me.

cmb69 commented 1 month ago

Thank you! I have just merged that PR.