ericm / yup

Arch Linux AUR Helper with ncurses functionality and better searching and sorting
https://aur.archlinux.org/packages/yup
GNU General Public License v3.0
139 stars 7 forks source link

panic after refusing to install dependencies #38

Closed elder-n00b closed 2 years ago

elder-n00b commented 2 years ago

Are you on latest version of yup?

Yes (yup-bin 1.1.7-1)

Steps to Reproduce the Problem

  1. yup dotbare, install
  2. refuse installing ruby (Numbers of packages not to install? (eg: 1 2 3, 1-3 or ^4): 1)
  3. refuse installing ruby-rdoc rubygems (Numbers of packages not to install? (eg: 1 2 3, 1-3 or ^4): 1 2 or 1-2)
  4. slice bounds out of range

Other Details

yup dotbare
[...removed for brevity...]
==> View, see Diffs or Edit the PKGBUILD? (All or None):
==> Checking for dependencies
==> Found uninstalled Dependencies:
    1 ruby
==> Numbers of packages not to install? (eg: 1 2 3, 1-3 or ^4): 1
==> Found uninstalled Make Dependencies:
    1 ruby-rdoc  2 rubygems
==> Numbers of packages not to install? (eg: 1 2 3, 1-3 or ^4): 1-2
panic: runtime error: slice bounds out of range [2:1]

goroutine 1 [running]:
github.com/ericm/yup/sync.ParseNumbersDep({0xc00041c98c, 0xc000010018}, 0xc0004eae78)
    /home/eric/yup/sync/sync.go:232 +0x2cd
github.com/ericm/yup/sync.(*PkgBuild).Install(0xc00010c630, 0x0, 0x0)
    /home/eric/yup/sync/sync.go:458 +0x149d
github.com/ericm/yup/sync.Sync({0xc0004eb4e0, 0x1, 0x0}, 0x1, 0x0)
    /home/eric/yup/sync/sync.go:99 +0x1c5
github.com/ericm/yup/search.SortPacks({0x7ffe02d3f929, 0xc000095cb0}, {0xc00012c2c0, 0x1, 0x1})
    /home/eric/yup/search/search.go:475 +0x4bb
github.com/ericm/yup/cmd.(*Arguments).getActions(0x901a60)
    /home/eric/yup/cmd/cmd.go:222 +0x1379
github.com/ericm/yup/cmd.Execute()
    /home/eric/yup/cmd/cmd.go:102 +0x15f
main.main()
    /home/eric/yup/main.go:42 +0xef

https://github.com/ericm/yup/blob/27694a2a4a38a55155f5b55122233a3ba6591299/sync/sync.go#L232 I have not tried with other packages but looks like it's unrelated. By the way those Ruby dependencies are optional for this package:

depends=('fzf')
optdepends=(
    'tree: Provide a directory tree view when finding directory'
    'bat: Syntax highlighting when previewing files'
    'highlight: Syntax highlighting when previewing files'
    'ruby-coderay: Syntax highlighting when previewing files'       # <==
    'git-delta: Fancy git diff preview'
    'diff-so-fancy: Fancy git diff preview')

and fzf, tree, bat, git-delta were already installed.

P.S. nice work, I love TUI programs. Page up/down would be nice to have while I'm at it.

ericm commented 2 years ago

Fix should be pushed in next release.