Closed xkszltl closed 3 years ago
Can you post what the uninstall_preflight
section says in the following file:
/usr/local/Caskroom/asix-ax88179/.metadata/2.19.0,1109/20210428133711.072/Casks/asix-ax88179.rb
And the name of the uninstaller in following directory:
/usr/local/Caskroom/asix-ax88179/2.19.0,1109/
The failure is due to not finding the uninstaller PKG.
One possibility is the uninstaller being renamed by upstream after we updated Cask.
Another possibility, is a (potential) situation if you updated to Big Sur after installing a version of Cask with Homebrew/homebrew-cask-drivers#2231, i.e.
asix-ax88179
within last 12 daysCan you post ...
% cat /usr/local/Caskroom/asix-ax88179/.metadata/2.19.0,1109/20210428133711.072/Casks/asix-ax88179.rb
cask "asix-ax88179" do
version "2.19.0,1109"
sha256 :no_check
url "https://www.asix.com.tw/en/support/download/file/#{version.after_comma}"
name "AX88179"
desc "USB 3.0 to gigabit ethernet drivers for ASIX Electronics devices"
homepage "https://www.asix.com.tw/en/support/download"
livecheck do
url "https://www.asix.com.tw/en/support/download/step2/11/2/3"
strategy :page_match do |page|
page.split(/class=['"]?list__item['"]?/).map do |list_item|
match = list_item.match(
%r{data-href=.*?/download/file/(\d+).*?macOS.*?Vision\s*?(?:<br>)?\s*?(\d+(?:\.\d+)*)<}mi,
)
"#{match[2]},#{match[1]}" if match
end.compact
end
end
container nested: "AX88179_178A_macOS_10.9_to_10.15_Driver_Installer_v#{version.before_comma}/AX88179_178A_v#{version.before_comma}.dmg"
installer manual: "AX88179_178A_v#{version.before_comma}.app"
uninstall_preflight do
staged_path.glob("AX88179_178A_Uninstall_v*.pkg").first.rename(staged_path/"AX88179_178A_Uninstall.pkg")
system_command "/usr/sbin/installer",
args: [
"-pkg", staged_path/"AX88179_178A_Uninstall.pkg",
"-target", "/"
],
sudo: true
end
uninstall pkgutil: "com.asix.ax88179.uninstall"
caveats do
reboot
end
end
And the name ...
% ls /usr/local/Caskroom/asix-ax88179/2.19.0,1109/
AX88179_178A_Uninstall.pkg AX88179_178A_v2.19.0.app readme.txt
One possibility is the uninstaller being renamed by upstream after we updated Cask.
Yes that's possible, I remember seeing that happened before.
Another possibility, is a (potential) situation if you updated to Big Sur after installing a version of Cask with ...
Yes I upgraded to Big Sur a few weeks ago (not exactly sure when but recently), asix-ax88179
was installed long ago on Catalina (but could be later updated if that counts)
BTW besides the issue itself, probably the ruby script should also have more checks to show clear error msg.
In this case, the filename: AX88179_178A_Uninstall.pkg
doesn't match the glob: AX88179_178A_Uninstall_v*.pkg
which could be due to the first scenario.
@Homebrew/cask To get someone more familiar with uninstaller logic to comment if it is safe to just manually edit the metadata file so it can find the uninstaller (or rename the PKG to match the glob).
In terms of the error message, it may be better to handle the exception in Homebrew/brew code rather than adding extra Ruby code into the Casks.
It would be more readable for non-programmers to mainly use Cask DSL and only lightly use Ruby code when necessary.
Though, the error may end up looking like
Error: asix-ax88179: Uninstall preflight failed due to [...reason...]
where the reason may just be undefined method 'rename' for nil:NilClass
since it isn't easy to get further details without extra logic.
@Homebrew/cask To get someone more familiar with uninstaller logic to comment if it is safe to just manually edit the metadata file so it can find the uninstaller (or rename the PKG to match the glob).
It should be, I think.
So what's the expectation here? Is it fixed? Should I manually edit the uninstaller path and have a try? Or will there be a patch to correct old installation automatically?
@xkszltl You will need to do some manual edits.
The uninstaller logic is saved when you originally installed the Cask, so even if we change Cask in repo, it won't impact how uninstall is handled.
Since you already have a file named AX88179_178A_Uninstall.pkg
, the rename logic is unnecessary and can be deleted/commented out from
/usr/local/Caskroom/asix-ax88179/.metadata/2.19.0,1109/20210428133711.072/Casks/asix-ax88179.rb
Specifically, you can try removing the line
staged_path.glob("AX88179_178A_Uninstall_v*.pkg").first.rename(staged_path/"AX88179_178A_Uninstall.pkg")
Since the PKG file already matches the expected name.
This is what I end up with after commenting it out:
==> Casks with 'auto_updates' or 'version :latest' will not be upgraded; pass `--greedy` to upgrade them.
==> Upgrading 1 outdated package:
asix-ax88179 2.19.0,1109 -> 1.2.0,1126
==> Upgrading asix-ax88179
==> Caveats
You must reboot for the installation of asix-ax88179 to take effect.
==> Downloading https://www.asix.com.tw/en/support/download/file/1126
Already downloaded: /Users/xkszltl/Library/Caches/Homebrew/downloads/baee1215d87b32ee61d8d3d487df0cf3567435e679fc7ff8dabbc5d26457af7e--en
Warning: No checksum defined for cask 'asix-ax88179', skipping verification.
==> Uninstalling packages; your password may be necessary:
com.asix.ax88179.uninstall
==> Purging files for version 1.2.0,1126 of Cask asix-ax88179
==> Purging files for version 1.2.0,1126 of Cask asix-ax88179
Warning: Reverting upgrade for Cask asix-ax88179
To complete the installation of Cask asix-ax88179, you must also
run the installer at:
/usr/local/Caskroom/asix-ax88179/2.19.0,1109/AX88179_178A_v2.19.0.app
Error: asix-ax88179: No such file or directory @ rb_sysopen - /private/tmp/d20210611-18965-1sz4stz/ASIX_USB_Device_Installer_macOS_11.0_above_Driver_v1.2.0/ASIX_USB_Device_Installer_v1.2.0.dmg
Tried uninstall + delete cache + reinstall, uninstall does work since it can now get the correct file name, but installation is broken:
==> Caveats
You must reboot for the installation of asix-ax88179 to take effect.
==> Downloading https://www.asix.com.tw/en/support/download/file/1126
==> Downloading from https://www.asix.com.tw/en
-=#=-# # #
Warning: No checksum defined for cask 'asix-ax88179', skipping verification.
==> Installing Cask asix-ax88179
==> Purging files for version 1.2.0,1126 of Cask asix-ax88179
Error: No such file or directory @ rb_sysopen - /private/tmp/d20210611-20856-s3j5su/ASIX_USB_Device_Installer_macOS_11.0_above_Driver_v1.2.0/ASIX_USB_Device_Installer_v1.2.0.dmg
This is what I got from https://www.asix.com.tw/en/support/download/step2/11/2/3
:
ASIX_USB_Device_Installer_macOS_11.3_above_Driver_v1.2.0_20210521
So probably they changed the name. Maybe we can change this line? https://github.com/Homebrew/homebrew-cask-drivers/blob/76a24ede1f3f175141a664dc32edc960b19f5269/Casks/asix-ax88179.rb#L22
But for pre 11.3, I'm not sure what to do at this point...
We had some issues trying to update the Cask in Homebrew/homebrew-cask-drivers#2250
Still need to figure out why the installer PKG was still running after install was done.
And they probably upgrade to 1132 recently: https://github.com/Homebrew/homebrew-cask-drivers/blob/76a24ede1f3f175141a664dc32edc960b19f5269/Casks/asix-ax88179.rb#L20
1126 URL now points to their homepage.
Ah good to know someone is already working on that upgrade.
@xkszltl There is no-one currently working on it since it has been stale-closed.
There will need to be another PR. It may also require unpacking the PKG to find out why the processes are still running (e.g. is there an interactive prompt or something)
--force
.brew update-reset && brew update
and retried my command.brew doctor
, fixed as many issues as possible and retried my command.Description of issue
brew upgrade
forasix-ax88179
end up withundefined method rename for nil:NilClass
.Command that failed
brew upgrade
Output of command with
--verbose --debug
Click to expand
Output of
brew doctor --verbose
Click to expand
Output of
brew tap
Click to expand