Closed hdcos closed 3 years ago
I'm not sure this is really a bug but when you follow the documentation and type
make install PREFIX=~/.nelua
this won't install and will create a directory~
in the current git repository where sources have been fetched. To make it work I had to typemake install PREFIX=/Users/$USER/.nelua
Seems like it does not expand the tilde to user home directory.
For example, if you have a directory "Downloads" in $HOME
and you execute echo ~/Downloads
, does it expand to /home/your-user-name/Downloads
?
Yes it does
attraqt@Henris-Mac-mini nelua-lang % echo ~
/Users/attraqt
attraqt@Henris-Mac-mini nelua-lang % ls ~
Applications Documents Library Music Postman work
Desktop Downloads Movies Pictures Public
attraqt@Henris-Mac-mini nelua-lang % make install PREFIX=~/.nelua
mkdir -p "~/.nelua/bin"
install -m755 nelua-lua "~/.nelua/bin/nelua-lua"
install -m755 nelua "~/.nelua/bin/nelua"
rm -rf "~/.nelua/lib/nelua"
mkdir -p "~/.nelua/lib/nelua"
cp -Rf lualib "~/.nelua/lib/nelua/lualib"
cp -Rf lib "~/.nelua/lib/nelua/lib"
/Library/Developer/CommandLineTools/usr/bin/make --no-print-directory install-version-patch
sed -i.bak 's/NELUA_GIT_HASH = nil/NELUA_GIT_HASH = "64b56d3620fcef34966c930309af7902416d0ead"/' "~/.nelua/lib/nelua/lualib/nelua/version.lua"
sed -i.bak 's/NELUA_GIT_DATE = nil/NELUA_GIT_DATE = "2021-10-03 13:40:50 -0300"/' "~/.nelua/lib/nelua/lualib/nelua/version.lua"
sed -i.bak 's/NELUA_GIT_BUILD = nil/NELUA_GIT_BUILD = 1384/' "~/.nelua/lib/nelua/lualib/nelua/version.lua"
rm -f "~/.nelua/lib/nelua/lualib/nelua/version.lua.bak"
attraqt@Henris-Mac-mini nelua-lang % ls
CONTRIBUTING.md Makefile examples nelua spec ~
Dockerfile README.md lib nelua-lua src
LICENSE docs lualib nelua.bat tests
attraqt@Henris-Mac-mini nelua-lang % ls ~/.nelua
ls: /Users/attraqt/.nelua: No such file or directory
attraqt@Henris-Mac-mini nelua-lang % make install PREFIX=/Users/$USER/.nelua
mkdir -p "/Users/attraqt/.nelua/bin"
install -m755 nelua-lua "/Users/attraqt/.nelua/bin/nelua-lua"
install -m755 nelua "/Users/attraqt/.nelua/bin/nelua"
rm -rf "/Users/attraqt/.nelua/lib/nelua"
mkdir -p "/Users/attraqt/.nelua/lib/nelua"
cp -Rf lualib "/Users/attraqt/.nelua/lib/nelua/lualib"
cp -Rf lib "/Users/attraqt/.nelua/lib/nelua/lib"
/Library/Developer/CommandLineTools/usr/bin/make --no-print-directory install-version-patch
sed -i.bak 's/NELUA_GIT_HASH = nil/NELUA_GIT_HASH = "64b56d3620fcef34966c930309af7902416d0ead"/' "/Users/attraqt/.nelua/lib/nelua/lualib/nelua/version.lua"
sed -i.bak 's/NELUA_GIT_DATE = nil/NELUA_GIT_DATE = "2021-10-03 13:40:50 -0300"/' "/Users/attraqt/.nelua/lib/nelua/lualib/nelua/version.lua"
sed -i.bak 's/NELUA_GIT_BUILD = nil/NELUA_GIT_BUILD = 1384/' "/Users/attraqt/.nelua/lib/nelua/lualib/nelua/version.lua"
rm -f "/Users/attraqt/.nelua/lib/nelua/lualib/nelua/version.lua.bak"
attraqt@Henris-Mac-mini nelua-lang % ls ~/.nelua
bin lib
attraqt@Henris-Mac-mini nelua-lang %
Seems like $ prefixed variables like $USER are interpolated before command evaluation but not ~
?
Which could explain why Makefile treat ~
as a raw character, and a folder with ~
is created ? 🤔 mhh
I have the impression that the PREFIX
wraps the whole argument in double quotes behind the scenes; that's why you get a "~" directory.
If you tried make install PREFIX="$HOME/.nelua"
, that should work.
I have tried make install PREFIX=~/.nelua
on my machine (GNU / Debian testing 64-bit) and works as expected.
It must be an issue with tilde expansion on Apple Mac's bash terminal.
Roger that. The default terminal on Mac OS is zsh this could be also a problem from zsh Maybe a change in the documentation then would be great 👍🏻 I'll try to do a PR tonight
Seems like it's zsh's issue https://unix.stackexchange.com/a/373532
The $HOME
, $USER
and ~
shell variables are specific to the shell or platform, and may be unavailable, I've update the install instructions to not use any of them, the least problematic way in this case is to use full directory path.
I've also added extra instructions on how to install directly from the repository:
Alternatively, if you want to run Nelua directly from the cloned repository, then you have the following options:
- You could add the cloned
nelua-lang
directory to yourPATH
environment variable, then thenelua
command will become available in your terminal.- You could create symbolic links to
./nelua
and./nelua-lua
in one directory of yourPATH
environment variable.- You could run the
./nelua
file directly.
Bug description
I'm not sure this is really a bug but when you follow the documentation and type
make install PREFIX=~/.nelua
this won't install and will create a directory~
in the current git repository where sources have been fetched. To make it work I had to typemake install PREFIX=/Users/$USER/.nelua
Code example
-
Expected behavior
make install PREFIX=~/.nelua
would create a.nelua
directory inside my home folder and putbin
andlib
there :)Workaround
make install PREFIX=/Users/$USER/.nelua
Environment
Provide relevant information about your environment: