Public bug reported:

I have a Linux file with data originally from a resource fork, I want to
copy the data to a HFS disk image, creating an HFS file with only a
resource fork.

`macstream` purports to create MacBinary streams, -r is used to specify
that the input is a bare resource fork. However:

    hmount macdisk.dsk    # HFS floppy image file, destination for hcopy
    export f=InputFile
    export tmp=`mktmp TMPRESOURCE.XXX`
    macstream -l -r  "${f}" >> "${tmp}"
    hcopy -m "${tmp}" :FileWithResourceFork

reports

  hcopy: "TMPRESOURCE.bd2": unknown, unsupported, or corrupt MacBinary
file (Invalid argument)

The desired outcome is that macstream produce a macbinary file
acceptable to hcopy.


It appears that hcopy (see hfsutils/copyin.c cpi_macb() function)

  # hfsutils/copyin.c Line 491
 
  crc = d_getuw(&buf[124]);

  if (crc_macb(buf, 124, 0x0000) != crc)
    {
      /* (buf[82] == 0) => MacBinary I? */

      ERROR(EINVAL, "unknown, unsupported, or corrupt MacBinary file");

      close(ifile);
      return -1;
    }


expects a 16-bit CRC value, at offset 124, to match the CRC computed over the 
first 124 bytes of the
header. This seems to match the "MacBinary II" standard (but not the MacBinary 
I standard)

https://files.stairways.com/other/macbinaryii-standard-info.txt states

 *Offset 122-Byte, Version number of Macbinary II that the uploading program
             is written for (the version begins at 129)
 *Offset 123-Byte, Minimum MacBinary II version needed to read this file
             (start this value at 129 129)
 *Offset 124-Word, CRC of previous 124 bytes

which matches the hcopy expectation, but not what macstream does.

I guess the feature request is that macstream compute the CRC as
expected by MacBinary II (perhaps under a command-line flag), instead of
leaving this field to be zero.

I can attempt to write a patch

** Affects: macutils (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2139010

Title:
  macutils macstream produces MacBinary files without a CRC, hfsutil
  hcopy  demands a CRC

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/macutils/+bug/2139010/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to