Homebrew / homebrew-core

🍻 Default formulae for the missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
13.57k stars 12.31k forks source link

Upgrade of rsyslog with build-from-source fails if there is an existing config file #177546

Closed logopk closed 1 month ago

logopk commented 1 month ago

brew gist-logs <formula> link OR brew config AND brew doctor output

▶ brew config           
HOMEBREW_VERSION: 4.3.9-267-gdf27448
ORIGIN: https://github.com/Homebrew/brew
HEAD: df27448ea7f92a9f46a5b59b368c3f4b147df6fa
Last commit: 16 hours ago
Core tap HEAD: f148630ef831f3cbece5b01eb584f5431889c3ce
Core tap last commit: 15 hours ago
Core tap JSON: 16 Jul 06:01 UTC
Core cask tap JSON: 16 Jul 06:01 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_MAKE_JOBS: 8
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 3.3.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 15.0.0 build 1500
Git: 2.39.3 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 8.6.0 => /usr/bin/curl
macOS: 14.5-arm64
CLT: 15.3.0.0.1.1708646388
Xcode: 15.4
Rosetta 2: false

▶ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  openssl@1.1

Warning: You have the following deprecated, official taps tapped:
  Homebrew/homebrew-cask-versions
Untap them with `brew untap`.

Warning: Putting non-prefixed coreutils in your path can cause GMP builds to fail.

Warning: You have uncommitted modifications to Homebrew/homebrew-core.
If this is a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be undone
should you later need to do so for some reason.
  cd /opt/homebrew/Library/Taps/homebrew/homebrew-core && git stash -u && git clean -d -f

Uncommitted files:
   M Formula/c/curl.rb
   M Formula/k/kubernetes-cli.rb

Warning: Some taps are not on the default git origin branch and may not receive
updates. If this is a surprise to you, check out the default branch with:
  git -C $(brew --repo logo/local-compose) checkout

Verification

What were you trying to do (and why)?

brew reinstall --build-from-source rsyslog

What happened (include all command output)?

==> Installing rsyslog ==> ./configure --enable-imfile --enable-usertools --enable-diagtools --disable-

==> make ==> make install Error: An exception occurred within a child process: RuntimeError: Will not overwrite /opt/homebrew/etc/rsyslog.conf

What did you expect to happen?

skip

    (etc/"rsyslog.conf").write <<~EOS
      # minimal config file for receiving logs over UDP port 10514
      $ModLoad imudp
      $UDPServerRun 10514
      *.* /usr/local/var/log/rsyslog-remote.log
    EOS

as there is already a more sophisticated conf file.

I know build-from-source is unsupported but is there a way to update the formula to skip this message?

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

brew update

brew upgrade --build-from-source rsyslog

I could fix this with 

brew upgrade --verbose --debug rsyslog
and option 2) ignore

but that ist tiresome
cho-m commented 1 month ago

Might be an issue due to using .write rather than special etc.install logic (which would create/modify rsyslog.conf.default if rsyslog.conf already exists).

Using a temporary file may help like in percona-server: https://github.com/Homebrew/homebrew-core/blob/f4861d055bf1593f5d0b1934b4756cb9ed9e8246/Formula/p/percona-server.rb#L163-L169

logopk commented 1 month ago

Hi, is there anyone in charge of this formula who would be able to fix this? Would it be sufficient for me to post a PR?

I've never mad a PR besides a bump...

branchvincent commented 1 month ago

178928 will fix this

logopk commented 1 month ago

@branchvincent Thank you!