emacs-eldev / eldev

Elisp development tool
https://emacs-eldev.github.io/eldev/
GNU General Public License v3.0
227 stars 17 forks source link

Eldev erroneously treats its own script as an Eldev file on a case-insensitive file system #9

Closed DarwinAwardWinner closed 4 years ago

DarwinAwardWinner commented 4 years ago

Currently, I cannot install and use eldev. When I attempt to do so, I get this:

$ rm ~/.eldev eldev # Clean out any existing eldev
$ curl -fsSL https://raw.github.com/doublep/eldev/master/bin/eldev > eldev && chmod a+x eldev
$ eldev
Bootstrapping Eldev for Emacs 26.3 from Melpa stable...

Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Invalid read syntax: "#"

Manually installing by cloning the repo and running install.sh does work.

doublep commented 4 years ago

I cannot reproduce this. Tried on two machines. Tried with Emacs 28 (trunk) and Emacs 26.3.

$ rm -f ~/.local/bin/eldev; rm -rf ~/.eldev; curl -fsSL https://raw.github.com/doublep/eldev/master/bin/eldev > eldev && chmod a+x eldev && ELDEV_LOCAL= EMACS=emacs-26.3 eldev
Bootstrapping Eldev for Emacs 26.3 from Melpa stable...

Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Usage: eldev [OPTION...] COMMAND [...]
Run ‘eldev help’ for more information
$ rm -f ~/.local/bin/eldev; rm -rf ~/.eldev; curl -fsSL https://raw.github.com/doublep/eldev/master/bin/eldev > eldev && chmod a+x eldev && ELDEV_LOCAL= eldev
Bootstrapping Eldev for Emacs 28.0 from Melpa stable...

Usage: eldev [OPTION...] COMMAND [...]
Run ‘eldev help’ for more information
DarwinAwardWinner commented 4 years ago

Ok, it seems this only happens when I run eldev from the directory where it is located. E.g. if the path to eldev is ~/bin/eldev, then:


$ pwd
/Users/ryan
$ eldev
Usage: eldev [OPTION...] COMMAND [...]
Run ‘eldev help’ for more information
$ cd ~/bin/
$ eldev
Invalid read syntax: "#"
DarwinAwardWinner commented 4 years ago

Oh, of course: the shell script file name eldev is being treated as an Eldev file, so eldev is trying to read its own shell source as elisp.

DarwinAwardWinner commented 4 years ago

It's possible this is only a problem on Mac OS with its default case-insensitive filesystem.

doublep commented 4 years ago

Well, it is kinda a corner-case then. But I guess I can just add a special case to avoid reading Eldev if the file starts with #!. It is too late to change filenames (i.e. eldev executable vs. Eldev as its build file).

DarwinAwardWinner commented 4 years ago

Another approach might be to record the path of the script bring executed and then not count that path as a valid Eldev file.

doublep commented 4 years ago

Fix will be released in 0.3.