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

DeciTime.app #2654

Merged
merged 1 commit into from
Feb 15, 2014
Merged

DeciTime.app #2654

merged 1 commit into from
Feb 15, 2014

Conversation

tamird
Copy link
Contributor

@tamird tamird commented Jan 27, 2014

The inner dmg here fails to mount with a strange error message. Here's the debug output:

~ 1.9-staging brew cask install decitime --debug
==> Downloading http://download.filewell.com/DeciTime101.dmg.zip
Already downloaded: /Library/Caches/Homebrew/decitime-1.0.1.zip
==> Extracting nested container DeciTime101.dmg
Error: Command failed to execute!

==> Failed command:
/usr/bin/hdiutil 'mount' '-plist' '-nobrowse' '-readonly' '-noidme' '-mountrandom' '/tmp' '/opt/homebrew-cask/Caskroom/decitime/1.0.1/DeciTime101.dmg' 2>&1

==> Output of failed command:
hdiutil: mount failed - no mountable file systems
/usr/local/Cellar/brew-cask/0.27.1/rubylib/cask/system_command.rb:45:in `_assert_success'
/usr/local/Cellar/brew-cask/0.27.1/rubylib/cask/system_command.rb:15:in `run'
/usr/local/Cellar/brew-cask/0.27.1/rubylib/cask/system_command.rb:24:in `run!'
/usr/local/Cellar/brew-cask/0.27.1/rubylib/cask/container/dmg.rb:23:in `mount!'
/usr/local/Cellar/brew-cask/0.27.1/rubylib/cask/container/dmg.rb:13:in `extract'
/usr/local/Cellar/brew-cask/0.27.1/rubylib/cask/artifact/nested_container.rb:17:in `extract'
/usr/local/Cellar/brew-cask/0.27.1/rubylib/cask/artifact/nested_container.rb:3:in `install'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/set.rb:195:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/set.rb:195:in `each_key'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/set.rb:195:in `each'
/usr/local/Cellar/brew-cask/0.27.1/rubylib/cask/artifact/nested_container.rb:3:in `install'
/usr/local/Cellar/brew-cask/0.27.1/rubylib/cask/installer.rb:59:in `install_artifacts'
/usr/local/Cellar/brew-cask/0.27.1/rubylib/cask/installer.rb:58:in `each'
/usr/local/Cellar/brew-cask/0.27.1/rubylib/cask/installer.rb:58:in `install_artifacts'
/usr/local/Cellar/brew-cask/0.27.1/rubylib/cask/installer.rb:32:in `install'
/usr/local/Cellar/brew-cask/0.27.1/rubylib/cask/cli/install.rb:8:in `run'
/usr/local/Cellar/brew-cask/0.27.1/rubylib/cask/cli/install.rb:6:in `each'
/usr/local/Cellar/brew-cask/0.27.1/rubylib/cask/cli/install.rb:6:in `run'
/usr/local/Cellar/brew-cask/0.27.1/rubylib/cask/cli.rb:36:in `process'
/usr/local/bin/brew-cask.rb:6
/usr/local/Library/brew.rb:67:in `require'
/usr/local/Library/brew.rb:67:in `require?'
/usr/local/Library/brew.rb:113

Downloading and unzipping manually and then running the same hdiutil incantation works just fine, though :(

@rolandwalker
Copy link
Contributor

Hi! Thanks for the report!

I missed this last week, but will look into it today.

@rolandwalker
Copy link
Contributor

There is definitely something wonky about the DMG file. Don't get the wrong idea, I would still like to make brew cask work smoothly with this DMG, but we might need some changes to the backend code to make that happen.

One unusual thing about the DMG is the boot sector. I didn't look too far into that. But file DeciTime101.dmg reports differently than most other DMGs.

The second thing: the error you describe above is real -- and running the same hdiutil incantation does not work fine, so long as you duplicate what brew cask is doing with a fresh download.

The issue is the -readonly flag used by the Ruby code: the DMG cannot be opened with -readonly. However, opening the DMG one time without -readonly alters the file. The next time around it can be opened with -readonly, which accounts for the inconsistency you saw. Observe:

$ curl -LO http://download.filewell.com/DeciTime101.dmg.zip
$ unzip DeciTime101.dmg.zip -x '__MACOSX/*'
$ mkdir pristine
$ cp DeciTime101.dmg pristine/
$ /usr/bin/hdiutil mount -readonly  DeciTime101.dmg   # -readonly fails
hdiutil: mount failed - no mountable file systems
$ /usr/bin/hdiutil mount  DeciTime101.dmg             # works, and alters the DMG
$ /usr/bin/hdiutil eject /Volumes/DeciTime
$ /usr/bin/hdiutil mount -readonly DeciTime101.dmg    # -readonly works now !
$ /usr/bin/hdiutil eject /Volumes/DeciTime
$ cmp DeciTime101.dmg pristine/DeciTime101.dmg        # the images are different
DeciTime101.dmg pristine/DeciTime101.dmg differ: char 21511, line 1

Cool bug!

@rolandwalker
Copy link
Contributor

Since I can't come up with a proper way to make this DMG work using the current Cask language, I proposed some extensions to the DSL (before_install, linked above).

Another option would be to drop -readonly for all DMGs, but that seems like a radical change.

@rolandwalker
Copy link
Contributor

After then next code release, this Cask can be merged, if the following lines are added

  # fix wonky DMG by mounting it once read-write per discussion at
  # https://github.com/phinze/homebrew-cask/pull/2654
  before_install do
    system %Q{/usr/bin/hdiutil eject "$(/usr/bin/hdiutil mount -readwrite -noidme -nobrowse -mountrandom /tmp #{destination_path.join(artifacts[:nested_container].first)} | /usr/bin/cut -f3 | /usr/bin/grep '.')" >/dev/null 2>&1}
  end

@rolandwalker rolandwalker mentioned this pull request Feb 13, 2014
@tamird
Copy link
Contributor Author

tamird commented Feb 13, 2014

done

@rolandwalker
Copy link
Contributor

Thanks a bunch!

This will start working for people as soon as they update to the new release.

rolandwalker added a commit that referenced this pull request Feb 15, 2014
@rolandwalker rolandwalker merged commit f8dd831 into Homebrew:master Feb 15, 2014
@Homebrew Homebrew locked and limited conversation to collaborators May 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants