Skip to content
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

Phpcs and PhpLint tasks fail on Windows 7 #275

Closed
Bilge opened this issue Jan 15, 2017 · 10 comments
Closed

Phpcs and PhpLint tasks fail on Windows 7 #275

Bilge opened this issue Jan 15, 2017 · 10 comments

Comments

@Bilge
Copy link
Contributor

Bilge commented Jan 15, 2017

Q A
Branch master
Bug? yes
New feature? no
Question? no
Documentation? no
Related tickets n/a

Phpcs and PhpLint tasks are skipped on Windows 7 due to "the windows cmd input limit". As I understand, this error message is generated by GrumPHP so it is this project's prerogative to devise a suitable workaround for running these tasks on Windows.

My configuration
Default.

Steps to reproduce:

  1. bin/grumphp run

Result:

GrumPHP is sniffing your code!
Running task 1/7: PhpParser
Running task 2/7: Phpcs
Oh no, we hit the windows cmd input limit!
Skipping task ...

Running task 3/7: Phpspec
Running task 4/7: Phpunit
Running task 5/7: Composer
Running task 6/7: PhpLint
Oh no, we hit the windows cmd input limit!
Skipping task ...

Running task 7/7: YamlLint
             âââââââââââââââââââââââââ
           âââââââââââââââââââââââââââââ
         ââââââââââââââââââââââââââââââââ
        ââââââââââââââââââââââââââââââââââ
        ââââââââââââââââââââââââââââââââââ
  ââââââââââââââââââââââââââââââââââââââââ
 âââââââââââââââââââââââââââââââââââââââââ
 âââââââââââââââââââââââââââââââââââââââââ
   âââââââââââââââââââââââââââââââââââââââ
     ââââââââââââââââââââââââââââââââââââââââââ
      ââââââââââââââ                 ââââââââââ
     ââââââââ                         âââââââ
      âââââ      âââ          ââ       âââââ
        âââ                            âââ
         ââ           ââ ââ           ââââ
        âââ       ââââââââââââ       ââââ
         âââ ââââââââââââââââââââââââââââ
        âââââââââââââââââââââââââââââââââ
          ââââââââââââââââââââââââââââââ
         ââââââââââââââââââââââââââââââ
          âââââââââââââââââââââââââââââ
           ââ âââââââââââââââââââââââââ
            â âââââââââââââââââââââ ââ
                ââââââââââââââââââ
                 âââ  ââââââ  âââ
                        âââ   ââ
       _    _ _                         _ _
      / \  | | |   __ _  ___   ___   __| | |
     / _ \ | | |  / _` |/ _ \ / _ \ / _` | |
    / ___ \| | | | (_| | (_) | (_) | (_| |_|
   /_/   \_\_|_|  \__, |\___/ \___/ \__,_(_)
                  |___/
The Windows maximum amount of 8191 input characters exceeded while running process: "vendor\bin\phpcs.BAT" "- ...
The Windows maximum amount of 8191 input characters exceeded while running process: "vendor\bin\parallel-lint ...
@veewee
Copy link
Contributor

veewee commented Jan 16, 2017

Currently, that is intended behaviour. You can find additional information here:
https://github.com/phpro/grumphp/blob/master/src/GrumPHP/Util/Platform.php#L19
https://support.microsoft.com/en-us/kb/830473

The problem is that the CLI input string on cmd.exe is limited to 8191 characters. Tasks like phplint and phpcs contain the paths to the files that are being checked. During a run command, the list of files wil exceed this amount which results in some strange errors on windows.

That is why I've choosen to display the error message and mark the test as skipped.

I would accept a PR which contains a better solution.

@Bilge
Copy link
Contributor Author

Bilge commented Jan 16, 2017 via email

@veewee
Copy link
Contributor

veewee commented Jan 16, 2017

That's a possible solution but it would require code changes in multiple tasks: Most of the tasks run only one process. Maybe the processes part could be abstracted into a new layer so that it doesn't matter if one or multiple tasks are started. The problem is only on Windows, so for other OS a split-up is not really necessary.

@Bilge
Copy link
Contributor Author

Bilge commented Feb 10, 2017

The problem is only on Windows, so for other OS a split-up is not really necessary.

I'm not sure that's true. That's what the xargs command was created for, and as it shows us, the typical Linux limit is very generous.

$ xargs --show-limits
POSIX upper limit on argument length (this system): 2607529
POSIX smallest allowable upper limit on argument length (all systems): 4096
Maximum length of command we could actually use: 2595666
Size of command buffer we are actually using: 131072

It is quite possible you just haven't hit the 2MB command line limit in any of your projects or tests but this remains a dormant problem waiting to happen.

@veewee
Copy link
Contributor

veewee commented Feb 10, 2017

I don't think I am going to hit the unix limit anytime soon, but I do agree that it is an issue.
If you are committing 2MB of filenames at once, it might be easier to just run the executables on all the files.
The same goes for Windows: if the limit is hit, it might be easier to just run the executables without the file list. What do you think?

@Bilge
Copy link
Contributor Author

Bilge commented Feb 10, 2017

it might be easier to just run the executables on all the files

Absolutely not, for the following reasons.

  1. A user should only have to fix issues in files they modified, not in files they did not.
  2. In a very large project, such a scan could take a disproportionate amount of time to complete.

@veewee veewee added the Windows label Feb 14, 2017
benderni pushed a commit to benderni/grumphp that referenced this issue Feb 27, 2017
veewee pushed a commit that referenced this issue Mar 1, 2017
* #265: Added a FAQ

* #265 Created a FAQ page.

* #265: Added structure to the FAQ page.

* #265: Added anchors to the table of content

* #265: Added anchors for the up links

* #265: Added a questions to the FAQ page

* #265: Typo fix

* #265: Added a FAQ for #275

* #265: Anchor fix and sentence fix.
@burzum
Copy link

burzum commented Jan 16, 2019

I'm also running into this issue. There is no fix for this yet?

Update: When running tortoise git grumphp works. But it doesn't and brings the limit error when I run it manually using the Windows Powershell.

@Bilge
Copy link
Contributor Author

Bilge commented Jan 16, 2019

There is no fix for this yet?

Why do you ask that like it could have just magically fixed itself? If you're not going to put the work in, nothing's going to happen.

@veewee
Copy link
Contributor

veewee commented Aug 7, 2020

Fixed in #796

@veewee veewee closed this as completed Aug 7, 2020
@iva3682
Copy link

iva3682 commented Nov 12, 2021

Hey! Same problem with phpmd and phpstan tasks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants