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

Command "brew update" shows "/dev/stdin: No such file or directory - /tmp/sh-thd-2853475760 (deleted) (Errno::ENOENT)" #17008

Closed
1 of 2 tasks
azhongzl opened this issue Apr 2, 2024 · 8 comments · Fixed by #17204
Labels
help wanted We want help addressing this stale No recent activity

Comments

@azhongzl
Copy link

azhongzl commented Apr 2, 2024

  • your problem was from running the official install or uninstall script?
  • after installation: ran brew config and brew doctor and included their output with your issue? If you couldn't install: provided your OS version with the output of your issue?
brew config

HOMEBREW_VERSION: 4.2.16
ORIGIN: https://github.com/Homebrew/brew
HEAD: bd1155be8f50998429a795c15a69c8fe75250510
Last commit: 28 hours ago
Core tap JSON: 02 Apr 19:11 UTC
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: vim
HOMEBREW_MAKE_JOBS: 48
Homebrew Ruby: 3.1.4 => /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: 48-core 64-bit zen3
Clang: N/A
Git: 2.40.1 => /bin/git
Curl: 8.3.0 => /bin/curl
Kernel: Linux 5.10.213-179.855.amzn2int.x86_64 x86_64 GNU/Linux
OS: Amazon Linux 2
Host glibc: 2.26
/usr/bin/gcc: 7.3.1
/usr/bin/ruby: 2.0.0
glibc: 2.35_1
gcc@11: N/A
gcc: 13.2.0
xorg: N/A
brew doctor

Your system is ready to brew.

What you were trying to do (and why)

I am trying to run brew update to update brew.

What happened (include command output)

Run below command

brew update
Command output

brew update

/dev/stdin: No such file or directory - /tmp/sh-thd-2853451899 (deleted) (Errno::ENOENT)
==> Updating Homebrew...
Already up-to-date.

What you expected to happen

Brew updates successfully without error like /dev/stdin: No such file or directory - /tmp/sh-thd-2853451899 (deleted) (Errno::ENOENT)

Step-by-step reproduction instructions (by running brew commands)

brew update
@MikeMcQuaid
Copy link
Member

How are you running this? SSH?

@MikeMcQuaid MikeMcQuaid transferred this issue from Homebrew/install Apr 2, 2024
@azhongzl
Copy link
Author

azhongzl commented Apr 2, 2024

Steps to reproduce:

  1. launch iTerm2 on Mac
  2. ssh to the remote host
  3. run command brew update

Same happens if I

  1. launch dcv-viewer and connect to the remote host
  2. launch a terminal
  3. run command brew update

It worked before but just failed recently

@MikeMcQuaid
Copy link
Member

@azhongzl Can you reproduce on any other hosts or Linux machines? How long has this been happening? What user are you running as?

@azhongzl
Copy link
Author

azhongzl commented Apr 2, 2024

How long has this been happening?

It worked before but just started to fail yesterday

What user are you running as?

I run with my own user but should have every permissions.

@Bo98
Copy link
Member

Bo98 commented Apr 2, 2024

Sounds like something weird is happening with the way your system interacts with herestrings.

I'm guessing changing

if [[ -x "${ruby}" ]] && "${ruby}" /dev/stdin <<<"exit(RUBY_VERSION >= '1.8.7')"
then
"${ruby}" /dev/stdin <<<"File.new(${lock_fd}).flock(File::LOCK_EX | File::LOCK_NB) || exit(1)"

to be (echo "exit(RUBY_VERSION >= '1.8.7')" | "${ruby}" /dev/stdin) might fix things? And similarly on the line below.

@azhongzl
Copy link
Author

azhongzl commented Apr 2, 2024

Thanks @Bo98. So the issue is caused by using an old version of ruby.

/usr/bin/ruby is hardcoded in above code.

local ruby="/usr/bin/ruby"

In my env, /usr/bin/ruby is old

/usr/bin/ruby -v
ruby 2.0.0p648 (2015-12-16) [x86_64-linux]

The one on the path is latest

ruby -v
ruby 2.7.8p225 (2023-03-30 revision 1f4d455848) [x86_64-linux]

Run with old ruby, there are errors:

/usr/bin/ruby /dev/stdin <<< "exit(RUBY_VERSION >= '1.8.7')"
/dev/stdin: No such file or directory - /tmp/zshFl0HSh (deleted) (Errno::ENOENT)

Run with latest ruby, no issues:

ruby /dev/stdin <<< "exit(RUBY_VERSION >= '1.8.7')"

Can brew code use the default ruby on path instead of hardcoding?

@Bo98
Copy link
Member

Bo98 commented Apr 2, 2024

Maybe, though ideally we'd fix 2.0 otherwise we would need to bump the 1.8.7 requirement (though the requirement check itself is broken which is not good).

There's perhaps also an argument of hoisting the flock condition to the top:

elif [[ -x "$(type -P flock)" ]]
then
flock -n "${lock_fd}"

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted We want help addressing this stale No recent activity
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants