-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: make search path for BinaryFinder customizable. #43968
base: master
Are you sure you want to change the base?
Conversation
68c348b
to
2d5a7fb
Compare
e18dbbf
to
a00f68b
Compare
@kesselb i force pushed a change to address the workflow failures. It seems to need another review/approval now |
dee2942
to
30d13cd
Compare
@kesselb every time, all the tests checking out submodules fail for branches that don't originate from github.com/nextcloud. Is this something I'm doing wrong, or are the CI checks just funky? I don't know what I did to cause the errors in the failing actions. |
@exi the cypress will fail, it's broken for forks. |
30d13cd
to
0c2509b
Compare
956e961
to
7c8769b
Compare
protected function setUp(): void { | ||
$this->oldEnv = getenv("PATH"); | ||
// BinaryFinder always includes the "PATH" environment variable into the search path, | ||
// which we want to avoid in this test because they are not usually found in webserver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Why should the path environment variable not be available in webserver deployments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apache does not set or pass it through by default. Phpfpm does not set it as well. Not sure about others but I would suspect that most servers don't provide it by default.
What is blocking this from being merged? As far as I can tell, all necessary tests pass except for the ones that always fail. |
master is still Nextcloud 29. |
@kesselb 29.0.0 has been tagged, is this ready for merge now? |
Yup, another rebase would be nice. |
7c8769b
to
3d307d5
Compare
3d307d5
to
fa21a42
Compare
rebased it |
fa21a42
to
45518de
Compare
This feature is important for nextcloud running on distributions like NixOS, where all the standard search paths do not exist. Also added tests. This fixes issue nextcloud#43922 Signed-off-by: Reno Reckling <e-github@wthack.de>
45518de
to
8f88459
Compare
Signed-off-by: Josh <josh.t.richards@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking for now.
Needs approval by @nickvergessen.
public function __construct( | ||
ICacheFactory $cacheFactory, | ||
private IConfig $config | ||
) { | ||
$this->cache = $cacheFactory->createLocal('findBinaryPath'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we assume people are clever enough to purge the local cache when changing the config?
Or should we add e.g. md5(json_encode($this->config->getSystemValue('binary_search_paths')))
to the cache prefix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cache is only for 5 minutes + we currently cache not found/fallback results and find that acceptable. So I don't think it's necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get this in.
public function __construct( | ||
ICacheFactory $cacheFactory, | ||
private IConfig $config | ||
) { | ||
$this->cache = $cacheFactory->createLocal('findBinaryPath'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cache is only for 5 minutes + we currently cache not found/fallback results and find that acceptable. So I don't think it's necessary.
null, | ||
$this->config->getSystemValue('binary_search_paths', self::DEFAULT_BINARY_SEARCH_PATHS)); | ||
if ($result === null) { | ||
$result = false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null, | |
$this->config->getSystemValue('binary_search_paths', self::DEFAULT_BINARY_SEARCH_PATHS)); | |
if ($result === null) { | |
$result = false; | |
} | |
false, | |
$this->config->getSystemValue('binary_search_paths', self::DEFAULT_BINARY_SEARCH_PATHS)); |
An opportunity to streamline. :-)
Summary
This feature is important for nextcloud running on distributions like NixOS, where all the standard
search paths do not exist.
I chose to make the list overridable instead of appendable because having a default list that always gets
applied might cause reproducibility issues on distros like NixOS where we have multiple versions
of the same binary at the same time.
This fixes issue #43922
Checklist