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

Allow ensure to accept binary parameter, as done in update #167

Closed
pataquets opened this issue Jul 18, 2023 · 12 comments · Fixed by #168
Closed

Allow ensure to accept binary parameter, as done in update #167

pataquets opened this issue Jul 18, 2023 · 12 comments · Fixed by #168

Comments

@pataquets
Copy link

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.

marcosnils added a commit that referenced this issue Jul 19, 2023
fixes #167

Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
marcosnils added a commit that referenced this issue Jul 19, 2023
fixes #167

Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
@marcosnils
Copy link
Owner

fixed and 🚢 in v0.17.0

thanks for the feedback!

@pataquets
Copy link
Author

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

@marcosnils
Copy link
Owner

can you try with bin -e rclone instead? Taking a look at this bug.

@pataquets
Copy link
Author

pataquets commented Jul 19, 2023

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.

@marcosnils
Copy link
Owner

marcosnils commented Jul 19, 2023

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.

@pataquets
Copy link
Author

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.

@pataquets
Copy link
Author

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?

@pataquets
Copy link
Author

@marcosnils Another clue: something similar happens with bin u rclone vs. bin u ~/.local/bin/rclone.

@marcosnils
Copy link
Owner

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

@pataquets
Copy link
Author

pataquets commented Jul 19, 2023

It's done above, afaict (and it worked). If you need something different, let me know.

@marcosnils
Copy link
Owner

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.

@pataquets
Copy link
Author

Sure. Thank you very much!

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.

2 participants