-
-
Notifications
You must be signed in to change notification settings - Fork 269
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
vendor/bin/doctrine-module only works if it's a symlink #729
Comments
In order to correct this, we'll need someone with access to WSL2 and a vested interest in correcting it. Know anyone? |
Hi Tom - Have enjoyed Doctrine for years, so would like to try to contribute. I'm not familiar with the codebase but could help by testing. If that's not useful, I'll be able to have a crack at it in a few weeks. |
I hope I didn't come across as short. In retrospect, I was worried I did. This enhancement doesn't NEED WSL2 but would benefit from a user who can duplicate the issue. I'm worried the issue isn't duplicatable on standard *nix distributions. |
Not short! You included a caveat anyway :) Plus, as saints, open source maintainers get extra leeway and benefit of the doubt. I just duplicated it on my Ubuntu setup.
It looks to me like a simple "include failed because I'm not in the dir I thought I was in". I'm fibbing a little - I'm running PHP inside a docker container. But I don't think that's contributing, since the include is path-less, and the DoctrineModule/bin/doctrine-module Line 4 in b0a1f82
|
Can you duplicate it without manually moving it? Can composer put it in the bin dir as a non-symlink? |
Doesn't look like it: https://getcomposer.org/doc/06-config.md#bin-compat |
Don't know if it is actually the same but I do believe this is at least similar to doctrine/orm#8563 where changing #!/usr/bin/env php
<?php
include(__DIR__ . '/doctrine.php'); Solved the issue. Changing #!/usr/bin/env php
<?php
include(__DIR__ . '/doctrine-module.php');
Fixes the issue in my case, though I did not invest any time trying to recreate the environment described here (setting up symlinks). @bitwombat could you perhaps try this solution in your setup? |
That didn't work.
Taking a sample of my |
I appreciate your investigation into this windows issue. Since you have examples of working bin dir code, how about putting in a PR with the modified doctrine-module? |
@bitwombat Could it be that you are using an old version of composer? For me with composer 2.1.8 the solution with Composer automatically creates a proxy file. For doctrine/orm, i.e. for #!/usr/bin/env php
<?php
/**
* Proxy PHP file generated by Composer
*
* This file includes the referenced bin path (../doctrine/orm/bin/doctrine) using eval to remove the shebang if present
*
* @generated
*/
$binPath = realpath(__DIR__ . "/" . '../doctrine/orm/bin/doctrine');
$contents = file_get_contents($binPath);
$contents = preg_replace('{^#!/.+\r?\n<\?(php)?}', '', $contents, 1, $replaced);
if ($replaced) {
$contents = strtr($contents, array(
'__FILE__' => var_export($binPath, true),
'__DIR__' => var_export(dirname($binPath), true),
));
eval($contents);
exit(0);
}
include $binPath; I think for DoctrineModule we should go the same way, i.e. changing it to |
"Composer automatically creates a proxy file" Yeah, you lost me. I was using composer 2.1.5. |
Good, then I suggest we use |
fix #729: fixed include path in bin/doctrine-module
This happens because Composer detects it's running in WSL2 and copies files into
vendor/bin/
for some reason. The logic invendor/bin/doctrine-module
expects__DIR__
to be../doctrine-module/bin
, which it is whenvendor/bin/doctrine-module
is a symlink (ie. it gets followed).A workaround is to configure Composer to always make symlinks:
I don't believe this is a composer issue.
doctrine-module
should not be relying on symlink resolution to../doctrine-module/bin/doctrine-module
in order to work. Other vendor/bin files seem to work by loading autoload.php and newing an object.The text was updated successfully, but these errors were encountered: