[Toybox] GNU tar sparse files

enh enh at google.com
Tue Apr 30 08:59:08 PDT 2019


there's a tar file checked in to AOSP that causes trouble for toybox
tar. you can find it (and the script that generates it) here:

https://android.googlesource.com/platform/system/update_engine/+/refs/heads/master/sample_images/

this:

      // Ignore everything else.
      } else skippy(TT.hdr.size);

means that we just plough on and fail later with "bad header" (which
is actually "i jumped into the middle of an entry because i didn't
understand what i was looking at earlier"). the actual problem seems
to be that the file has an entry of type 'S', which is apparently what
GNU tar does when given a sparse file:

00000000: 6469 736b 5f65 7874 325f 316b 2e69 6d67  disk_ext2_1k.img
00000010: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000020: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000030: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000050: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000060: 0000 0000 3030 3030 3634 3000 3131 3430  ....0000640.1140
00000070: 3031 3600 3030 3131 3631 3000 3030 3030  016.0011610.0000
00000080: 3031 3231 3030 3000 3133 3136 3332 3331  0121000.13163231
00000090: 3435 3500 3032 3434 3733 0020 5300 0000  455.024473. S...
000000a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000100: 0075 7374 6172 2020 0061 6861 7373 616e  .ustar  .ahassan
00000110: 6900 0000 0000 0000 0000 0000 0000 0000  i...............
00000120: 0000 0000 0000 0000 0065 6e67 0000 0000  .........eng....
00000130: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000140: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000150: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000160: 0000 0000 0000 0000 0000 0000 0000 0000  ................

it might be that the right thing to do here is just to reject unknown
entries, and for me to regenerate these tar files with toybox tar. but
i'll need to talk to the OTA folks first to understand what the intent
behind this test was...


More information about the Toybox mailing list