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

brew update prints to stdout #10609

Closed
1 task done
kbadk opened this issue Feb 12, 2021 · 7 comments
Closed
1 task done

brew update prints to stdout #10609

kbadk opened this issue Feb 12, 2021 · 7 comments
Labels
bug Reproducible Homebrew/brew bug outdated PR was locked due to age

Comments

@kbadk
Copy link

kbadk commented Feb 12, 2021

brew config output

  HOMEBREW_VERSION: 3.0.1-36-ge2cbc91-dirty <-- Due to diagnostic `puts` and `set -x` lines.
  ORIGIN: https://github.com/Homebrew/brew
  HEAD: e2cbc916891861a461a4fcc81303a04118bb79ca
  Last commit: 54 minutes ago
  Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
  Core tap HEAD: 0a7da28732c97d99858f28671c014ef17d55b066
  Core tap last commit: 4 minutes ago
  Core tap branch: master
  HOMEBREW_PREFIX: /usr/local
  HOMEBREW_CASK_OPTS: []
  HOMEBREW_EDITOR: cw
  HOMEBREW_MAKE_JOBS: 12
  HOMEBREW_NO_AUTO_UPDATE: set
  Homebrew Ruby: 2.6.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3_2/bin/ruby
  CPU: dodeca-core 64-bit kabylake
  Clang: 12.0 build 1200
  Git: 2.30.0 => /usr/local/bin/git
  Curl: 7.64.1 => /usr/bin/curl
  macOS: 10.15.7-x86_64
  CLT: 11.0.33.17
  Xcode: 12.3

brew doctor output

Your system is ready to brew.

  • The brew doctor above contains no "Warning" lines.

What were you trying to do (and why)?

Run brew update in a cronjob (no tty).

What happened (include all command output)?

The following line

Updated 3 taps (homebrew/core, homebrew/cask and homebrew/services).

was sent to stderr (might be related to https://github.com/Homebrew/brew/pull/10537/files) instead of stdout, although it is clearly not an error.

What did you expect to happen?

The same as what happened until a few days ago: Regular non-error output is sent to stdout, so cron doesn't send me mails.

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

  1. Put /usr/local/bin/brew update >> /some/path/brew-log in a cronjob.
  2. Wait for the cronjob to run and update packages.
  3. Open a new terminal and notice that you've received mail from cron ("You have mail").
@kbadk kbadk added the bug Reproducible Homebrew/brew bug label Feb 12, 2021
@MikeMcQuaid
Copy link
Member

This is intentional behaviour for non-TTYs so that e.g. $(brew bundle list) won't output invalid output when it auto-updates.

@kbadk
Copy link
Author

kbadk commented Feb 12, 2021

I don't see how it's intentional that non-errors are sent to standard error.

If this is intentional, was the previous behavior – the behavior that has existed for years where regular output was sent to stdout – "unintentional"? Just trying to figure out how this sudden regression can be considered intentional.

@MikeMcQuaid
Copy link
Member

I don't see how it's intentional that non-errors are sent to standard error.

It was an intentional change because we made a pull request to change this behaviour.

If this is intentional, was the previous behavior – the behavior that has existed for years where regular output was sent to stdout – "unintentional"?

Yes: the side-effect of having these messages output to a TTY was a shortcoming given our typical brew update workflow is through autoupdate.

@brorbw
Copy link

brorbw commented Feb 12, 2021

This seems like a misuse of stderr. I get why some might consider it easier to send to stderr but its clearly not the right place to send the message.

@MikeMcQuaid
Copy link
Member

We do this already in several places e.g. printing the tapping output.

@dkav
Copy link
Contributor

dkav commented Mar 5, 2021

@MikeMcQuaid what is your recommendation for dealing with the issue @kbadk reported? Redirect all output and ignore errors? The new addition to the update-report is also being added to stderr.

@MikeMcQuaid
Copy link
Member

@dkav We do not consider it an issue. My recommendation is not not to do anything.

@github-actions github-actions bot added the outdated PR was locked due to age label Apr 8, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Reproducible Homebrew/brew bug outdated PR was locked due to age
Projects
None yet
Development

No branches or pull requests

4 participants