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

Don't try to execute directories, or give a better error message #689

Open
andychu opened this issue Apr 6, 2020 · 1 comment
Open

Don't try to execute directories, or give a better error message #689

andychu opened this issue Apr 6, 2020 · 1 comment

Comments

@andychu
Copy link
Contributor

andychu commented Apr 6, 2020

(24) I tested zsh and mksh, and they return 126 here.

OK, I tried zsh, mksh and dash, and they all try to execute the directory. yash and bash detects the empty string. This is interesting. I tried more shells: posh, ksh and busybox sh try to execute the directory, and csh, tcsh and fish detects the empty string. Anyway, I think it's better to detect the empty string rather than trying to execute the directory.

I guess it's a special case.

The following cases may also be handled specially. I think one can just skip directory names in searching executable files from PATH. Directories are not executable even if the permission contains an executable flag.

osh$ ..
  ..
  ^~
[ interactive ]:1: Can't execute '/home/murase/bin/..': Permission denied
osh$ mkdir -p foo/bar
osh$ PATH=foo:$PATH
osh$ bar
  bar
  ^~~
[ interactive ]:9: Can't execute 'foo/bar': Permission denied
@andychu
Copy link
Contributor Author

andychu commented Apr 6, 2020

Shells disagree on this: many appear to add a special case, some just execute the directory and fail with 126.

From issue #653

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

1 participant