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

/opt/local/sbin/pkg_alternatives: line 623: [: too many arguments #366

Open
drboone opened this issue Sep 19, 2023 · 10 comments
Open

/opt/local/sbin/pkg_alternatives: line 623: [: too many arguments #366

drboone opened this issue Sep 19, 2023 · 10 comments
Assignees

Comments

@drboone
Copy link

drboone commented Sep 19, 2023

Various pkg_alternatives commands generate an error. E.g.

phantom 12 $ pkg_alternatives status go
/opt/local/sbin/pkg_alternatives: line 623: [: too many arguments
`bin/go' points to `/opt/local/go118/bin/go'
    candidate: /opt/local/go118/bin/go
    candidate: /opt/local/go119/bin/go
    candidate: /opt/local/go120/bin/go
`bin/gofmt' points to `/opt/local/go118/bin/gofmt'
    candidate: /opt/local/go118/bin/gofmt
    candidate: /opt/local/go119/bin/gofmt
    candidate: /opt/local/go120/bin/gofmt
`bin/go' points to `/opt/local/go118/bin/go'
    candidate: /opt/local/go118/bin/go
    candidate: /opt/local/go119/bin/go
    candidate: /opt/local/go120/bin/go
`bin/gofmt' points to `/opt/local/go118/bin/gofmt'
    candidate: /opt/local/go118/bin/gofmt
    candidate: /opt/local/go119/bin/gofmt
    candidate: /opt/local/go120/bin/gofmt
`bin/go' points to `/opt/local/go118/bin/go'
    candidate: /opt/local/go118/bin/go
    candidate: /opt/local/go119/bin/go
    candidate: /opt/local/go120/bin/go
`bin/gofmt' points to `/opt/local/go118/bin/gofmt'
    candidate: /opt/local/go118/bin/gofmt
    candidate: /opt/local/go119/bin/gofmt
    candidate: /opt/local/go120/bin/gofmt

This seems to be related to there being nothing much in the database directory:

phantom 19 $ dir /opt/local/share/pkg_alternatives/
total 34
drwxr-xr-x  2 root root    4 Sep 10 09:13 ./
drwxr-xr-x 33 root root   33 Sep 10 09:14 ../
-rw-r--r--  1 root root 2837 Sep  5 01:19 wrapper.man
-rw-r--r--  1 root root 2390 Sep  5 01:19 wrapper.sh

This even after a rebuild.

Have I managed to wound this machine's alternatives setup somehow?

@jperkin
Copy link
Collaborator

jperkin commented Sep 19, 2023

That line is:

[ ! -f ${PKG_DBDIR}/${1}*/+ALTERNATIVES ] && \
            err "no alternatives defined for the \`${1}' package"

That shell code isn't suitable for globs and should really be rewritten. I think the intention is that you should only be specifying a single package name (e.g. go120, and the rest of it is happening by accident.

FWIW on my macOS host:

$ pkg_alternatives status go
pkg_alternatives: the package `go' is not known
$ pkg_alternatives status go121
`bin/go' points to `/opt/pkg/go121/bin/go'
    candidate: /opt/pkg/go119/bin/go
    candidate: /opt/pkg/go121/bin/go
`bin/gofmt' points to `/opt/pkg/go121/bin/gofmt'
    candidate: /opt/pkg/go119/bin/gofmt
    candidate: /opt/pkg/go121/bin/gofmt
$ echo /opt/pkg/.pkgdb/go*/+ALTERNATIVES
/opt/pkg/.pkgdb/go119-1.19.12/+ALTERNATIVES /opt/pkg/.pkgdb/go121-1.21.1/+ALTERNATIVES

i.e. I'm not getting the same error, so I guess there's an earlier check that is somehow passing for you.

@jperkin jperkin self-assigned this Sep 19, 2023
@drboone
Copy link
Author

drboone commented Sep 19, 2023

On the smartos machine, there is a go package, which is a meta for whatever is deemed the current release. That's probably what gets mine past the earlier checks.

@jperkin
Copy link
Collaborator

jperkin commented Sep 19, 2023

Oh ok, yeh those packages are fundamentally incompatible with pkg_alternatives and I usually remove them completely from our package sets (e.g lang/ruby). I think we decided to leave the go package as it was highly likely that people would want to pkgin install go, but it does result in problems like this.

@drboone
Copy link
Author

drboone commented Sep 19, 2023

That leads me to this question - there are a few other places, python is the one that comes to mind, where not being able to install one package name and get whatever is deemed current is a headache that leads to hardcoding versions in a bunch of playbooks, and the obvious downstream headache. Is there a better solution?

@jperkin
Copy link
Collaborator

jperkin commented Sep 19, 2023

Personally I think the best solution is being specific about the versions you want to install. Yes this means you may need to update them every so often, but at least you are then explicit about opting into a new version that has been tested with the rest of your stack, and the versions aren't bumped all that often.

The alternative would be for me to provide e.g. go-latest, python-latest meta-packages that pull in the latest, but that wouldn't be without problems. For example the latest, i.e. newest, version may not be what pkgsrc is currently using as the default, and may not be suitable (e.g. say we import a new python312 but lots of modules aren't yet compatible with it and we keep the default at python311 for a reasonable length of time).

@drboone
Copy link
Author

drboone commented Sep 19, 2023

One of the worst problems I have, which I end up fixing (it seems like) several times per year, is that the python offered on the gz tools platform only includes pip for one version. I never seem to notice in advance that an update to that is coming, and suddenly playbooks are crashing. So maybe the underpinning problem is that I need to figure out what to follow in order to know when to pre-emptively fix playbooks. There are a few other things that I retroactively discover -- I think the reason I have go installed on this one system is that some combination of numbered go packages progressing, and rabid dependency updates in stuff I go install kept driving me batty.

@jperkin
Copy link
Collaborator

jperkin commented Sep 20, 2023

Hmm, could you explain the pip issue a bit more? It looks like we don't ship pip in the gz tools set yet, so perhaps if we start doing that it should solve your issue.

Please make sure you raise issues for any problems that you hit, we want to be able to fix them!

@jperkin
Copy link
Collaborator

jperkin commented Sep 20, 2023

Oh, ignore part of that - while we don't explicitly list devel/py-pip in our tools builds, it does look like it's built as part of a dependency, and so yeh it will only be built for the current version of python (currently python 3.11).

@jperkin
Copy link
Collaborator

jperkin commented Sep 20, 2023

Ok I've added devel/py-pip to the tools build, so now there are versions of pip for all available python releases:

$ pkgin se py.*pip
py310-pip-23.2.1     Installs Python packages as an easy_install replacement
py311-pip-23.2.1     Installs Python packages as an easy_install replacement
py38-pip-23.2.1      Installs Python packages as an easy_install replacement
py39-pip-23.2.1      Installs Python packages as an easy_install replacement

I think this should help with the issue you had?

@drboone
Copy link
Author

drboone commented Sep 20, 2023

Will definitely help. Thanks!

jperkin pushed a commit that referenced this issue Nov 7, 2023
[2.1.0] - 2023-10-30

Features & Improvements

    Added support for Python 3.12 #379
    Added CONTRIBUTING.md document #331
    Added tests/ directory to sdist artifact #327

Bug fixes

    Fixed subcommand completions for Fish #359
    Removed deprecated -A option from Fish completions #366
    Fixed program name discovery in completions script when running as module #231
    Fixed ANSI coloring detection in virtual terminal environments (Windows, PyCharm) #104
    Fixed terminal size detection #299
jperkin pushed a commit that referenced this issue Feb 1, 2024
# xml2 1.3.6

* Now compatible with libxml2 2.12.0 and later (@KNnut).

* Fixed format string issues detected in R-devel.

* Remove unused dependencies on glue, withr and lifecycle (@mgirlich).

* `print()` is faster for very long `xml_nodeset` inputs (#366, @MichaelChirico).

* `xml_attr()`, `xml_attrs()`, `xml_double()`, `xml_integer()`, `xml_length()`,
  `xml_name()`, `xml_path()`, `xml_text()`, and `xml_type()` no longer use
  S3 dispatch but instead dispatch in C, leading to considerable performance
  improvements in many cases (@mgirlich, #400).

* `xml_find_int()` analogous to `xml_find_num()` for returning integers
  matched by an XPath (#365, @MichaelChirico).

* `xml_serialize()` now includes the document type so that `xml_unserialize()`
  works also for HTML documents (#407, @HenrikBengtsson).

# xml2 1.3.5

* Small speedup for `xml_find_all()` (@mgirlich, #393).

* Fixes for R CMD check problems.

# xml2 1.3.4

* Fixes for R CMD check problems.

* Windows: update to libxml2 2.10.3

# xml2 1.3.3

* Hadley Wickham is now (again) the maintainer.

* xml2 has been re-licensed as MIT (#317).

* `xml_find_all.xml_node()` fails more informatively the `xpath` parameter is the wrong type (@MichaelChirico)

* `xml_find_all.xml_nodeset()` gains a `flatten` argument to control whether to return a single nodeset or a list of nodesets (#311, @jakejh)

* `write_xml()` and `write_html()` now return NULL invisibly, as they did prior to version 1.3.0 (#307)

* `XPtr` gets explicit copy constructor and assignment operator definitions, which were two missing components of the [Rule of three](https://en.wikipedia.org/wiki/Rule_of_three_(C%2B%2B_programming)) (@MichaelChirico)

* Windows: update to libxml2 2.9.10 and libxslt 1.1.34 and add ucrt libs
jperkin pushed a commit that referenced this issue Mar 4, 2024
v0.17.0 is a new release with a lot of features, bug fixes, and specifically a
patch fixing a very annoying Spotify API bug.

This release also marks a big milestone for the project: 1k ⭐ 🥳🥳🥳 .
Thanks everyone for contributing, using, and starring the project!

What's Changed
    Add custom text input widget with cursor, to use in search page by @micleo2 in #329
    chore: update github actions by @LucasFA in #339
    reset buffered playback upon handling GetCurrentPlayback request by @aome510 in #341
    docs: fixes keymap command name by @massivebird in #342
    chore(docs): Remove unneeded explicit link by @LucasFA in #344
    Wait for the copy command to exit. by @Fuyukai in #346
    build: use cross for cross-compilation, locally and in CD by @LucasFA in #343
    feat: Souvlaki 0.7.0 and Linux Dbus volume control support by @LucasFA in #348
    extend capabilities for ShowActionsOn* commands by @aome510 in #352
    handle title padding with hidden borders by @aome510 in #351
    update dependencies, bump lyric_finder to v0.1.5 by @aome510 in #353
    Add miscellaneous UI code changes by @aome510 in #354
    update issue templates by @aome510 in #366
    fix clippy warning by @aome510 in #367
    re-create a new session when restarting the integrated client by @aome510 in #370
    Don't create streaming connections for non-streaming instances by @Schnouki in #371
    Remove winit from compilation on Linux by @LucasFA in #372
    Explicit cargo-binstall support by @LucasFA in #377
    Add popup for creating new playlist by @aome510 in #379
    Make Daemon feature imply streaming feature by @LucasFA in #376
    use liked icon's length to configure the column's width by @aome510 in #380
    Patch spotify API bugs by @aome510 in #386
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

No branches or pull requests

2 participants