editorconfig-checker/editorconfig-checker.php

Could not open input file: .../vendor/bin (Linux, Symbolic Link)

Closed this issue · 5 comments

ktomk commented

In my setup I'm symlinking into the vendor/bin folder from a folder (tools) which contains the overall setup which is via composer.json.

This has worked for all the tools so far, but does not for editorconfig-checker.php.

Invocation and error:

$  ./tools/ec
Could not open input file: /home/user/project/tools/vendor/bin
/home/user/project/tools/vendor/editorconfig-checker/editorconfig-checker/bin/../src/EditorconfigChecker.php
$ echo $?
1

Some additionalinformation on how the setup looks like on the file-system:

$ ls -l tools/ec
lrwxrwxrwx 1 mot mot 13 Nov 22 13:33 tools/ec -> vendor/bin/ec
$ ls -l tools/vendor/bin/ec
lrwxrwxrwx 1 mot mot 51 Nov 22 13:33 tools/vendor/bin/ec -> ../editorconfig-checker/editorconfig-checker/bin/ec
$ ls -l tools/vendor/bin/../editorconfig-checker/editorconfig-checker/bin/ec
-rwxrwxr-x 1 mot mot 1226 Nov 22 13:33 tools/vendor/bin/../editorconfig-checker/editorconfig-checker/bin/ec
$ file tools/vendor/bin/../editorconfig-checker/editorconfig-checker/bin/ec
tools/vendor/bin/../editorconfig-checker/editorconfig-checker/bin/ec: Bourne-Again shell script, ASCII text executable
ktomk commented

Workaround:

I can work around the issue by switching from a relative symbolic link to one with the absolute path which IIRC is also the real path in my test scenario:

ec: vendor/bin/ec
	ln -sfT $(abspath $<) $@
	touch $@

This smells like it has something to do with the symbolic link resolution, have to stop looking into this now, but should be able to figure out more later.

Hey @ktomk - thanks for your issue and detailes reproducing steps.
This is probably the root cause: https://github.com/editorconfig-checker/editorconfig-checker.php/blob/master/bin/ec#L32-L33

Hope this helps with debugging - if you are able to push up a pull request it would be great!

Thank you for your help.

ktomk commented

@mstruebing found the actual cause and applied a common fix (compare $ less $(git --exec-path)/git-sh-setup).

Thank you very much 🙏
Great PR!

I've released a new bugfix version which hopefully makes it usable for you again :)

ktomk commented

So at the end of the day this was not the symbolic link but my bugged CDPATH configuration. I thought I had it fixed recently (.profile does not export it any longer) but obviously effectively not in that session.

Fix should be useful in any case, especially in light of that link resolution function.

I've released a new bugfix version which hopefully makes it usable for you again :)

Thanks for the release. Confirmed.