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

dep command exit code is 0 even if there is an error #4

Closed
bofm opened this issue Jul 3, 2018 · 3 comments · Fixed by #6
Closed

dep command exit code is 0 even if there is an error #4

bofm opened this issue Jul 3, 2018 · 3 comments · Fixed by #6

Comments

@bofm
Copy link

bofm commented Jul 3, 2018

root@71e208ae72fc:/opt/tarantool/zzz# cat meta.yaml
name: zzz
version: scm-1
deps: []
tntdeps:
  - https://raw.githubusercontent.com/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
root@71e208ae72fc:/opt/tarantool/zzz# tarantoolapp dep && echo $?
Tarantool version: 1.9.0-4-g195d4462d
Using the following options:
---
--tree: .rocks
--meta-file: ./meta.yaml
--only:
--luarocks-config: /root/.luarocks/config.lua
...

[zzz] Already have proper rocks servers
[zzz] Installing dependencies...
[zzz] Installing tarantool dep 'https://raw.githubusercontent.com/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'
[zzz] tarantoolctl rocks install https://raw.githubusercontent.com/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

Error: No results matching query were found.
/usr/local/share/lua/5.1/tarantoolapp/commands/dep.lua:72: [zzz] tarantoolctl rocks install https://raw.githubusercontent.com/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz failed
stack traceback:
	...l/lib/luarocks/rocks/tarantoolapp/scm-1/bin/tarantoolapp:79: in function <...l/lib/luarocks/rocks/tarantoolapp/scm-1/bin/tarantoolapp:78>
	[C]: in function 'error'
	/usr/local/share/lua/5.1/tarantoolapp/commands/dep.lua:72: in function 'tarantoolctl_install'
	/usr/local/share/lua/5.1/tarantoolapp/commands/dep.lua:184: in function 'run'
	...l/lib/luarocks/rocks/tarantoolapp/scm-1/bin/tarantoolapp:76: in function <...l/lib/luarocks/rocks/tarantoolapp/scm-1/bin/tarantoolapp:75>
	[C]: in function 'xpcall'
	...l/lib/luarocks/rocks/tarantoolapp/scm-1/bin/tarantoolapp:74: in main chunk
0
@bofm
Copy link
Author

bofm commented Jul 3, 2018

root@451030127e78:/opt/tarantool/zzz# $(sleep 0.1 && pstree -paU > ps.txt)& tarantoolapp dep
[1] 1229
Tarantool version: 1.9.0-4-g195d4462d
Using the following options:
---
--tree: .rocks
--meta-file: ./meta.yaml
--only:
--luarocks-config: /root/.luarocks/config.lua
...

[zzz] Already have proper rocks servers
[zzz] Installing dependencies...
[zzz] Installing tarantool dep 'https://raw.githubusercontent.com/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'
[zzz] tarantoolctl rocks install https://raw.githubusercontent.com/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

Error: No results matching query were found.
/usr/local/share/lua/5.1/tarantoolapp/commands/dep.lua:72: [zzz] tarantoolctl rocks install https://raw.githubusercontent.com/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz failed
stack traceback:
	...l/lib/luarocks/rocks/tarantoolapp/scm-1/bin/tarantoolapp:81: in main chunk
[1]+  Done                    $(sleep 0.1 && pstree -paU > ps.txt)
root@451030127e78:/opt/tarantool/zzz# cat ps.txt
bash,1
  ├─bash,1229
  │   └─bash,1231
  │       └─pstree,1243 -paU
  └─lua5.1,1230 -epackage.path="/root/.luarocks/share/lua/5.1/?.lua;/root/.luarocks/share/lua/5.1/?/init.lua;/usr/local/share/lua/5
      └─sh,1234 -c tarantool /usr/local/lib/luarocks/rocks/tarantoolapp/scm-1/bin/tarantoolapp dep
          └─tarantool,1235 /usr/local/lib/luarocks/rocks/tarantoolapp/scm-1/bin/tarantoolapp dep
              ├─sh,1238 -c tarantoolctl rocks install https://raw.githubusercontent.com/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
              │   └─tarantool,1239 /usr/bin/tarantoolctl rocks install ...
              │       └─(sh,1244)
              └─{coio},1237

Here is the process tree of tarantoolapp dep command. Something here is not propagating the exit code to the parent process.

@bofm
Copy link
Author

bofm commented Jul 4, 2018

Trying to debug...

I added a print statement here

if _TARANTOOL == nil then
	local code = os.execute("exec tarantool "..arg[0].." "..table.concat(arg, ' '))
	print('code', code)  -- <----- here
	os.exit(code)
end

and the code appears to be 256

$ make dep
tarantoolapp dep --meta-file ./meta.yaml --tree ./.rocks
Tarantool version: 1.9.0-4-g195d4462d

Error: No results matching query were found.
Using the following options:
---
--tree: ./.rocks
--meta-file: ./meta.yaml
--only:
--luarocks-config: /root/.luarocks/config.lua
...

[zzz] Patch /root/.luarocks/config.lua with proper rocks servers
[zzz] Installing dependencies...
[zzz] Installing tarantool dep 'https://raw.githubusercontent.com/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'
[zzz] tarantoolctl rocks install https://raw.githubusercontent.com/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...
/usr/local/share/lua/5.1/tarantoolapp/commands/dep.lua:72: [zzz] tarantoolctl rocks install https://raw.githubusercontent.com/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz failed
stack traceback:
	...l/lib/luarocks/rocks/tarantoolapp/scm-1/bin/tarantoolapp:81: in function <...l/lib/luarocks/rocks/tarantoolapp/scm-1/bin/tarantoolapp:80>
	[C]: in function 'error'
	/usr/local/share/lua/5.1/tarantoolapp/commands/dep.lua:72: in function 'tarantoolctl_install'
	/usr/local/share/lua/5.1/tarantoolapp/commands/dep.lua:185: in function 'run'
	...l/lib/luarocks/rocks/tarantoolapp/scm-1/bin/tarantoolapp:78: in function <...l/lib/luarocks/rocks/tarantoolapp/scm-1/bin/tarantoolapp:77>
	[C]: in function 'xpcall'
	...l/lib/luarocks/rocks/tarantoolapp/scm-1/bin/tarantoolapp:76: in main chunk
code	256

And this is why we get exit code 0 in the end.

root@739adb137718:/opt/tarantool# lua; echo "$?"
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> os.exit(256)
0

Any ideas?

@bofm
Copy link
Author

bofm commented Jul 4, 2018

I think the solution is to check if os.execute(...) == 0.

os.exit(os.execute("exec tarantool "..arg[0].." "..table.concat(arg, ' ')) == 0 and 0 or 1)

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

Successfully merging a pull request may close this issue.

1 participant