apparition47/MailTrackerBlocker

Error when upgrading 0.3.19->0.3.21 using Homebrew

Closed this issue ยท 10 comments

==> Upgrading 1 outdated package:
apparition47/tap/mailtrackerblocker 0.3.19 -> 0.3.21
==> Upgrading mailtrackerblocker
==> Downloading https://github.com/apparition47/MailTrackerBlocker/releases/down
Already downloaded: /Users/xxx/Library/Caches/Homebrew/downloads/d69bc229822820e8b866db3e70bc96bc0ee68788653e6801d44357290a31bae2--MailTrackerBlocker.pkg
==> Uninstalling packages:
com.onefatgiraffe.mailtrackerblocker
find: /private/tmp/MailTrackerBlocker-Installation-Temp: No such file or directory
==> Purging files for version 0.3.21 of Cask mailtrackerblocker
Error: apparition47/tap/mailtrackerblocker: Failure while executing; /usr/bin/sudo -E -- /usr/bin/xargs -0 -- /bin/bash -c set\ -euo\ pipefail'
''
'for\ path\ in\ \"\$\{@\}\"\;\ do'
'\ \ if\ \[\[\ -e\ \"\$\{path\}/.DS_Store\"\ \]\]\;\ then'
'\ \ \ \ /bin/rm\ -f\ \"\$\{path\}/.DS_Store\"'
'\ \ fi'
''
'\ \ \#\ Some\ packages\ leave\ broken\ symlinks\ around\;\ we\ clean\ them\ out\ before'
'\ \ \#\ attempting\ to\`\rmdir\`\ to\ prevent\ extra\ cruft\ from\ accumulating.'
'\ \ /usr/bin/find\ \"\$\{path\}\"\ -mindepth\ 1\ -maxdepth\ 1\ -type\ l\ \!\ -exec\ /bin/test\ -e\ \{\}\ \\\;\ -delete'
''
'\ \ if\ \[\[\ -L\ \"\$\{path\}\"\ \]\]\;\ then'
'\ \ \ \ \#\ Delete\ directory\ symlink.'
'\ \ \ \ /bin/rm\ \"\$\{path\}\"'
'\ \ elif\ \[\[\ -d\ \"\$\{path\}\"\ \]\]\;\ then'
'\ \ \ \ \#\ Delete\ directory\ if\ empty.'
'\ \ \ \ /usr/bin/find\ \"\$\{path\}\"\ -maxdepth\ 0\ -type\ d\ -empty\ -exec\ /bin/rmdir\ \{\}\ \\\;'
'\ \ else'
'\ \ \ \ \#\ Try\ \`rmdir\`\ anyways\ to\ show\ a\ proper\ error.'
'\ \ \ \ /bin/rmdir\ \"\$\{path\}\"'
'\ \ fi'
'done'
' --` exited with 1. Here's the output:
find: /private/tmp/MailTrackerBlocker-Installation-Temp: No such file or directory

This is repeatable for sure, seeing it here too.

Yeah I'm seeing exactly the same error too

I should point out: this failure happens early enough in the uninstall or upgrade that mailtrackerblocker remains installed, so at least tracker blocking is still happening while we're frozen on the version we've got...

You can easily repro this issue by trying to uninstall 0.3.21, too: brew uninstall mailtrackerblocker.

If you run brew uninstall --debug mailtrackerblocker you can see that the Homebrew uninstaller is running various pkgutil commands to learn about what the software has installed, and where:

/usr/sbin/pkgutil --pkgs=com.onefatgiraffe.mailtrackerblocker
/usr/sbin/pkgutil --files com.onefatgiraffe.mailtrackerblocker
/usr/sbin/pkgutil --pkg-info-plist com.onefatgiraffe.mailtrackerblocker

That last command shows this:

$ /usr/sbin/pkgutil --pkg-info-plist com.onefatgiraffe.mailtrackerblocker
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>install-location</key>
	<string>private/tmp/MailTrackerBlocker-Installation-Temp</string>
	<key>install-time</key>
	<integer>1615970601</integer>
	<key>pkg-version</key>
	<string>0</string>
	<key>pkgid</key>
	<string>com.onefatgiraffe.mailtrackerblocker</string>
	<key>receipt-plist-version</key>
	<real>1</real>
	<key>volume</key>
	<string>/</string>
</dict>
</plist>

It's the path in install-location that brew uninstall is trying to delete.

Thanks for the logs. Will look into this soon; installer script still has some issues.

The simple workaround was to create this directory manually with:
mkdir /private/tmp/MailTrackerBlocker-Installation-Temp
and then to repeat the upgrade attempt.

Bear in mind that after each attempt this directory is removed.
So if you want to update / uninstall this package, you'll have to re-create this directory again.

Not sure why, but after I manually made a directory "/private/tmp/MailTrackerBlocker-Installation-Temp" and the install/uninstall seems fine. Consider it a workaround.

Should be fixed to play nicer with the Homebrew uninstallation script starting in 0.3.22. Please use the above workaround if you're on an older version and seeing this issue.

Thanks all for helping me diagnose this one.

You should really be using mktemp -d to produce temporary directories instead.

Thanks @Saklad5 --wasn't aware that command existed. Anyhow, I've done away with the pkg staging from the temp dir since the Brew uninstaller script seems to assume an installation in a less ephemeral location.