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

[Bug]: GNU stty: 'standard input': unable to perform all requested operations #2027

Closed
1 task done
xiaozhuai opened this issue May 17, 2024 · 7 comments
Closed
1 task done
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@xiaozhuai
Copy link

xiaozhuai commented May 17, 2024

What did you expect to happen?

No warnning.

What happened?

It shows

stty: 'standard input': unable to perform all requested operations

How to repro:

  1. Input ls -al
  2. Press Enter
  3. Press Up
  4. Press Enter

But the following is ok with no warning

  1. Input ls -al
  2. Press Enter
  3. Press Up
  4. Press Tab
  5. Press Enter

BTW, I use bash on macOS, and install bash-preexec using brew.

[ -f /opt/homebrew/etc/profile.d/bash-preexec.sh ] && . /opt/homebrew/etc/profile.d/bash-preexec.sh
eval "$(atuin init bash)"

Atuin doctor output

Atuin Doctor
Checking for diagnostics

[Shell] If you are using Bash, Atuin requires that either bash-preexec or ble.sh be installed. An older ble.sh may not be detected. so ignore this if you have it set up! Read more here: https://docs.atuin.sh/guide/installation/#bash

Please include the output below with any bug reports or issues

atuin:
  version: 18.2.0
  sync: null
shell:
  name: bash
  default: bash
  plugins:
  - atuin
system:
  os: Darwin
  arch: arm64
  version: '14.5'
  disks:
  - name: MacHD
    filesystem: apfs
  - name: MacHD
    filesystem: apfs
  - name: Backup
    filesystem: apfs
  - name: Share
    filesystem: tuxera_ntfs
  - name: ForMac
    filesystem: hfs

Code of Conduct

  • I agree to follow this project's Code of Conduct
@xiaozhuai xiaozhuai added the bug Something isn't working label May 17, 2024
@akinomyoga
Copy link
Contributor

BTW, I use bash on macOS, and install bash-preexec using brew.

[ -f /opt/homebrew/etc/profile.d/bash-preexec.sh ] && . /opt/homebrew/etc/profile.d/bash-preexec.sh
eval "$(atuin init bash)"

The setup might not be working correctly. Your result of atuin doctor contains the following message:

[Shell] If you are using Bash, Atuin requires that either bash-preexec or ble.sh be installed. An older ble.sh may not be detected. so ignore this if you have it set up! Read more here: https://docs.atuin.sh/guide/installation/#bash

This implies that the bash-preexec is not detected in interactive sessions. What is the result of the following commands (in a session where the error message arises)?

$ ls -la /opt/homebrew/etc/profile.d/bash-preexec.sh
$ declare -p __bp_imported

If you also use ble.sh, it might also be related to ble.sh. I received a report to ble.sh with the same error message in macOS but couldn't get the details. Although I don't have a macOS system, it doesn't seem to reproduce in all the macOS environments since I only received the report twice (including this) although there are many macOS users. If it is related to ble.sh, I need your help to identify the cause.

If you use ble.sh, could you check the results of the following commands?

$ type -a stty
$ declare -p _ble_term_stty_flags_{enter,leave}
$ type ble/bin/stty

@xiaozhuai
Copy link
Author

$ ls -la /opt/homebrew/etc/profile.d/bash-preexec.sh
$ declare -p __bp_imported
image

I didn't install ble.sh

$ type -a stty
$ declare -p _ble_term_stty_flags_{enter,leave}
$ type ble/bin/stty
image

@xiaozhuai
Copy link
Author

xiaozhuai commented May 17, 2024

Ok, I got it. I install gnu coreutils, which provide a stty in /opt/homebrew/opt/coreutils/libexec/gnubin/stty.
After I remove /opt/homebrew/opt/coreutils/libexec/gnubin from PATH, it works without warning.
But when I exec atuin doctor, the warning is still there, is it safe to ignore?

[Shell] If you are using Bash, Atuin requires that either bash-preexec or ble.sh be installed. An older ble.sh may not be detected. so ignore this if you have it set up! Read more here: https://docs.atuin.sh/guide/installation/#bash

Why atuin didn't work with gnu coreutils?

@xiaozhuai
Copy link
Author

image

The stty is bsd stty provided by macOS.
The gstty is gnu stty provided by coreutils package in homebrew.

@akinomyoga
Copy link
Contributor

Ok, I got it. I install gnu coreutils, which provide a stty in /opt/homebrew/opt/coreutils/libexec/gnubin/stty. After I remove /opt/homebrew/opt/coreutils/libexec/gnubin from PATH, it works without warning.

OK. It is known that stty from GNU coreutils doesn't work in macOS. You should set PATH up so that /bin/stty is found first. For example, you can put a symbolic link to /bin/stty in ~/bin or some directory appearing in PATH earlier than /opt/homebrew/opt/coreutils/libexec/gnubin.

But when I exec atuin doctor, the warning is still there, is it safe to ignore?

[Shell] If you are using Bash, Atuin requires that either bash-preexec or ble.sh be installed. An older ble.sh may not be detected. so ignore this if you have it set up! Read more here: https://docs.atuin.sh/guide/installation/#bash

The first picture of #2027 (comment) tells that bash-preexec is correctly loaded in your session, so you can ignore the above warning message. The detection by atuin doctor is not perfect, so it might raise a false-positive error.

Why atuin didn't work with gnu coreutils?

Because Atuin uses stty in its integration for bash-preexec. If stty in the system is not working, it causes a problem.

@xiaozhuai
Copy link
Author

@akinomyoga Thank you very much.

If stty in the system is not working, it causes a problem.

I've tried gnu's stty, it works well. Anything I can do to help?

@ellie
Copy link
Member

ellie commented May 25, 2024

I've tried gnu's stty, it works well

Given the existence of this issue, I don't think this statement is accurate.

Using a mixed userspace is unlikely to work well across tools. Please use the BSD/macOS stty - I can't think of a reason as to why you'd prefer to use the GNU one?

@ellie ellie closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2024
@ellie ellie changed the title [Bug]: stty: 'standard input': unable to perform all requested operations [Bug]: GNU stty: 'standard input': unable to perform all requested operations May 25, 2024
@ellie ellie added the wontfix This will not be worked on label May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants