JMSDiExtraBundle icon indicating copy to clipboard operation
JMSDiExtraBundle copied to clipboard

Solaris grep issues

Open ivoba opened this issue 11 years ago • 11 comments

I am not sure if we should consider this as a bug, but i like to report it for completeness: I get a error on a solaris machine when enabling the translation:

 PHP Fatal error:  Uncaught exception 'JMS\\DiExtraBundle\\Exception\\RuntimeException' with message 'Command "/usr/bin/grep --extended-regexp --directories=recurse --devices=skip --files-with-matches --with-filename --color=never --include=*.php '.*'
...
/usr/bin/grep: Unzulässige Option -- extended-regexp
/usr/bin/grep: Unzulässige Option -- directories=recurse
/usr/bin/grep: Unzulässige Option -- devices=skip
/usr/bin/grep: Unzulässige Option -- files-with-matches
/usr/bin/grep: Unzulässige Option -- with-filename
/usr/bin/grep: Unzulässige Option -- color=never
/usr/bin/grep: Unzulässige Option -- include=*.php
...

this is probably due to a "bad" grep version on this solaris or a wrong grep path.

any ideas on that issue? and also how could i change the path to grep? i found the const as private.

ivoba avatar Oct 08 '12 10:10 ivoba

Just ran across this myself. The version of grep that ships with Solaris 10 is old and does not support --options. It's possible to bring down a more modern version of grep but I'm reluctant to do that for fear of breaking something else in Solaris that may rely on grep. For now I just went in to PatternFinder and tweaked determineMethod to always use METHOD_FINDER.

Be nice if we could add a version checker to grep or catch the error code and fallback to METHOD_FINDER or maybe be able to set a parameter to always use METHOD_FINDER.

ahundiak avatar Nov 01 '12 15:11 ahundiak

I've runned accross this issue today and cannot deploy my application to production, and I can't afford to modify the library by hand like ahundiak apparently did.

Isn't there a clean way to detect the grep version or the Solaris OS ? @schmittjoh Any idea ?

gnutix avatar Jan 17 '13 13:01 gnutix

What I ended up doing was to install a new (updated) version of grep on my Solaris 10 box.

ahundiak avatar Jan 17 '13 14:01 ahundiak

I unfortunately can't do that as I don't have admin rights on this server. As a workaround for Symfony 2.0, I've forked the repository and created a tag "1.0.1-gnutix-solaris-fix" here : https://github.com/gnutix/JMSDiExtraBundle .

For thoses who might be in the same situation as I am, just update your deps file with :

[JMSDiExtraBundle]
    git=https://github.com/gnutix/JMSDiExtraBundle.git
    target=/bundles/JMS/DiExtraBundle
    version=1.0.1-gnutix-solaris-fix

Anyway, the fix should probably be pushed to the master version of this bundle. @schmittjoh Can you take a look at it https://github.com/gnutix/JMSDiExtraBundle/commit/7776ca85fc4aa6fd30a3ec3a7638600a4b1b8d6f and tell me if it seems okay to you, so that I'll create a proper pull request for the master branch ? There is probably a better way to check this and a proper implementation, but I don't have time right now for something better.

gnutix avatar Jan 17 '13 14:01 gnutix

@schmittjoh Anyway you can take a look quickly ? I'm really needing this fix in a proper way for a client's application. Thanks a lot.

gnutix avatar Jan 22 '13 12:01 gnutix

I guess we could add a simple flag to the config to disable grep.

Not sure when I'll have time, but if it's a pressing issue, maybe you could add something like that and send a pull request?

On Tue, Jan 22, 2013 at 1:58 PM, Dorian Villet [email protected]:

@schmittjoh https://github.com/schmittjoh Anyway you can take a look quickly ? I'm really needing this fix in a proper way for a client's application. Thanks a lot.

— Reply to this email directly or view it on GitHubhttps://github.com/schmittjoh/JMSDiExtraBundle/issues/61#issuecomment-12543189.

schmittjoh avatar Jan 22 '13 16:01 schmittjoh

Shouldn't this issue be closed ?

gnutix avatar Jan 26 '13 22:01 gnutix

Just to let folks know, Symfony 2.2 has a similar issue. It uses the Finder component which in turn uses the gnu find command on what it thinks is gnu systems. The default sunos find command does not work. I'm planning on posting a patch and we will see what happens. It's the Finder::Shell object which needs to be tweaked.

ahundiak avatar Feb 13 '13 14:02 ahundiak

How to setup my symfony 2.1 composer.json to use this version?

My composer is like:

    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.1.*",
        "doctrine/orm": ">=2.2.3,<2.4-dev",
        "doctrine/doctrine-bundle": "1.0.*",
        "twig/extensions": "1.0.*@dev",
        "symfony/assetic-bundle": "2.1.*",
        "symfony/swiftmailer-bundle": "2.1.*",
        "symfony/monolog-bundle": "2.1.*",
        "sensio/distribution-bundle": "2.1.*",
        "sensio/framework-extra-bundle": "2.1.*",
        "sensio/generator-bundle": "2.1.*",
        "jms/security-extra-bundle": "1.2.*",
        "jms/di-extra-bundle": "1.1.*",
        "kriswallsmith/assetic": "1.1.*@dev",
        "jms/translation-bundle": "dev-master",
        "friendsofsymfony/user-bundle": "*",

vittore avatar Jul 12 '13 09:07 vittore

@vittore You should use "dev-master" for di-extra-bundle and security-extra-bundle. See my comment on the PR https://github.com/schmittjoh/JMSDiExtraBundle/pull/85#issuecomment-12641814

gnutix avatar Jul 12 '13 18:07 gnutix

I ran into this inside a docker container. Adding

jms_di_extra:
    disable_grep: true

works fine. I think this issue can be closed.

binarious avatar Feb 25 '17 20:02 binarious