-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Finder]Solaris has older find command, S2.2 will not run. #7061
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
Comments
The finder cannot be a service. Finders are not stateless. You cannot use the same instance to search several times |
Fair enough. I added the word factory to my original post. |
I had a similar problem, because I'm using GNU find on a Mac (which I have to admit is a bit of a weird edge case). When running composer with symfony I get a lot of errors saying:
Annoyingly, the error isn't detected in php because the output of It'd be good enough just to have a way to force it to use the pure php implementation. |
$finder->removeAdapters()->addAdapter(new PhpAdapter()); |
Is there a hook somewhere in S2.2 to allow setting the PhpAdapter? This is actually quite puzzling. The finder component does not work on many operating systems out of the box. You would think it would be better to default to the safe implementation and then allow the user the option to use a faster one if available. Imagine a new S2 developer bringing down S2 and getting this strange error. I suspect they would look elsewhere for their framework. And if they did investigate then they would realize they need to hack a core component just to get started. Not an ideal introduction to Symfony. |
@ahundiak Please read my comment just above to see how to force using the PhpAdapter |
The problem is that the Finder is created and used in code that we don't have control over (i.e. Symfony itself). So we can't run the code you use. We need to force it to use PhpAdapter everywhere, not just in our own code. One means might be a configuration mechanism. Now I suppose this is tricky for anything that's run from the composer install, since that happens before there is a chance to make configuration changes (unless there's a global config?) so it might be best if the Symfony installation code always does that. And then the configuration checker could perhaps try calling find to see if it works (without any piped output). It would be better if such things worked without configuration, but I appreciate that can be tricky. As the original poster said, the best thing to do is to test the find itself. But annoyingly, find doesn't offer an easy way to do that (there's nothing along the lines of 'find --version'). So such a solution is liable to be either fragile or expensive. Anyway, I'm new to Symfony, so I don't know exactly what is feasible. |
@ahundiak your idea of a finder factory as service sounds good for me. It could permit to:
The second point seems required because of the many problems encountered on specific plateforms and the difficulty to guess which shell commands/options are available. What do you guys think of this? |
While I am not opposed to the idea I'm not sure it's worth the investment. My Solaris workstations run fine with the default php adapter. Actual production servers might benefit but how many solaris servers are really out there? Now that 2.2 is released if anyone else has problems with solaris then I'll step in. One thing to keep in mind is that you can load gnu find on solaris and end up with a gfind command which will not interfere with he existing solaris find command. So there should also be a way to configure the name of the find command in which case the existing gnu find based adapter works great. |
Closing as a workaround has been found now. |
By default, Sun (well Oracle) Solaris has it's own find command which does not support gnu find options such as -noleaf or -regexptype. So S2.2 does not work out of the box.
A simple patch to Finder::Shell with a check for PHP_OS=sunos will fix the problem. I can prepare one if need be.
However, I think the problem is more generic. It's same issue as when you attempt to do browser detection. You still never know if the system will support a command until you test for it. In the case of solaris, you could install a gnu find command in which case all would be well.
I think an actual version test for find (or gfind) would be better than os sniffing.
I see that there was also a proposal to make a finder factory service. That would allow the option of specifying which adapter to use. Makes things real simple.
The text was updated successfully, but these errors were encountered: