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
Status | New | ⇒ | Information Required |
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).
Since I have a few minutes while a test suite finishes up...
chmod()
check introduced by c02dfedok 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?
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.
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?
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.
Yeah thats true, maybe someone of @joomla/automated-testing-admin could help building an WSL testing setup.
Status | Information Required | ⇒ | Discussion |
Category | ⇒ | Code style |
Labels |
Added:
J3 Issue
|
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.
Labels |
Added:
?
|
Category | Code style | ⇒ |
Status | Discussion | ⇒ | Confirmed |
Labels |
Added:
No Code Attached Yet
Removed: ? ? |
@HLeithner same request as made in #23504
Status | Confirmed | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-11-12 11:32:45 |
Closed_By | ⇒ | chmst |
@HLeithner can you please comment as this is about 3.9?