-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
cask/artifact/symlinked: allow --force to overwrite symbolic links #8537
Conversation
As mentioned in Homebrew/homebrew-cask#88401 (comment), we should only override if the symlink point to the same cask. So we need some method like |
This will take me some time; please feel free to take over in this PR (or a new one if you prefer) if you wish. |
Ok, I have made some changes that get part of the way there. Running
regardless of wether Running
if Running
if @reitermarkus I will probably need some help with the last bit, namely checking if the symbolic link being over-written points to the same cask. |
@reitermarkus I have an idea on how to achieve the desired result, but I am not sure if it will work, nor am I sure on how to do it exactly. Let me try and explain ... Before the
while
and I assume that
Now, if I have this correct, is there a way to extract And if so, can we compare them and allow the overwrite if and only if |
Not yet, that's why we need a helper function for that as I mentioned. |
@reitermarkus and @vitorgalvao I have come up with a way to achieve the desired results for this -- explanation and testing results are given below. Apologies in advance for the long read! Installing a test-cask both without
and the install fails. Installing a test-cask both without
and the install fails. Installing a test-cask without
and the install fails. Installing a test-cask with
and the install succeeds. The main reason why I decided to implement the check via:
is because the symbolic link that we want to be overwritten may not necessarily point to the Let me illustrate this with two more examples: For the cask
pointing to:
and installing with
and the install succeeds. Note that in this case For the cask
pointing to:
and installing with
and the install succeeds. Note that in this case Thank you. |
Thanks, @miccal! |
No problem, and thank you for all your help @reitermarkus. |
brew style
with your changes locally?brew tests
with your changes locally?In a previous PR I changed how
binary
andmanpage
links were handled for casks to ensure that neither an existing file nor an existing symbolic link would be overwritten.This change allows the
--force
flag to override this check, essentially using the same logic as incask/artifact/moved
.I have tested this locally, and running
brew cask install {something with a conflicting binary name}
outputs the error:and hence the install fails, while running
brew cask install --force {something with a conflicting binary name}
outputs the warning:and the install succeeds.
This should (hopefully) resolve Homebrew/homebrew-cask#88401.
Ping @reitermarkus and @vitorgalvao for thoughts and review.
Thank you.