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

--overwrite should always overwrite links #16864

Open
1 task done
JOJ0 opened this issue Mar 9, 2024 · 8 comments
Open
1 task done

--overwrite should always overwrite links #16864

JOJ0 opened this issue Mar 9, 2024 · 8 comments
Labels
features New features help wanted We want help addressing this

Comments

@JOJ0
Copy link

JOJ0 commented Mar 9, 2024

Verification

Provide a detailed description of the proposed feature

I'm sorry for posting this as an issue here, I would have rather opened a discussion about it, if that where available here. Sorry again, you might not like that I'm simply asking a question and am not sure if I even have a feature request.

homebrew on my machine takes quite some time for any package to install. And after "minutes" or even hours it stops continuing because it asks me questions like this:

Error: Could not symlink include/textstyle/stdbool.h
Target /usr/local/include/textstyle/stdbool.h
is a symlink belonging to gettext. You can unlink it:
  brew unlink gettext

To force the link and overwrite all conflicting files:
  brew link --overwrite gettext

To list all files that would be deleted:
  brew link --overwrite gettext --dry-run

Which I always answer by tediously copying and pasting. Yes please overwrite, I don't care!

So what I'm asking myself is, is there any options that allow to simply tell brew to just always overwrite links? I tried this but it doesn't seem to work. I still get stops during longish runs:

brew install --quiet --overwrite --force somepackage

If such an "always overwrite links" option currently is not available then this would actually be the feature I would like to request. Thanks for you consideration! Please get back to me with any thoughts, improvement suggestions of my workflow or criticism on my report! All welcome! Thanks a lot for your time and efforts!

@JOJ0 JOJ0 added the features New features label Mar 9, 2024
@carlocab
Copy link
Member

carlocab commented Mar 9, 2024

I'm sorry for posting this as an issue here, I would have rather opened a discussion about it, if that where available here.

We do have a discussions page for these sorts of questions.

Does brew install --overwrite and/or brew upgrade --overwrite not do what you need it to?

@cho-m
Copy link
Member

cho-m commented Mar 10, 2024

Probably need a specific example in order to provide context. Like what exact command you were running when it errored and at least some command output before the error.

Without any extra info, I am guessing this is related to linking dependencies since I think --overwrite should work but only for input formula. If so, as far as I can tell, we don't support this. A hack would be passing in everything in dependency tree $(brew deps ...), but that will result in a marking all formulae as installed_on_request and making it difficult to clean up no longer used formulae.

@MikeMcQuaid MikeMcQuaid closed this as not planned Won't fix, can't repro, duplicate, stale Mar 11, 2024
@JOJ0
Copy link
Author

JOJ0 commented Mar 11, 2024

I'm sorry for posting this as an issue here, I would have rather opened a discussion about it, if that where available here.

We do have a discussions page for these sorts of questions.

Does brew install --overwrite and/or brew upgrade --overwrite not do what you need it to?

I'm very sorry I missed that discussions is open in this repo.

As said: install --overwrite still asks when dependency link conflicts are happening.That usually happens with long running compiles. In the end it often takes me literally days to install one piece of software because every other dependency throws such a link overwrite conflict...

@MikeMcQuaid
Copy link
Member

As said: install --overwrite still asks when dependency link conflicts are happening.That usually happens with long running compiles. In the end it often takes me literally days to install one piece of software because every other dependency throws such a link overwrite conflict...

Can you be more specific here?

@JOJ0
Copy link
Author

JOJ0 commented Mar 11, 2024

I'll post a report when not AFK

@JOJ0
Copy link
Author

JOJ0 commented Mar 14, 2024

@MikeMcQuaid for example, I recently tried to install brew install nvim which is a very long running process on my machine, it downloads, compiles and does whatever brew requires to do to get this software, as well as all required dependencies installed.

Very often, if not all the time, I use brew to install anything, I get a similar experience: brew stops and asks me to solve "symlink overwrite conflicts" by hand.

I can't repro this specific install anymore, because after 2-3 reruns I'm finally through with manual linking solving.

With brew upgrade --overwrite I actually get the very same behaviour. It is a very long running process and after minutes or even hours, it stops because it is afraid to overwrite a symlink of a dependent software package:

$ brew upgrade --overwrite
...
...
...
==> Downloading https://curl.se/download/curl-8.6.0.tar.bz2
######################################################################################################################################################################################################################## 100.0%
==> Installing opus dependency: curl
==> Installing dependencies for curl: brotli, libunistring, libidn2, libnghttp2, ca-certificates, openssl@3, libssh2, openldap, rtmpdump and xz
==> Installing curl dependency: brotli
==> Downloading https://formulae.brew.sh/api/formula.jws.json
######################################################################################################################################################################################################################## 100.0%
==> cmake .
==> make VERBOSE=1
==> ctest -V
==> make install
==> Downloading https://formulae.brew.sh/api/cask.jws.json
######################################################################################################################################################################################################################## 100.0%
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/brotli
Target /usr/local/bin/brotli
is a symlink belonging to brotli. You can unlink it:
  brew unlink brotli

To force the link and overwrite all conflicting files:
  brew link --overwrite brotli

To list all files that would be deleted:
  brew link --overwrite brotli --dry-run

Possible conflicting files are:
/usr/local/bin/brotli -> /usr/local/Cellar/brotli/1.0.9/bin/brotli
Error: Could not symlink include/brotli/decode.h
Target /usr/local/include/brotli/decode.h
is a symlink belonging to brotli. You can unlink it:
  brew unlink brotli

To force the link and overwrite all conflicting files:
  brew link --overwrite brotli

To list all files that would be deleted:
  brew link --overwrite brotli --dry-run

Does that clarify what I'm asking?

@MikeMcQuaid
Copy link
Member

Does that clarify what I'm asking?

Yes, thanks. It is indeed unexpected/a bug that brew upgrade --overwrite will not overwrite in this case. Reopening.

@MikeMcQuaid MikeMcQuaid reopened this Mar 14, 2024
@MikeMcQuaid MikeMcQuaid added the help wanted We want help addressing this label Mar 14, 2024
@MikeMcQuaid MikeMcQuaid changed the title Always force overwrite links --overwrite should always overwrite links Mar 14, 2024
@cho-m
Copy link
Member

cho-m commented Mar 21, 2024

==> Installing curl dependency: brotli
...
Possible conflicting files are:
/usr/local/bin/brotli -> /usr/local/Cellar/brotli/1.0.9/bin/brotli

This is confusing. Very strange that brotli can't handle brotli's own files.

May need to understand your setup better with brew config/brew doctor output.

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

No branches or pull requests

4 participants