No Code Attached Yet J3 Issue
avatar mschop
mschop
4 Dec 2018

Hi all,

the Windows Sub System for Linux provides the files from Windows with the file permissions 777 to the Linux running under WSL because the linux file permissions are not translatable to the windows file permissions. Therefore all chmod operations are ignored.

The deinstallation routine for plugins and themes are using the the Method File::canChmod(...) for figuring out, whether the file is writable (libraries/vendor/joomla/filesystem/src/File.php:124).

Instead of File::canChmod, the PHP built in method "is_writable" should be used. This function is working as expected in this case.

Best Restards
mschop

avatar mschop mschop - open - 4 Dec 2018
avatar joomla-cms-bot joomla-cms-bot - labeled - 4 Dec 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Mar 2019
Status New Information Required
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 4 Mar 2019

@HLeithner can you please comment as this is about 3.9?

avatar HLeithner
HLeithner - comment - 4 Mar 2019

I don't have WSL so I can't test it, but there seams to be a reason why the delete function does such things.

It also tries to chmod because other windows versions seams to fail.

maybe @mbabker can explain it or has a suggestion?

avatar mbabker
mbabker - comment - 4 Mar 2019

Not a clue. Haven't run PHP on Windows since 2013.

https://github.com/joomla-framework/filesystem has a decent suite of unit tests in place these days, and runs on AppVeyor (so there is Windows coverage). Creating a reproducible test case there would help. FWIW, I do think the check is valid because the next line after that is a (error suppressed) call to chmod(), so checking the file can actually be changed before executing seems correct (FWIW the chmod() call predates my involvement with Joomla, the canChmod() check is relatively newer from when a concentrated effort to test the package was started, so good luck deducing why it was originally deemed necessary in the first place).

avatar mbabker
mbabker - comment - 4 Mar 2019

Since I have a few minutes while a test suite finishes up...

avatar HLeithner
HLeithner - comment - 4 Mar 2019

ok the chmod makes sense but why is the if check before?

iirc for deleting file you don't need write permissions to the file you need it to the folder (at least under linux) so the chmod makes no sense under linux only under windows.

I think the problem is for filesystems that can't handle unix permission system so ftp or samba wrapper could have the same problem?

avatar mbabker
mbabker - comment - 4 Mar 2019

You'd have to ask Achal when he added the tests why he added the check as well, but this is a 5-year-old thing so good luck with that type of memory. The check makes sense to ensure you can actually do the thing before you actually do it, so I don't think removing it is the right course of action here without also handling the function having an error, which has never been done in the history of the API.

The comment above the chmod() call explains the issue for Windows environments. With that said, I would be very hesitant to support a PR changing any part of the filesystem API to introduce OS specific behaviors.

avatar HLeithner
HLeithner - comment - 4 Mar 2019

So microsoft should fix there filesystem? Could be hard to achieve ;-)

So is_writable may solve both problems... could be done for V2 of the framework?

avatar mbabker
mbabker - comment - 4 Mar 2019

Anything's possible. Just please provide adequate tests one way or another. PHP and filesystem logic has changed a bit in the last decade and a lot of the Joomla filesystem code has gone untouched in that time, maybe things needed in 2007 aren't as necessary in 2019 or there's a better way to do it.

avatar HLeithner
HLeithner - comment - 4 Mar 2019

Yeah thats true, maybe someone of @joomla/automated-testing-admin could help building an WSL testing setup.

avatar franz-wohlkoenig franz-wohlkoenig - change - 16 Mar 2019
Status Information Required Discussion
avatar franz-wohlkoenig franz-wohlkoenig - change - 28 Mar 2019
Category Code style
avatar franz-wohlkoenig franz-wohlkoenig - unlabeled - 4 Apr 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Apr 2019
Labels Added: J3 Issue
avatar franz-wohlkoenig franz-wohlkoenig - labeled - 4 Apr 2019
avatar orlitzky
orlitzky - comment - 6 Apr 2019

This is the same thing as issue 23504. Someone who doesn't understand filesystem permissions introduced a check that doesn't do what he thinks it does. Being able to chmod has nothing to do with being able to delete.

avatar franz-wohlkoenig franz-wohlkoenig - change - 7 Apr 2019
Labels Added: ?
avatar franz-wohlkoenig franz-wohlkoenig - labeled - 7 Apr 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 9 Apr 2019
Category Code style
avatar jwaisner jwaisner - change - 17 Apr 2020
Status Discussion Confirmed
avatar Quy Quy - change - 16 Feb 2022
Labels Added: No Code Attached Yet
Removed: ? ?
avatar Quy Quy - unlabeled - 16 Feb 2022
avatar brianteeman
brianteeman - comment - 25 Aug 2022

@HLeithner same request as made in #23504

avatar chmst chmst - change - 12 Nov 2022
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2022-11-12 11:32:45
Closed_By chmst
avatar chmst chmst - close - 12 Nov 2022
avatar chmst
chmst - comment - 12 Nov 2022

Closing as duplicate for #23504

Add a Comment

Login with GitHub to post a comment