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

bash completion generates "nosort" error on macOS with Bash v3 #883

Closed
jordan-brough opened this issue Sep 7, 2023 · 5 comments
Closed
Labels
bug Something isn't working

Comments

@jordan-brough
Copy link

jordan-brough commented Sep 7, 2023

Describe the bug

I started getting this error (warning?) when opening a new Terminal window on macOS:

-bash: complete: nosort: invalid option name

I'm running Bash v3:

$ bash --version
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin22)
Copyright (C) 2007 Free Software Foundation, Inc.

The error is happening during /opt/homebrew/etc/bash_completion.d/rtx on my system, which is this: https://github.com/jdx/rtx/blob/f333ac5f8e8de399fcb3ce40576baeef0271081b/completions/rtx.bash#L3482

If I remove the -o nosort from that line then the error stops.

This looks related? https://lists.zx2c4.com/pipermail/wireguard/2018-October/003418.html

rtx doctor output

Click to show
rtx doctor
rtx version:
  2023.9.0 macos-arm64 (f333ac5 2023-09-05)

build:
  Target: aarch64-apple-darwin
  Features: DEFAULT, NATIVE_TLS, OPENSSL
  Built: Tue, 05 Sep 2023 14:24:44 +0000
  Rust Version: rustc 1.72.0 (5680fa18f 2023-08-23)
  Profile: release

shell:
  /bin/bash
  GNU bash, version 3.2.57(1)-release (arm64-apple-darwin22)
  Copyright (C) 2007 Free Software Foundation, Inc.

rtx data directory:
  /Users/jordan/.local/share/rtx

rtx environment variables:
  RTX_SHELL=bash

settings:
  {"always_keep_download": "false", "always_keep_install": "false", "asdf_compat": "false", "disable_default_shorthands": "false", "disable_tools": "[]", "experimental": "false", "jobs": "4", "legacy_version_file": "true", "legacy_version_file_disable_tools": "[]", "log_level": "INFO", "missing_runtime_behavior": "warn", "plugin_autoupdate_last_check_duration": "10080", "raw": "false", "trusted_config_paths": "[]", "verbose": "false", "yes": "false"}

config files:
  /Users/jordan/.config/rtx/config.toml
  /Users/jordan/.tool-versions

plugins:
  go       (core)
  java     (core)
  node     https://github.com/asdf-vm/asdf-nodejs.git#644ada3
  python   (core)
  ruby     https://github.com/asdf-vm/asdf-ruby.git#f167b05

toolset:
  ruby@3.2.0, node@18.12.1

No problems found
@jordan-brough jordan-brough added the bug Something isn't working label Sep 7, 2023
@jordan-brough jordan-brough changed the title bash completion generates error on macOS with Bash v3 bash completion generates "nosort" error on macOS with Bash v3 Sep 7, 2023
@jdx
Copy link
Owner

jdx commented Sep 14, 2023

this is generated (currently, I have some plans to change this) by clap_complete. I'm not sure if bash 3.x is a supported target or not, but if it is, this would need to be addressed upstream

@jdx jdx closed this as not planned Won't fix, can't repro, duplicate, stale Sep 14, 2023
@skittishdev
Copy link

skittishdev commented Sep 19, 2023

I have the same problem with bash 5.2.15 on macOS for rtx installed via brew

bash --version
GNU bash, version 5.2.15(1)-release (x86_64-apple-darwin21.6.0)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Every time I run brew upgrade, I have to update the completion script to remove -o nosort

@jdx
Copy link
Owner

jdx commented Sep 19, 2023

@skittishdev are you certain that the bash you're running isn't v3? try echo $BASH_VERSION. nosort was added in bash v4 it looks like

@skittishdev
Copy link

Oops, you're right @jdx . Sorry!

echo $BASH_VERSION
3.2.57(1)-release

@noahm
Copy link

noahm commented Apr 16, 2024

Just ran across this today with default MacOS bash, and noticed that clap_complate merged a fix a few months ago, released in v4.4.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants