Comments (18)
Note, the instructions specify backticks around cw-definitions-path, not straight ticks.
Please give future issues more accurate titles: you happen to be using a Mac, but you've provided no evidence that this issue is Mac-specific, and indeed it's not: using the wrong sort of ticks will cause this failure with bash on any system. I've edited this issue to show a title I might have given it if I had filed it.
from cw.
and here I was feeling dumb for using backticks!
when straight ticks are removed and replaced with backticks I get this
Warning: Failed loading manifest for /Users/bennyp/.luarocks/lib/luarocks/rocks-5.2: /Users/bennyp/.luarocks/lib/luarocks/rocks-5.2/manifest: No such file or directory
~ bennyp@iMac $ ping bennypowers.com
/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/libexec/cw/ping: line 2: syntax error near unexpected token `"%s"'
/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/libexec/cw/ping: line 2: `if posix.uname("%s") == "SunOS" then'
~ bennyp@iMac $
from cw.
The first line is worrying, as it looks like your luarocks installation is faulty.
After that, it seems cw's ping
script is being executed as a shell script, not as Lua.
What is /bin/sh
on your system? And what do a) the first line of which ping
and b) the first two lines of which cw
look like?
from cw.
~ bennyp@iMac $ /bin/sh -version GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14) Copyright (C) 2007 Free Software Foundation, Inc.
running /bin/sh produces a sh-3.2$ prompt
in a fresh terminal:
Warning: Failed loading manifest for /Users/bennyp/.luarocks/lib/luarocks/rocks-5.2: /Users/bennyp/.luarocks/lib/luarocks/rocks-5.2/manifest: No such file or directory
~ bennyp@iMac $ which ping
/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/libexec/cw/ping
~ bennyp@iMac $ which cw
/usr/local/bin/cw
~ bennyp@iMac $
from cw.
OK, so /bin/sh
is bash, that's fine.
Sorry, the second bit wasn't clear. I meant, what is the first line of the scripts, not of the output of which
.
from cw.
#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw
if posix.uname("%s") == "SunOS" then
match("highlight", "----")
match("lowlight", "is alive")
else
match("highlight", "---")
end
match("highlight", "%b()")
match("highlight", "%b[]")
match("lowlight", " from ")
match("lowlight", "From ")
match("lowlight", "PING")
/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/libexec/cw/ping (END)
and
#!/bin/sh
exec '/usr/local/bin/lua' -e 'package.path="/Users/benpowers/.luarocks/share/lua/5.2/?.lua;/Users/benpowers/.luarocks/share/lua/5.2/?/init.lua;/usr/local/share/lua/5.2/?.lua;/usr/local/share/lua/5.2/?/init.lua;"..package.path; package.cpath="/Users/benpowers/.luarocks/lib/lua/5.2/?.so;/usr/local/lib/lua/5.2/?.so;"..package.cpath' -e 'local k,l,_=pcall(require,"luarocks.loader") _=k and l.add_context("cw","2.0.4-1")' '/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw' "$@"
/usr/local/bin/cw (END)
from cw.
I am starting to see something of what's going on: somehow, you've installed cw
in one luarocks tree (under /usr/local
), but the paths used by cw itself are for another (under ~/.luarocks
). I'm not sure how that has come about.
What are the first few lines of /usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw
please?
from cw.
#!/bin/sh
A=--[[ exec /usr/local/bin/lua "$0" "$@" # -*- mode: lua; -*- ]]A
from cw.
thought this might help:
~ bennyp@iMac $ luarocks remove cw
Checking stability of dependencies on the absence of
cw 2.0.4-1...
Removing cw 2.0.4-1...
Removal successful.
~ bennyp@iMac $ luarocks install cw
Installing https://luarocks.org/cw-2.0.4-1.src.rock...
Using https://luarocks.org/cw-2.0.4-1.src.rock... switching to 'build' mode
LUA=/usr/local/bin/lua autoreconf -i && ./configure --prefix=/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1 --libdir=/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/lib --datadir=/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/lua && make clean && make
configure.ac:22: installing './install-sh'
configure.ac:22: installing './missing'
Makefile.am:28: warning: basename $(wildcard def/*.lua: non-POSIX variable name
Makefile.am:28: (probably a GNU make extension)
Makefile.am:31: warning: '%'-style pattern rules are a GNU make extension
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for lua... /usr/local/bin/lua
checking if /usr/local/bin/lua is a Lua interpreter... yes
checking for lua version... 5.2
checking for lua platform... unknown
checking for lua script directory... ${prefix}/share/lua/5.2
checking for lua module directory... ${exec_prefix}/lib/lua/5.2
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating luarocks-config.lua
config.status: creating cw.lua
config.status: creating cw-definitions-path.lua
rm -f def/arp def/arping def/cksum def/configure def/df def/di def/dig def/du def/env def/fuser def/groups def/hd def/hexdump def/host def/id def/iptables def/last def/lastlog def/lsattr def/lsmod def/lsof def/ltrace-color def/mount def/netstat def/nfsstat def/nmap def/objdump def/ping def/pmap def/pmap_dump def/praliases def/ps def/pstree def/quota def/quotastats def/route def/routel def/showmount def/smbstatus def/strace-color def/sysctl def/syslog def/tcpdump def/tracepath def/traceroute def/users def/vmstat def/whereis def/who cw cw-definitions-path
rm -f cw cw.tmp
sed -e 's|@pkglibexecdir[@]|/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/libexec/cw|g' 'cw.lua' >cw.tmp
mv cw.tmp cw
chmod +x cw
/usr/local/bin/lua cw --version >/dev/null || ( cat cw && rm cw )
rm -f cw-definitions-path cw-definitions-path.tmp
sed -e 's|@pkglibexecdir[@]|/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/libexec/cw|g' 'cw-definitions-path.lua' >cw-definitions-path.tmp
mv cw-definitions-path.tmp cw-definitions-path
chmod +x cw-definitions-path
/usr/local/bin/lua cw-definitions-path --version >/dev/null || ( cat cw-definitions-path && rm cw-definitions-path )
Warning: Failed loading manifest for /Users/bennyp/.luarocks/lib/luarocks/rocks-5.2: /Users/bennyp/.luarocks/lib/luarocks/rocks-5.2/manifest: No such file or directory
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/arp
cat def/arp.lua >> def/arp
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/arping
cat def/arping.lua >> def/arping
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/cksum
cat def/cksum.lua >> def/cksum
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/configure
cat def/configure.lua >> def/configure
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/df
cat def/df.lua >> def/df
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/di
cat def/di.lua >> def/di
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/dig
cat def/dig.lua >> def/dig
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/du
cat def/du.lua >> def/du
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/env
cat def/env.lua >> def/env
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/fuser
cat def/fuser.lua >> def/fuser
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/groups
cat def/groups.lua >> def/groups
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/hd
cat def/hd.lua >> def/hd
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/hexdump
cat def/hexdump.lua >> def/hexdump
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/host
cat def/host.lua >> def/host
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/id
cat def/id.lua >> def/id
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/iptables
cat def/iptables.lua >> def/iptables
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/last
cat def/last.lua >> def/last
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/lastlog
cat def/lastlog.lua >> def/lastlog
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/lsattr
cat def/lsattr.lua >> def/lsattr
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/lsmod
cat def/lsmod.lua >> def/lsmod
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/lsof
cat def/lsof.lua >> def/lsof
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/ltrace-color
cat def/ltrace-color.lua >> def/ltrace-color
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/mount
cat def/mount.lua >> def/mount
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/netstat
cat def/netstat.lua >> def/netstat
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/nfsstat
cat def/nfsstat.lua >> def/nfsstat
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/nmap
cat def/nmap.lua >> def/nmap
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/objdump
cat def/objdump.lua >> def/objdump
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/ping
cat def/ping.lua >> def/ping
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/pmap
cat def/pmap.lua >> def/pmap
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/pmap_dump
cat def/pmap_dump.lua >> def/pmap_dump
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/praliases
cat def/praliases.lua >> def/praliases
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/ps
cat def/ps.lua >> def/ps
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/pstree
cat def/pstree.lua >> def/pstree
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/quota
cat def/quota.lua >> def/quota
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/quotastats
cat def/quotastats.lua >> def/quotastats
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/route
cat def/route.lua >> def/route
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/routel
cat def/routel.lua >> def/routel
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/showmount
cat def/showmount.lua >> def/showmount
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/smbstatus
cat def/smbstatus.lua >> def/smbstatus
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/strace-color
cat def/strace-color.lua >> def/strace-color
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/sysctl
cat def/sysctl.lua >> def/sysctl
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/syslog
cat def/syslog.lua >> def/syslog
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/tcpdump
cat def/tcpdump.lua >> def/tcpdump
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/tracepath
cat def/tracepath.lua >> def/tracepath
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/traceroute
cat def/traceroute.lua >> def/traceroute
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/users
cat def/users.lua >> def/users
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/vmstat
cat def/vmstat.lua >> def/vmstat
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/whereis
cat def/whereis.lua >> def/whereis
printf "#!/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin/cw\n" > def/who
cat def/who.lua >> def/who
rm -f cw.1 cw.1.tmp
sed -e 's|@pkglibexecdir[@]|/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/libexec/cw|g' ./cw.1.in >cw.1.tmp
mv cw.1.tmp cw.1
make install
./install-sh -c -d '/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin'
/usr/bin/install -c cw cw-definitions-path ./script/configure ./script/ltrace-color ./script/strace-color ./script/syslog '/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/bin'
./install-sh -c -d '/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/libexec/cw'
/usr/bin/install -c def/arp def/arping def/cksum def/configure def/df def/di def/dig def/du def/env def/fuser def/groups def/hd def/hexdump def/host def/id def/iptables def/last def/lastlog def/lsattr def/lsmod def/lsof def/ltrace-color def/mount def/netstat def/nfsstat def/nmap def/objdump def/ping def/pmap def/pmap_dump def/praliases def/ps def/pstree def/quota def/quotastats def/route def/routel def/showmount def/smbstatus def/strace-color '/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/libexec/cw'
/usr/bin/install -c def/sysctl def/syslog def/tcpdump def/tracepath def/traceroute def/users def/vmstat def/whereis def/who '/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/libexec/cw'
./install-sh -c -d '/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/share/man/man1'
/usr/bin/install -c -m 644 cw.1 '/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/share/man/man1'
Updating manifest for /usr/local/lib/luarocks/rocks-5.2
cw 2.0.4-1 is now built and installed in /usr/local (license: GPL)
~ bennyp@iMac $ ping google.com
/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/libexec/cw/ping: line 2: syntax error near unexpected token `"%s"'
/usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/libexec/cw/ping: line 2: `if posix.uname("%s") == "SunOS" then'
from cw.
I'm still not sure why cw is failing as it is: I would expect a fork bomb (via the ping
script eventually re-executing itself), not for the ping
script to end up being run as a shell script.
However, I think the underlying cause is the discrepancy between the two different luarocks paths being used.
I'm not sure why this is happening, but the default luarocks configuration file defines two luarocks trees (one system and one user). I have only one tree in my configuration. Somehow, luarocks is using both of your trees while building cw, in different places. I'm pretty sure this inconsistency is what's causing the problem.
You could try commenting one of the trees out in your config file and reinstalling cw.
from cw.
this?
~ bennyp@iMac $ brew remove lua
Uninstalling /usr/local/Cellar/lua/5.2.4_1... (177 files, 2.1M)
~ bennyp@iMac $ brew install lua
==> Downloading https://homebrew.bintray.com/bottles/lua-5.2.4_1.yosemite.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/lua-5.2.4_1.yosemite.bottle.tar.gz
==> Pouring lua-5.2.4_1.yosemite.bottle.tar.gz
==> Caveats
Please be aware due to the way Luarocks is designed any binaries installed
via Luarocks-5.2 AND 5.1 will overwrite each other in /usr/local/bin.
This is, for now, unavoidable. If this is troublesome for you, you can build
rocks with the `--tree=` command to a special, non-conflicting location and
then add that to your `$PATH`.
==> Summary
πΊ /usr/local/Cellar/lua/5.2.4_1: 81 files, 1.1M
from cw.
No, comment out one of the trees in your luarocks config file and reinstall luarocks. No need to reinstall lua.
from cw.
Also, I'm wondering if you have managed to install cw in two different luarocks trees somehow, hence the different paths, because the build trace you posted above implies that the cw script would be correctly generated. Check whether the cw
script installed on your PATH by luarocks has the same(ish) timestamp as the one installed by your most recent luarocks install command in /usr/local/lib/luarocks/rocks-5.2/cw/2.0.4-1/libexec/cw.
Anyway, this looks like luarocks shenanigans to me, not a problem with cw, so closing the issue.
However, I will look at whether I can simplify the way cw builds and installs its scripts, to make this sort of problem easier to debug.
from cw.
i commented out system in /usr/local/etc/luarocks52/config-5.2.lua now i don't get those errors, but I also don't get any cw loving from ping or traceroute
from cw.
Did you reinstall cw? Very generous of you to call it "cw loving" given the results so farβ¦
from cw.
yes. and don't worry, it's like you said not your fault. I'm still looking forward to colourful output :)
After luarocks remove cw && brew remove lua && brew install lua
then inserting a comment mark on line 3 of /usr/local/etc/luarocks52/config-5.2.lua (disabling the system tree) then luarocks install cw
a new terminal produces: -bash: cw-definitions-path: command not found
from cw.
I created and chmoded cw-definitions-path in .luarocks/bin and added that dir to $PATH
here's what i get:
/usr/local/bin/lua: /Users/bennyp/.luarocks/bin/cw-definitions-path:27: module 'std' not found:
no field package.preload['std']
no file '/usr/local/share/lua/5.2/std.lua'
no file '/usr/local/share/lua/5.2/std/init.lua'
no file '/usr/local/lib/lua/5.2/std.lua'
no file '/usr/local/lib/lua/5.2/std/init.lua'
no file './std.lua'
no file '/usr/local/lib/lua/5.2/std.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './std.so'
stack traceback:
[C]: in function 'require'
/Users/bennyp/.luarocks/bin/cw-definitions-path:27: in main chunk
[C]: in ?
Then I removed cw and changed lua config to /usr/local, then luarocks install stdlib && luarocks install cw, then i made and chmodded /usr/local/bin/cw-definitions-path with /usr/local specified, and I got this:
/usr/local/bin/lua: error loading module 'posix' from file '/usr/local/lib/lua/5.2/posix.so':
dlsym(0x7f83794696f0, luaopen_posix): symbol not found
stack traceback:
[C]: in ?
[C]: in function '_require'
/usr/local/share/lua/5.2/std/base.lua:413: in function 'inner'
/usr/local/share/lua/5.2/std/debug.lua:545: in function 'require'
/usr/local/bin/cw-definitions-path:28: in main chunk
[C]: in ?
from cw.
I found the cause: Mac OS X's kernel does not support chaining of hash-bang lines (in fact, only Minix and Linux do). Hence, I shall have to fix this bug.
from cw.
Related Issues (13)
- Installing via luarocks does not install wrapper scripts outside rock directory HOT 7
- `if [ -n "$PS1" ]` never executes HOT 1
- Fails to install cw-definitions-path HOT 1
- cw does not return the exit code of commands it runs
- Don't parse command-line if we have a command to run
- Make cw faster
- Make automake a dependency HOT 2
- Unable to get it work under ubuntu 15.04 HOT 1
- License upgraded to GPLv3+, but the LICENSE file is still GPLv2 HOT 1
- /usr/bin/lua: /usr/bin/cw:39: module 'std' not found: HOT 6
- Problem with installing HOT 4
- strace-color binary does not color HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cw.