schmittjoh / JMSDiExtraBundle

Provides Advanced Dependency Injection Features for Symfony2
http://jmsyst.com/bundles/JMSDiExtraBundle
330 stars 130 forks source link

Solaris grep issues #61

Open ivoba opened 12 years ago

ivoba commented 12 years ago

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.

ahundiak commented 11 years ago

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.

gnutix commented 11 years ago

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 ?

ahundiak commented 11 years ago

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

gnutix commented 11 years ago

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 commented 11 years ago

@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.

schmittjoh commented 11 years ago

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 notifications@github.comwrote:

@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.

gnutix commented 11 years ago

Shouldn't this issue be closed ?

ahundiak commented 11 years ago

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.

vittore commented 11 years ago

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": "*",
gnutix commented 11 years ago

@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

binarious commented 7 years ago

I ran into this inside a docker container. Adding

jms_di_extra:
    disable_grep: true

works fine. I think this issue can be closed.