Open ktomk opened 5 years ago
I could work around this by removing the installation db like;
$ rm -rf ~/.phive/phars
I could not work-around with --temporary
for install
command.
So the actual bug here is that we do not verify whether or not the phar database is actually in sync with reality, e.g. we currently trust the database.
The correct behavior would probably be to realize the file is missing and just download it again.
Yes, I think on install if phive finds the phar in the database, it should check if the entry is orphaned and if so, just download again.
To check whether the phar exists on disk, phive should try to open the file for reading. Just checking w/ is_file() / is_readable() might return false albeit the phar file is there and is readable (SELinux etc., PHP accessing a file in the users home-dir). This would cause a constant re-download which is not wanted.
Also a higher level error message would be fine as well for me, like which phar (name only) according to which phive.xml file (and perhaps line number).
I'm not sure how trying to read the file would be any different from performing a file_exists
in terms of SELinux? If the file is "invisible" to the PHP process, it should be invisible for either type of access. It would be pretty bizarre if I cannot test for the existence of a file but can read it if i know its path.
What am I missing?
Regarding error reporting: Certainly a re-download would require supporting output so a user knows what's going on.
I just did remember an earlier issue (https://github.com/ktomk/pipelines/issues/1) where a file was checked readable before processing it. I then had a false negative.
I just checked it again. file_exists
might work, the code in question used is_readable
which returned false albeit it is possible to open the file.
That's a bizarre issue and setup. Why would the Security Context be configured like that? But okay, I'll keep it in mind :) Thanks for the pointer!
Yeah, it took me a bit to understand what the issue for the user was.
I explained the reason to myself in the end like this: Because the process binary is php
. That normally runs context of a webserver (so this would be a remote request) and therefore there are some safeguards regarding the users $HOME
directory.
Why would you use the PHP CLI SAPI executable, php
, in a webserver context?
@sebastianbergmann: I could only guess, but SELinux policy maybe makes no difference between the two for the case the user reported.
Just stumbled over this while I wanted to gather some more information w/ my other reported issue (#208).
Given the
phive.xml
and running this command:
where latest (stable) version of phive is ./bin/phive and all packages had been previously successfully installed but then were removed like:
w/o removing the symlinks:
results in the following output/error:
(guess: invalid symlinks are the reason /e: removing the broken symlinks does not help)