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

New brew upgrade/reinstall --cask does not honour --no-quarantine #9139

Closed
logopk opened this issue Nov 14, 2020 · 22 comments · Fixed by #10284
Closed

New brew upgrade/reinstall --cask does not honour --no-quarantine #9139

logopk opened this issue Nov 14, 2020 · 22 comments · Fixed by #10284
Labels
bug Reproducible Homebrew/brew bug cask Homebrew Cask outdated PR was locked due to age

Comments

@logopk
Copy link

logopk commented Nov 14, 2020

Bug report

Please note we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.

  • [ x ] ran brew update and can still reproduce the problem?
  • [ x ] ran brew doctor, fixed all issues and can still reproduce the problem?
  • [ x ] ran brew config and brew doctor and included their output with your issue?

What you were trying to do (and why)

brew upgrade --cask --no-quarantine [google-chrome]

to reproduce with the now upgraded version, see what happens on:
brew reinstall --cask --no-quarantine --debug --verbose google-chrome

while
brew install --cask --no-quarantine --debug --verbose google-chrome
works fine and does not quarantine Chrome (or any other Cask)

What happened (include command output)

Cask is not released from quarantine!

Command output
>>brew reinstall --cask --verbose --debug --no-quarantine  google-chrome
...
==> Verifying Gatekeeper status of /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
/usr/bin/xattr -p com.apple.quarantine /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
==> /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg is quarantined
==> Propagating quarantine from /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg to /usr/local/Caskroom/google-chrome/86.0.4240.198
/usr/bin/xattr -p com.apple.quarantine /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
/usr/bin/xargs -0 -- /bin/chmod -h u\+w
/usr/bin/xargs -0 -- /usr/bin/xattr -w com.apple.quarantine 0181\;5fb003fd\;Homebrew\\x20Cask\;F20ACCE8-FDD7-4A6E-8064-4B00BB5857E8
==> Creating metadata directory /usr/local/Caskroom/google-chrome/.metadata/86.0.4240.198/20201114162133.034.
==> Creating metadata subdirectory /usr/local/Caskroom/google-chrome/.metadata/86.0.4240.198/20201114162133.034/Casks.
...
  

see old deprecated command:

>> brew cask reinstall --verbose --debug --no-quarantine  google-chrome

...
==> Checking quarantine support
/usr/bin/xattr
/usr/bin/swift /usr/local/Homebrew/Library/Homebrew/cask/utils/quarantine.swift
==> Quarantine is available.
==> Verifying Gatekeeper status of /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
/usr/bin/xattr -p com.apple.quarantine /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
==> /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg is quarantined
==> Releasing /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg from quarantine
/usr/bin/xattr -d com.apple.quarantine /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
==> Downloaded to -> /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
tar tf /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
hdiutil imageinfo -format /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
==> Verifying SHA-256 checksum for Cask 'google-chrome'.
...
==> Installing Cask google-chrome
Warning: macOS's Gatekeeper has been disabled for this Cask
...

What you expected to happen

Google Chrome is not quarantined and starts without the warning (on every launch)

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

brew install --cask --no-quarantine google-chrome -> shows no GateKeeper warning

...anytime later

brew upgrade --cask --no-quarantine [google-chrome] -> shows GateKeeper warning
brew reinstall --cask --verbose --debug --no-quarantine google-chrome -> shows GateKeeper warning

compare this to

brew cask reinstall --verbose --debug --no-quarantine google-chrome -> does not show GateKeeper warning

Output of brew config and brew doctor commands

HOMEBREW_VERSION: 2.5.10-22-g023df12-dirty
ORIGIN: https://github.com/Homebrew/brew
HEAD: 023df124bdeba091b29652648602b7dda4e50730
Last commit: 65 minutes ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: ee7fb04d416ee8611e00110c0697c7c3a971539e
Core tap last commit: 7 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3_2/bin/ruby
CPU: octa-core 64-bit haswell
Clang: 11.0 build 1100
Git: 2.29.2 => /usr/local/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 11.0.9, 1.8.0_272
macOS: 10.14.6-x86_64
CLT: 10.3.0.0.1.1562985497
Xcode: 11.3.1
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: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
  softwareupdate --all --install --force

If that doesn't show you an update run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
  https://developer.apple.com/download/more/.


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

@miccal
Copy link
Member

miccal commented Nov 15, 2020

Does dropping the --cask flag make a difference?

Also see Homebrew/homebrew-cask#87045 for more information.

@logopk
Copy link
Author

logopk commented Nov 15, 2020

Maybe - but I have to separate casks from regular updates as I use home-brew usually without admin rights.

So I run only cask updates in an admin-User (with the terrible permission update problems).

@MikeMcQuaid
Copy link
Member

Pulling in @Homebrew/cask for thoughts/fixes.

@vitorgalvao
Copy link
Member

but I have to separate casks from regular updates as I use home-brew usually without admin rights.

Using --cask or not won’t make an (installation) difference in this case. Even if you omit the flag, it will still install the cask (there’s no google-chrome formula).

So what happens if you brew reinstall --verbose --debug --no-quarantine google-chrome?

@logopk
Copy link
Author

logopk commented Nov 17, 2020

@vitorgalvao agreed. But in upgrade it will, right?

@vitorgalvao
Copy link
Member

But in upgrade it will, right?

Not when you give it an argument of what to upgrade (which in this case you’re doing).

Think of the --casks and --formulae flags as restrictors (without which, both are included). When you give it a specific formula or cask as an argument, you’ve already restricted it to that and the flag doesn’t do much (or it shouldn’t, but in this case it might be introducing a bug).

@logopk
Copy link
Author

logopk commented Nov 17, 2020

@vitorgalvao I see,

My problem is: once I upgrade and only one cask that needs admin rights is in the outdated list, my scripts fail sometime in the list as I have no sudo right.

So I restrict it with —cask (no cask name, above was a sample to demonstrate the error) and run it in the Admin account.
After that I do a regular upgrade.

I did not know —formula. Good news.

@vitorgalvao
Copy link
Member

But can you try the reinstall command as requested? We can’t proceed until we know what happens there.

@logopk
Copy link
Author

logopk commented Nov 19, 2020

@vitorgalvao sure.

> brew reinstall --force --no-quarantine --verbose --debug google-chrome
...
==> Checking quarantine support
/usr/bin/xattr
/usr/bin/swift /usr/local/Homebrew/Library/Homebrew/cask/utils/quarantine.swift
==> Quarantine is available.
==> Verifying Gatekeeper status of /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
/usr/bin/xattr -p com.apple.quarantine /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
==> /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg is quarantined
==> Downloaded to -> /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
tar tf /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
hdiutil imageinfo -format /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
...
==> Verifying Gatekeeper status of /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
/usr/bin/xattr -p com.apple.quarantine /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
==> /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg is quarantined
==> Propagating quarantine from /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg to /usr/local/Caskroom/google-chrome/87.0.4280.67
/usr/bin/xattr -p com.apple.quarantine /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
/usr/bin/xargs -0 -- /bin/chmod -h u\+w
/usr/bin/xargs -0 -- /usr/bin/xattr -w com.apple.quarantine 0181\;5fb68e37\;Homebrew\\x20Cask\;10D60B01-B275-48A9-99F8-1C9C3B625214
...

Dialog is shown.

@vitorgalvao vitorgalvao added bug Reproducible Homebrew/brew bug cask Homebrew Cask labels Nov 19, 2020
@miccal
Copy link
Member

miccal commented Nov 19, 2020

@logopk does running:

HOMEBREW_CASK_OPTS="--no-quarantine" brew reinstall --force --verbose --debug google-chrome

make a difference?

@logopk
Copy link
Author

logopk commented Nov 19, 2020

Seems so:

> HOMEBREW_CASK_OPTS="--no-quarantine" brew reinstall --force --verbose --debug google-chrome
...
==> Checking quarantine support
/usr/bin/xattr
/usr/bin/swift /usr/local/Homebrew/Library/Homebrew/cask/utils/quarantine.swift
==> Quarantine is available.
==> Verifying Gatekeeper status of /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
/usr/bin/xattr -p com.apple.quarantine /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
==> /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg is quarantined
==> Releasing /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg from quarantine
/usr/bin/xattr -d com.apple.quarantine /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
==> Downloaded to -> /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
tar tf /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
hdiutil imageinfo -format /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
...
==> Installing Cask google-chrome
Warning: macOS's Gatekeeper has been disabled for this Cask
...

Important to note, that this happens only if it was quarantined before
If it was not then it looks like this

==> Checking quarantine support
/usr/bin/xattr
/usr/bin/swift /usr/local/Homebrew/Library/Homebrew/cask/utils/quarantine.swift
==> Quarantine is available.
==> Verifying Gatekeeper status of /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
/usr/bin/xattr -p com.apple.quarantine /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
==> /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg is not quarantined
==> Downloaded to -> /Users/_admin/Library/Caches/Homebrew/downloads/9830ac8a5256756d2643fbdb6a47ba0eb019c3816fc4366049f2483999b2ee4f--googlechrome.dmg
...

@BrewTestBot
Copy link
Member

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

@BrewTestBot BrewTestBot added stale No recent activity and removed stale No recent activity labels Dec 11, 2020
@RealCLanger
Copy link

Hi,

I'm reproducibly running into this issue as well.

I have installed sapmachine11-ea-jdk from https://github.com/SAP/homebrew-SapMachine/. I need to update this every week. I used to do "brew cask upgrade --no-quarantine" which worked fine. Now, since brew cask upgrade is locked, I need to do "brew upgrade --cask --no-quarantine" which will install the updated cask without disablingthe gatekeeper. A "brew reinstall sapmachine11-ea-jdk --no-quarantine" will fix this. Or, alternatively, it seems to work when I set HOMEBREW_CASK_OPTS to "--no-quarantine".

I'd really love if this could be fixed.

Thanks
Christoph

@vitorgalvao
Copy link
Member

vitorgalvao commented Dec 18, 2020

which will install the updated cask without disablingthe gatekeeper.

We never disable Gatekeeper. --no-quarantine simply doesn’t set the quarantine attribute on the download.

A "brew reinstall sapmachine11-ea-jdk --no-quarantine" will fix this.

That directly contradicts the report in this issue. Are you sure that’s what you meant?

I'd really love if this could be fixed.

There’s a reason this is still open: it’s a valid bug report but we did not have the chance to get to it. We take pull requests, if you’re so inclined. Otherwise it’s uncertain when we’ll get to it; it’s low priority.

@mjsteinbaugh

This comment has been minimized.

@nheeren

This comment has been minimized.

@djdiaz

This comment has been minimized.

@vitorgalvao
Copy link
Member

There’s no reason to think this bug doesn’t occur in all macOS versions. It’s not a macOS bug, it’s ours, so please comment if it doesn’t occur in a specific macOS version (which would be weird), not if it does (which would not).

@RealCLanger
Copy link

which will install the updated cask without disablingthe gatekeeper.

We never disable Gatekeeper. --no-quarantine simply doesn’t set the quarantine attribute on the download.

Sorry, I probably used the wrong wording here. I said that because when I do a `brew install --cask --no-quarantine sapmachine11-ea-jre", I can see the warning "macOS's Gatekeeper has been disabled for this Cask". Having said that, I just tested this install command again and it installed my cask fine without quarantine. I can run java -version.

A "brew reinstall sapmachine11-ea-jdk --no-quarantine" will fix this.

That directly contradicts the report in this issue. Are you sure that’s what you meant?

I'm pretty sure it is. I'll test this later this week when there will be an update for sapmachine11-ea-jdk/jre and report here.

I'd really love if this could be fixed.

There’s a reason this is still open: it’s a valid bug report but we did not have the chance to get to it. We take pull requests, if you’re so inclined. Otherwise it’s uncertain when we’ll get to it; it’s low priority.

Sure. :) Unfortunately I'm not so much into the brew source code and ruby and my time also doesn't permit digging deeper. So, priority is all fine given that HOMEBREW_CASK_OPTS to "--no-quarantine" or "brew reinstall --no-quarantine" help. I was just worried since I had "brew cask upgrade --no-quarantine" working before and now this got locked out in favor of "brew upgrade --cask --no-quarantine" which obviously doesn't honor --no-quarantine correctly at the moment.

Thanks for your great efforts with brew :)

@RealCLanger
Copy link

A "brew reinstall sapmachine11-ea-jdk --no-quarantine" will fix this.

That directly contradicts the report in this issue. Are you sure that’s what you meant?

I'm pretty sure it is. I'll test this later this week when there will be an update for sapmachine11-ea-jdk/jre and report here.

OK, I have to correct myself. "brew reinstall --no-quarantine" does not work (as reported). The current workaround is HOMEBREW_CASK_OPTS.

@djdiaz
Copy link

djdiaz commented Jan 11, 2021

This bug is only partially resolved—for the reinstall case, not the upgrade case. Please reopen.

@RealCLanger
Copy link

This bug is only partially resolved—for the reinstall case, not the upgrade case. Please reopen.

I can confirm that. reinstall --no-quarantine works now but ugrade --no-quarantine doesn't.

AntonioMeireles added a commit to AntonioMeireles/brew that referenced this issue Jan 22, 2021
issue was raised in Homebrew#9139 for upgrade/reinstall --cask and was then
closed by Homebrew#10284. Issue is that Homebrew#10284 only actually fixed the reinstall
command, leaving behindd the 'upgrade' one which this now fixes.

Signed-off-by: António Meireles <antonio.meireles@reformi.st>
@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Feb 11, 2021
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Feb 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Reproducible Homebrew/brew bug cask Homebrew Cask outdated PR was locked due to age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants