All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Schmitt" <scdbackup@gmx.net>
To: grub-devel@gnu.org
Cc: bug-xorriso@gnu.org
Subject: Re: grub-mkrescue hfsplus GPT partition is not mountable on Linux
Date: Sat, 26 Dec 2015 12:39:05 +0100	[thread overview]
Message-ID: <26526584800101287429@scdbackup.webframe.org> (raw)
In-Reply-To: <26508584595220407814@scdbackup.webframe.org>

Hi,

i hopefully identified the cause of the i/o error with kernel
message
    [  359.020970] hfsplus: walked past end of dir

It seems to be an original mistake by Vladimir (who normally
makes much less mistakes than i do).
Since Andrei is surely more familiar with Vladimir's coding habits
and quite surely has more clue about HFS+, i post my analysis for
review.

--------------------------------------------------------------------

In  libisofs/hfsplus.c  there is a function  create_tree() :

  http://bazaar.launchpad.net/~libburnia-team/libisofs/scdbackup/view/1249/libisofs/hfsplus.c#L299

It converts file objects from the libisofs tree model into objects
of the HFS+ tree model. The function returns 0 without creating
a new HFS+ tree object for files which it deems to be ignorable.
In case of error the return value is < 0.
In case of successful creation of HFS+ object and sub objects
it returns ISO_SUCCESS, which is > 0.

The two callers of create_tree() return error, if they receive
a return value < 0.
But they increment the directory children counter without
regarding return value 0.

This happens in the loop for populating the root directory

  http://bazaar.launchpad.net/~libburnia-team/libisofs/scdbackup/view/1249/libisofs/hfsplus.c#L1660

and in the loop for recursively populating other directories

  http://bazaar.launchpad.net/~libburnia-team/libisofs/scdbackup/view/1249/libisofs/hfsplus.c#L400

In my test runs, two files get ignored in the root directory:
  /boot.catalog  ... because it is not a data file in the libisofs
                     model but rather a boot catalog.
                     (For HFS+ this difference would not matter.)
  /efi.img ......... because it is explicitely hidden from HFS+.
                     (Not so clear why libisofs/eltorito.c hides
                      the first EFI boot image from HFS+. Shrug.)

So the HFS+ root directory gets a .nchildren count of 6, but only 4
HFS+ file objects get registered for populating the root directory.


The remedy is to increment .nchildren only if create_tree() returned
a value > 0.
After i changed both loops, i get from grub-mkrescue an ISO, where
i can mount and explore /dev/sdb3 (via GPT) without i/o error.

  http://bazaar.launchpad.net/~libburnia-team/libisofs/scdbackup/revision/1298/libisofs/hfsplus.c

--------------------------------------------------------------------

Have a nice day :)

Thomas



  reply	other threads:[~2015-12-26 11:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22 19:17 grub-mkrescue hfsplus GPT partition is not mountable on Linux Andrei Borzenkov
2015-12-22 21:32 ` Thomas Schmitt
2015-12-22 22:54 ` Thomas Schmitt
2015-12-24 20:32   ` Andrei Borzenkov
2015-12-25 10:36     ` Thomas Schmitt
2015-12-26 11:39       ` Thomas Schmitt [this message]
2015-12-26 14:57         ` [Bug-xorriso] " Andrei Borzenkov
2015-12-26 19:20           ` Thomas Schmitt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26526584800101287429@scdbackup.webframe.org \
    --to=scdbackup@gmx.net \
    --cc=bug-xorriso@gnu.org \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.