Allow `ensure` to accept binary parameter, as done in `update`
pataquets opened this issue · 12 comments
Having a bin configuration shared between several machines, but not all binaries needed on all of machines.
The idea would be, for instance, to use bin e rclone
only on machines where it's needed.
fixed and 🚢 in v0.17.0
thanks for the feedback!
Thanks, @marcosnils. However, I'm experiencing problems (two different systems):
🕙[ 09:00:42 PM ] 🎯 ❯ bin e --debug ~/.local/bin/rclone
• debug logs enabled, version: 0.17.0
commit: 00e1249bd86fa32c5cde053c8f19afb6efd1c95f
built at: 2023-07-19T01:30:30Z
built by: goreleaser
• Config directory is: /home/amontero/.config/bin
• Download path set to $HOME/.local/bin
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xac4d18]
goroutine 1 [running]:
github.com/marcosnils/bin/cmd.newEnsureCmd.func1(0xc00037cc00?, {0xc000452500, 0x1, 0x2?})
/home/marcos/Projects/bin/cmd/ensure.go:48 +0x118
github.com/spf13/cobra.(*Command).execute(0xc00037cc00, {0xc0004524e0, 0x2, 0x2})
/home/marcos/Projects/gopath/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0xc00037c600)
/home/marcos/Projects/gopath/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:1044 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
/home/marcos/Projects/gopath/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:968
github.com/marcosnils/bin/cmd.(*rootCmd).Execute(0xc0000a12a8, {0xc0000aa050, 0x3, 0xb4f060?})
/home/marcos/Projects/bin/cmd/root.go:35 +0x165
github.com/marcosnils/bin/cmd.Execute({0xc0000fe1c0, 0x6b}, 0xdf22a0?, {0xc0000aa050, 0x3, 0x3})
/home/marcos/Projects/bin/cmd/root.go:25 +0xbb
main.main()
/home/marcos/Projects/bin/main.go:21 +0x97
Another, different host:
pataquets@cloudshell:~ $ bin --debug e ~/.local/bin/rclone
• debug logs enabled, version: 0.17.0
commit: 00e1249bd86fa32c5cde053c8f19afb6efd1c95f
built at: 2023-07-19T01:30:30Z
built by: goreleaser
• Config directory is: /home/pataquets/.config/bin
• Download path set to $HOME/.local/bin
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xac4d18]
goroutine 1 [running]:
github.com/marcosnils/bin/cmd.newEnsureCmd.func1(0xc0002fcc00?, {0xc0003d4500, 0x1, 0x2?})
/home/marcos/Projects/bin/cmd/ensure.go:48 +0x118
github.com/spf13/cobra.(*Command).execute(0xc0002fcc00, {0xc0003d44e0, 0x2, 0x2})
/home/marcos/Projects/gopath/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0xc0002fc600)
/home/marcos/Projects/gopath/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:1044 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
/home/marcos/Projects/gopath/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:968
github.com/marcosnils/bin/cmd.(*rootCmd).Execute(0xc000097278, {0xc0000a2050, 0x3, 0xb4f060?})
/home/marcos/Projects/bin/cmd/root.go:35 +0x165
github.com/marcosnils/bin/cmd.Execute({0xc0000fc1c0, 0x6b}, 0xdf22a0?, {0xc0000a2050, 0x3, 0x3})
/home/marcos/Projects/bin/cmd/root.go:25 +0xbb
main.main()
/home/marcos/Projects/bin/main.go:21 +0x97
can you try with bin -e rclone
instead? Taking a look at this bug.
Sure. Here you are:
$ bin | grep rclone
/home/amontero/.local/bin/rclone v1.62.2 github.com/rclone/rclone OK
$ which rclone
/home/amontero/.local/bin/rclone
$ rclone --version
rclone v1.62.2
- os/version: ubuntu 18.04 (64 bit)
- os/kernel: 4.15.0-213-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.20.2
- go/linking: static
- go/tags: none
$ bin -e rclone
⨯ command failed error=unknown shorthand flag: 'e' in -e
$ bin e rclone
$ bin e --debug rclone
• debug logs enabled, version: 0.17.0
commit: 00e1249bd86fa32c5cde053c8f19afb6efd1c95f
built at: 2023-07-19T01:30:30Z
built by: goreleaser
• Config directory is: /home/amontero/.config/bin
• Download path set to $HOME/.local/bin
$ rclone --version
rclone v1.62.2
- os/version: ubuntu 18.04 (64 bit)
- os/kernel: 4.15.0-213-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.20.2
- go/linking: static
- go/tags: none
Checked it, and there's a newer rclone
version.
wait, but bin e rclone
will only download rclone
if the binary doesn't exist. If you want to take it to the latest version you need to use bin update rclone
.
That's why when you're doing bin e rclone
is not doing anything.. because the binary is there.
Sorry, I've tested with the wrong binary 🤦 (both hosts have rclone)
Anyway, the panic is quite confusing.
Testing with binary not present (as intended):
$ rm ~/.local/bin/rclone
$ bin -e rclone
⨯ command failed error=unknown shorthand flag: 'e' in -e
$ bin e rclone
• Getting latest release for rclone/rclone
• Starting download of https://api.github.com/repos/rclone/rclone/releases/assets/117582938
17.14 MiB / 17.14 MiB [--------------------------------------------------------------------------------------] 100.00% 656.43 KiB p/s 27s
Multiple matches found, please select one:
[1] rclone-v1.63.1-linux-amd64/README.html
[2] rclone-v1.63.1-linux-amd64/README.txt
[3] rclone-v1.63.1-linux-amd64/git-log.txt
[4] rclone-v1.63.1-linux-amd64/rclone
[5] rclone-v1.63.1-linux-amd64/rclone.1
Select an option: 4
• Copying for rclone@v1.63.1 into /home/amontero/.local/bin/rclone
• Done ensuring $HOME/.local/bin/rclone to v1.62.2
$ rclone --version
rclone v1.63.1
- os/version: ubuntu 18.04 (64 bit)
- os/kernel: 4.15.0-213-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.20.6
- go/linking: static
- go/tags: none
Works as intended, and no panic.
After deleting rclone
, using bin e ~/.local/bin/rclone
still panics.
It might not be related to this commit, but to using full path or just binary name?
@marcosnils Another clue: something similar happens with bin u rclone
vs. bin u ~/.local/bin/rclone
.
It might not be related to this commit, but to using full path or just binary name?
please try removing the binary and running bin e rclone
It's done above, afaict (and it worked). If you need something different, let me know.
It's done above, afaict (and worked). If you need something different, let me know.
gotcha perfect. I'll check the panic bug afterwards then. Just wanted to check that worked for you.
Sure. Thank you very much!