Git Product home page Git Product logo

Comments (10)

rolandwalker avatar rolandwalker commented on May 13, 2024

Hi!

M+ installs fine for me. I can't remember if I had to upgrade any of the codebase to support the tar.xz container. Could you make sure you are running the latest release:

$ brew update && brew upgrade brew-cask && brew cleanup && brew cask cleanup

and let me know if your problem persists?

Another possibility is that the file was corrupted on download, in which case

$ rm /Library/Caches/Homebrew/font-m-plus-1.050.tar.xz

from homebrew-cask-fonts.

brian-c avatar brian-c commented on May 13, 2024

No change unfortunately.

The only thing brew doctor says is that my XQuartz is old, but I can't imagine that's affecting this.

The Unarchiver can extract the archive fine.

Another font (font-profontx) installed with no trouble.

from homebrew-cask-fonts.

rolandwalker avatar rolandwalker commented on May 13, 2024

Thanks for the feedback. I would like to see tar.xz files work correctly; there is no reason why they shouldn't.

Perhaps it is a difference between versions of OS X. I am on Mavericks. Homebrew-cask invokes the file utility to determine the filetype (ignoring the .tar.xz extension). So the internal command is like the following (expected result shown):

$ /usr/bin/file -Izb -- /Library/Caches/Homebrew/font-m-plus-1.050.tar.xz
application/x-tar; charset=binary compressed-encoding=application/x-xz; charset=binary; charset=binary

Which you can also see by running

$ brew cask install --debug font-m-plus

There is also a Cask doctor command brew cask doctor which unfortunately is not as advanced as brew doctor, though it might be helpful for us to see the output.

from homebrew-cask-fonts.

brian-c avatar brian-c commented on May 13, 2024

Here's what file gives me:

$ /usr/bin/file -Izb /Library/Caches/Homebrew/font-m-plus-1.050.tar.xz
application/x-empty compressed-encoding=application/x-xz; charset=binary; charset=binary

So that's not quite right.

I'm on 10.9.3 here. file --version reports 5.04, if that's any use.

from homebrew-cask-fonts.

rolandwalker avatar rolandwalker commented on May 13, 2024

application/x-empty indicates a bad download. This should also show a zero-length file:

$ ls -la /Library/Caches/Homebrew/font-m-plus-1.050.tar.xz

You should try

$ rm /Library/Caches/Homebrew/font-m-plus-1.050.tar.xz

and download it fresh.

On our end, we should definitely add a more helpful error message for the case of empty downloads.

from homebrew-cask-fonts.

brian-c avatar brian-c commented on May 13, 2024

Nah, the file's okay. I can extract it with the Unarchiver.

Different machine this time. Same OS, brew and cask are both up to date.

$ brew cask install font-m-plus
==> Downloading http://osdn.dl.sourceforge.jp/mplus-fonts/6650/mplus-TESTFLIGHT-050.tar.xz
######################################################################## 100.0%
Error: Uh oh, could not identify primary container for '/Library/Caches/Homebrew/font-m-plus-1.050.tar.xz'
$ ls -la /Library/Caches/Homebrew/font-m-plus-1.050.tar.xz
-rw-r--r--  1 brian  admin   8.0M Jul 10 18:35 /Library/Caches/Homebrew/font-m-plus-1.050.tar.xz

If I'm the only one this happens for (weird), it's totally not a big deal, there are other ways to install a font. But if you think this is something we can debug I'm happy to help.

Excerpt from a --debug install:

