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

The filename, directory name, or volume label syntax is incorrect. #8361

Closed
CosaroLisa opened this issue Dec 14, 2023 · 10 comments
Closed

The filename, directory name, or volume label syntax is incorrect. #8361

CosaroLisa opened this issue Dec 14, 2023 · 10 comments

Comments

@CosaroLisa
Copy link

Running with php 7.4 and

"require-dev": {
        "symplify/easy-coding-standard": "12.*",
        "phpstan/phpstan": ">1.10",
        "phpstan/extension-installer": ">1.3",
        "rector/rector": "0.18.6",
        "tomasvotruba/type-coverage": ">0.2",
        "tomasvotruba/cognitive-complexity": ">0.1"
    },

I get
Screenshot 2023-12-14 130440
This only happens for versions higher than 0.18.6.

@TomasVotruba
Copy link
Member

Thank you for your report!

We'll need an isolated failing demo link from: http://getrector.com/demo,
that way we can reproduce the bug.

@samsonasik
Copy link
Member

samsonasik commented Dec 14, 2023

It seems you're using windows, just copy paste the error on google, the solution is probably on stackoverflow already https://stackoverflow.com/questions/24782826/the-filename-directory-name-or-volume-label-syntax-is-incorrect-inside-batch

@scollovati
Copy link

scollovati commented Dec 15, 2023

Seems that this is happening on Windows with XDEBUG active.

In fact, this exception is related to this LOC change in XdebugHandler.php (that is loaded in the source code of Rector rather than via Composer): 45987b0#diff-27a6b916747c306f2a8c14d3ebcaeb25ecf6e4359daeb4541f0277712dd1a40c

This change has been introduced in v0.18.6, and still present on 0.18.12.

By the way, in the source of that package (last version v3.0.3) that LOC is slightly different https://github.com/composer/xdebug-handler/blob/3.0.3/src/XdebugHandler.php#L298

So it's not related to the SO page attached.

@samsonasik
Copy link
Member

This probably related with PR:

@garas could you verify with relevancy? Thank you.

@garas
Copy link
Contributor

garas commented Dec 15, 2023

I'm unable to reproduce issue. Rector runs fine on Windows.

Do you still get same error if you allow Xdebug with .\vendor\bin\rector --xdebug?

@scollovati
Copy link

@garas it works super super slowly. I cannot even perform a search on a project with 16 files in a reasonable time.
The point is that until version 18.5 it was possible to leave XDebug ready for web debugging (by using a dedicated cookie) in PHP.ini (xdebug.mode = develop,debug), while not creating any issue in Rector.

As said above, the source code of that helper library is different from the one that you have. Don't know if an updated version may solve the issue.

@scollovati
Copy link

scollovati commented Dec 15, 2023

According to my analysis, the issue lies here 45987b0#diff-27a6b916747c306f2a8c14d3ebcaeb25ecf6e4359daeb4541f0277712dd1a40c

escapeshellarg behaves very differently on Linux and Windows. Typically, the native function does not work in a naive way under Windows, and it creates issues in a lot of contexts. The community suggests to implement a dedicated function for Windows environments. References here:

@samsonasik
Copy link
Member

@scollovati based on php manual comment, is changing with something like:

-$process = \proc_open(\is_array($cmd) ? \implode(' ', \array_map('escapeshellarg', $cmd)) : $cmd, [], $pipes);
+$process = \proc_open(\is_array($cmd) ? \implode(' ', \array_map(
+         function($path) {
+              return '"' . addcslashes($path, '\\"') . '"';
+         }, $cmd)) : $cmd, [], $pipes);

is working? It is unfortunately that we don't have windows env for testing and example code that produce the error. If you can provide a github repo with github action for windows, that would be great to test and fix together.

@scollovati
Copy link

Not working either. I've manually changed the LOC to go back to the previous version and it works.
Same said by using the official package here https://github.com/composer/xdebug-handler/blob/main/src/XdebugHandler.php#L298

@samsonasik
Copy link
Member

We need a reproducible repo, with github action for windows, so we can fix together, otherwise, it is just guessing and cause old bug show again.

@scollovati I am closing it, feel free to create new issue when you have a chance to create reproducible repo for it, as @garas unable to reproduce it.

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

No branches or pull requests

5 participants