==> Downloading
==> Downloading http://osdn.dl.sourceforge.jp/mplus-fonts/6650/mplus-TESTFLIGHT-050.tar.xz
Already downloaded: /Library/Caches/Homebrew/font-m-plus-1.050.tar.xz
==> Checksums match
==> Downloaded to -> /Library/Caches/Homebrew/font-m-plus-1.050.tar.xz
==> Extracting primary container
==> Determining which containers to use based on filetype
==> Checking container class Cask::Container::Air
==> Checking container class Cask::Container::Cab
==> Executing: ["/usr/bin/file", "-Izb", "--", "#<Pathname:/Library/Caches/Homebrew/font-m-plus-1.050.tar.xz>"]
==> Checking container class Cask::Container::Dmg
==> Executing: ["/usr/bin/hdiutil", "imageinfo", "#<Pathname:/Library/Caches/Homebrew/font-m-plus-1.050.tar.xz>"]
==> Checking container class Cask::Container::SevenZip
==> Checking container class Cask::Container::Sit
==> Checking container class Cask::Container::Tar
==> Checking container class Cask::Container::Rar
==> Checking container class Cask::Container::Zip
==> Checking container class Cask::Container::Bzip2
==> Checking container class Cask::Container::Naked
==> Purging files
Error: Uh oh, could not identify primary container for '/Library/Caches/Homebrew/font-m-plus-1.050.tar.xz'
/usr/local/Cellar/brew-cask/0.37.1/rubylib/cask/installer.rb:72:in `extract_primary_container'
/usr/local/Cellar/brew-cask/0.37.1/rubylib/cask/installer.rb:36:in `install'
/usr/local/Cellar/brew-cask/0.37.1/rubylib/cask/cli/install.rb:20:in `block in install_casks'
/usr/local/Cellar/brew-cask/0.37.1/rubylib/cask/cli/install.rb:17:in `each'
/usr/local/Cellar/brew-cask/0.37.1/rubylib/cask/cli/install.rb:17:in `install_casks'
/usr/local/Cellar/brew-cask/0.37.1/rubylib/cask/cli/install.rb:6:in `run'
/usr/local/Cellar/brew-cask/0.37.1/rubylib/cask/cli.rb:80:in `run_command'
/usr/local/Cellar/brew-cask/0.37.1/rubylib/cask/cli.rb:120:in `process'
/usr/local/bin/brew-cask.rb:42:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/Library/brew.rb:59:in `require?'
/usr/local/Library/brew.rb:137:in `<main>'

Possibly relevant:

$ ruby -v
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]

from homebrew-cask-fonts.

rolandwalker avatar rolandwalker commented on May 13, 2024

I can extract it with the Unarchiver.

Sorry, missed that.

Sure, it's just one weird case, but homebrew-cask is more useful if it is robust against different cases.

I'm going to try duplicating this symptom using intentionally weird ACLs. You might double-check ACLs using Apple's ls:

$ /bin/ls -le /Library/Caches/Homebrew/font-m-plus-1.050.tar.xz

The only other thing I can think of that modifies the behavior of the file utility is the $MAGIC environment variable. Perhaps Homebrew-cask should unset that just to be safe.

Otherwise, I may add a fallback in the code to respect the downloaded file extension in cases where the file utility fails. Though it will be a little while before such a fix is merged and released.

Sorry I couldn't come up with an immediate workaround for you, but it is helpful data, thanks.

from homebrew-cask-fonts.

 avatar commented on May 13, 2024

You should try to brew install xz.

from homebrew-cask-fonts.

brian-c avatar brian-c commented on May 13, 2024

Hey, there ya go. Looks like xz was the missing bit. Thanks nanometre.

from homebrew-cask-fonts.

rolandwalker avatar rolandwalker commented on May 13, 2024

@nanometre, thanks for the analysis. The culprit is the -z flag to the file utility.

We use tar to unpack the archive, and Apple's tar knows how to unpack a .tar.xz file without any additional software. However, to determine the filetype, we invoke the following command

/usr/bin/file -Izb /Library/Caches/Homebrew/font-m-plus-1.050.tar.xz

The -z flag means "try to look inside compressed filetypes". Unlike the Apple-supplied tar, the Apple-supplied file utility does not have built-in xz support, and needs to invoke the xz utility in order to look inside and report the inner filetype.

Apple does not supply xz as a separate utility (which is odd, given that xz is the native format for pkg files).

The best solution for now is to add

depends_on_formula 'xz'

to the Cask.

from homebrew-cask-fonts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.