PAX扩展tar头的问题

时间:2016-04-27 14:05:12

标签: java

我对扩展PAX Tar标头标准有一些问题。

我编写了一个程序,逐个读取文件并打印一些信息,在此过程中显示ustar校验和。这是我将PAX Tar输入程序时的输出。它是用Java编写的。

run:
Reading at 0
Verifying header checksum...
Checksum valid.
Found: .PKGINFO
Header is PAX: false
File size: 1055
Next header offset: 2048
--------------------------------------
Reading at 2048
Verifying header checksum...
Checksum valid.
Found: .BUILDINFO
Header is PAX: false
File size: 8419
Next header offset: 11264
--------------------------------------
Reading at 11264
Verifying header checksum...
Checksum valid.
Found: .INSTALL
Header is PAX: false
File size: 175
Next header offset: 12288
--------------------------------------
Reading at 12288
Verifying header checksum...
Checksum valid.
Found: .MTREE
Header is PAX: false
File size: 4025
Next header offset: 16896
--------------------------------------
Reading at 16896
Verifying header checksum...
Checksum valid.
Found: usr/
Header is PAX: false
File size: 0
Next header offset: 17408
--------------------------------------
Reading at 17408
Verifying header checksum...
Checksum valid.
Found: usr/lib/
Header is PAX: false
File size: 0
Next header offset: 17920
--------------------------------------
Reading at 17920
Verifying header checksum...
Checksum valid.
Found: usr/bin/
Header is PAX: false
File size: 0
Next header offset: 18432
--------------------------------------
Reading at 18432
Verifying header checksum...
Checksum valid.
Found: usr/share/
Header is PAX: false
File size: 0
Next header offset: 18944
--------------------------------------
Reading at 18944
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/
Header is PAX: false
File size: 0
Next header offset: 19456
--------------------------------------
Reading at 19456
Verifying header checksum...
Checksum valid.
Found: usr/share/applications/
Header is PAX: false
File size: 0
Next header offset: 19968
--------------------------------------
Reading at 19968
Verifying header checksum...
Checksum valid.
Found: usr/share/applications/firefox.desktop
Header is PAX: false
File size: 13148
Next header offset: 33792
--------------------------------------
Reading at 33792
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/
Header is PAX: false
File size: 0
Next header offset: 34304
--------------------------------------
Reading at 34304
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/16x16/
Header is PAX: false
File size: 0
Next header offset: 34816
--------------------------------------
Reading at 34816
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/22x22/
Header is PAX: false
File size: 0
Next header offset: 35328
--------------------------------------
Reading at 35328
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/24x24/
Header is PAX: false
File size: 0
Next header offset: 35840
--------------------------------------
Reading at 35840
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/32x32/
Header is PAX: false
File size: 0
Next header offset: 36352
--------------------------------------
Reading at 36352
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/48x48/
Header is PAX: false
File size: 0
Next header offset: 36864
--------------------------------------
Reading at 36864
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/256x256/
Header is PAX: false
File size: 0
Next header offset: 37376
--------------------------------------
Reading at 37376
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/64x64/
Header is PAX: false
File size: 0
Next header offset: 37888
--------------------------------------
Reading at 37888
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/128x128/
Header is PAX: false
File size: 0
Next header offset: 38400
--------------------------------------
Reading at 38400
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/192x192/
Header is PAX: false
File size: 0
Next header offset: 38912
--------------------------------------
Reading at 38912
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/384x384/
Header is PAX: false
File size: 0
Next header offset: 39424
--------------------------------------
Reading at 39424
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/symbolic/
Header is PAX: false
File size: 0
Next header offset: 39936
--------------------------------------
Reading at 39936
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/symbolic/apps/
Header is PAX: false
File size: 0
Next header offset: 40448
--------------------------------------
Reading at 40448
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/symbolic/apps/PaxHeader/firefox-symbolic.svg
Header is PAX: true
File size: 118
Next header offset: 41472
--------------------------------------
Reading at 41472
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/symbolic/apps/firefox-symbolic.svg
Header is PAX: false
File size: 6935
Next header offset: 49152
--------------------------------------
Reading at 49152
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/384x384/apps/
Header is PAX: false
File size: 0
Next header offset: 49664
--------------------------------------
Reading at 49664
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/384x384/apps/PaxHeader/firefox.png
Header is PAX: true
File size: 118
Next header offset: 50688
--------------------------------------
Reading at 50688
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/384x384/apps/firefox.png
Header is PAX: false
File size: 78972
Next header offset: 130560
--------------------------------------
Reading at 130560
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/192x192/apps/
Header is PAX: false
File size: 0
Next header offset: 131072
--------------------------------------
Reading at 131072
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/192x192/apps/PaxHeader/firefox.png
Header is PAX: true
File size: 118
Next header offset: 132096
--------------------------------------
Reading at 132096
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/192x192/apps/firefox.png
Header is PAX: false
File size: 30788
Next header offset: 163840
--------------------------------------
Reading at 163840
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/128x128/apps/
Header is PAX: false
File size: 0
Next header offset: 164352
--------------------------------------
Reading at 164352
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/128x128/apps/PaxHeader/firefox.png
Header is PAX: true
File size: 118
Next header offset: 165376
--------------------------------------
Reading at 165376
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/128x128/apps/firefox.png
Header is PAX: false
File size: 17225
Next header offset: 183296
--------------------------------------
Reading at 183296
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/64x64/apps/
Header is PAX: false
File size: 0
Next header offset: 183808
--------------------------------------
Reading at 183808
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/64x64/apps/PaxHeader/firefox.png
Header is PAX: true
File size: 118
Next header offset: 184832
--------------------------------------
Reading at 184832
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/64x64/apps/firefox.png
Header is PAX: false
File size: 6081
Next header offset: 191488
--------------------------------------
Reading at 191488
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/256x256/apps/
Header is PAX: false
File size: 0
Next header offset: 192000
--------------------------------------
Reading at 192000
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/256x256/apps/PaxHeader/firefox.png
Header is PAX: true
File size: 118
Next header offset: 193024
--------------------------------------
Reading at 193024
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/256x256/apps/firefox.png
Header is PAX: false
File size: 44148
Next header offset: 238080
--------------------------------------
Reading at 238080
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/48x48/apps/
Header is PAX: false
File size: 0
Next header offset: 238592
--------------------------------------
Reading at 238592
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/48x48/apps/PaxHeader/firefox.png
Header is PAX: true
File size: 118
Next header offset: 239616
--------------------------------------
Reading at 239616
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/48x48/apps/firefox.png
Header is PAX: false
File size: 4096
Next header offset: 244736
--------------------------------------
Reading at 244736
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/32x32/apps/firefox.png
Header is PAX: false
File size: 2472
Next header offset: 247808
--------------------------------------
Reading at 247808
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/24x24/apps/
Header is PAX: false
File size: 0
Next header offset: 248320
--------------------------------------
Reading at 248320
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/24x24/apps/firefox.png
Header is PAX: false
File size: 1327
Next header offset: 250368
--------------------------------------
Reading at 250368
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/22x22/apps/
Header is PAX: false
File size: 0
Next header offset: 250880
--------------------------------------
Reading at 250880
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/22x22/apps/firefox.png
Header is PAX: false
File size: 1319
Next header offset: 252928
--------------------------------------
Reading at 252928
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/16x16/apps/
Header is PAX: false
File size: 0
Next header offset: 253440
--------------------------------------
Reading at 253440
Verifying header checksum...
Checksum valid.
Found: usr/share/icons/hicolor/16x16/apps/firefox.png
Header is PAX: false
File size: 829
Next header offset: 254976
--------------------------------------
Reading at 254976
Verifying header checksum...
Checksum valid.
Found: usr/bin/firefox
Header is PAX: false
File size: 0
Next header offset: 255488
--------------------------------------
Reading at 255488
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/
Header is PAX: false
File size: 0
Next header offset: 256000
--------------------------------------
Reading at 256000
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/gtk2/
Header is PAX: false
File size: 0
Next header offset: 256512
--------------------------------------
Reading at 256512
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/
Header is PAX: false
File size: 0
Next header offset: 257024
--------------------------------------
Reading at 257024
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/defaults/
Header is PAX: false
File size: 0
Next header offset: 257536
--------------------------------------
Reading at 257536
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/webapprt/
Header is PAX: false
File size: 0
Next header offset: 258048
--------------------------------------
Reading at 258048
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/gmp-clearkey/
Header is PAX: false
File size: 0
Next header offset: 258560
--------------------------------------
Reading at 258560
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/PaxHeader/omni.ja
Header is PAX: true
File size: 87
Next header offset: 259584
--------------------------------------
Reading at 259584
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/omni.ja
Header is PAX: false
File size: 9588234
Next header offset: 9848832
--------------------------------------
Reading at 9848832
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/dependentlibs.list
Header is PAX: false
File size: 38
Next header offset: 9849856
--------------------------------------
Reading at 9849856
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/application.ini
Header is PAX: false
File size: 419
Next header offset: 9850880
--------------------------------------
Reading at 9850880
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/platform.ini
Header is PAX: false
File size: 48
Next header offset: 9851904
--------------------------------------
Reading at 9851904
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/run-mozilla.sh
Header is PAX: false
File size: 8915
Next header offset: 9861632
--------------------------------------
Reading at 9861632
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/removed-files
Header is PAX: false
File size: 707
Next header offset: 9863168
--------------------------------------
Reading at 9863168
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/dictionaries
Header is PAX: false
File size: 0
Next header offset: 9863680
--------------------------------------
Reading at 9863680
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/hyphenation
Header is PAX: false
File size: 0
Next header offset: 9864192
--------------------------------------
Reading at 9864192
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/firefox-bin
Header is PAX: false
File size: 0
Next header offset: 9864704
--------------------------------------
Reading at 9864704
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/PaxHeader/libxul.so
Header is PAX: true
File size: 116
Next header offset: 9865728
--------------------------------------
Reading at 9865728
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/libxul.so
Header is PAX: false
File size: 71366624
Next header offset: 81232896
--------------------------------------
Reading at 81232896
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/plugin-container
Header is PAX: false
File size: 454592
Next header offset: 81688064
--------------------------------------
Reading at 81688064
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/libmozgtk.so
Header is PAX: false
File size: 6000
Next header offset: 81694720
--------------------------------------
Reading at 81694720
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/firefox
Header is PAX: false
File size: 154800
Next header offset: 81850368
--------------------------------------
Reading at 81850368
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/liblgpllibs.so
Header is PAX: false
File size: 60272
Next header offset: 81911296
--------------------------------------
Reading at 81911296
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/webapprt-stub
Header is PAX: false
File size: 191792
Next header offset: 82103808
--------------------------------------
Reading at 82103808
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/gmp-clearkey/0.1/
Header is PAX: false
File size: 0
Next header offset: 82104320
--------------------------------------
Reading at 82104320
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/gmp-clearkey/0.1/clearkey.info
Header is PAX: false
File size: 116
Next header offset: 82105344
--------------------------------------
Reading at 82105344
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/gmp-clearkey/0.1/libclearkey.so
Header is PAX: false
File size: 117480
Next header offset: 82223616
--------------------------------------
Reading at 82223616
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/webapprt/webapprt.ini
Header is PAX: false
File size: 485
Next header offset: 82224640
--------------------------------------
Reading at 82224640
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/webapprt/omni.ja
Header is PAX: false
File size: 75149
Next header offset: 82300416
--------------------------------------
Reading at 82300416
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/defaults/pref/
Header is PAX: false
File size: 0
Next header offset: 82300928
--------------------------------------
Reading at 82300928
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/defaults/pref/channel-prefs.js
Header is PAX: false
File size: 245
Next header offset: 82301952
--------------------------------------
Reading at 82301952
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/icons/
Header is PAX: false
File size: 0
Next header offset: 82302464
--------------------------------------
Reading at 82302464
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/chrome/
Header is PAX: false
File size: 0
Next header offset: 82302976
--------------------------------------
Reading at 82302976
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/features/
Header is PAX: false
File size: 0
Next header offset: 82303488
--------------------------------------
Reading at 82303488
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/components/
Header is PAX: false
File size: 0
Next header offset: 82304000
--------------------------------------
Reading at 82304000
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/extensions/
Header is PAX: false
File size: 0
Next header offset: 82304512
--------------------------------------
Reading at 82304512
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/chrome.manifest
Header is PAX: false
File size: 40
Next header offset: 82305536
--------------------------------------
Reading at 82305536
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/PaxHeader/omni.ja
Header is PAX: true
File size: 88
Next header offset: 82306560
--------------------------------------
Reading at 82306560
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/omni.ja
Header is PAX: false
File size: 12326304
Next header offset: 94633472
--------------------------------------
Reading at 94633472
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/blocklist.xml
Header is PAX: false
File size: 215251
Next header offset: 94849536
--------------------------------------
Reading at 94849536
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/defaults/
Header is PAX: false
File size: 0
Next header offset: 94850048
--------------------------------------
Reading at 94850048
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/defaults/preferences/
Header is PAX: false
File size: 0
Next header offset: 94850560
--------------------------------------
Reading at 94850560
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/defaults/preferences/vendor.js
Header is PAX: false
File size: 328
Next header offset: 94851584
--------------------------------------
Reading at 94851584
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi
Header is PAX: false
File size: 3375
Next header offset: 94855680
--------------------------------------
Reading at 94855680
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/components/components.manifest
Header is PAX: false
File size: 36
Next header offset: 94856704
--------------------------------------
Reading at 94856704
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/components/libbrowsercomps.so
Header is PAX: false
File size: 60064
Next header offset: 94917632
--------------------------------------
Reading at 94917632
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/features/PaxHeader/loop@mozilla.org.xpi
Header is PAX: true
File size: 88
Next header offset: 94918656
--------------------------------------
Reading at 94918656
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/features/loop@mozilla.org.xpi
Header is PAX: false
File size: 1582541
Next header offset: 96501760
--------------------------------------
Reading at 96501760
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/chrome/icons/
Header is PAX: false
File size: 0
Next header offset: 96502272
--------------------------------------
Reading at 96502272
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/chrome/icons/default/
Header is PAX: false
File size: 0
Next header offset: 96502784
--------------------------------------
Reading at 96502784
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/chrome/icons/default/default16.png
Header is PAX: false
File size: 829
Next header offset: 96504320
--------------------------------------
Reading at 96504320
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/chrome/icons/default/default32.png
Header is PAX: false
File size: 2472
Next header offset: 96507392
--------------------------------------
Reading at 96507392
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/chrome/icons/default/PaxHeader/default48.png
Header is PAX: true
File size: 88
Next header offset: 96508416
--------------------------------------
Reading at 96508416
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/chrome/icons/default/default48.png
Header is PAX: false
File size: 4096
Next header offset: 96513536
--------------------------------------
Reading at 96513536
Verifying header checksum...
An tar error occured: Invalid Tar header checksum!
BUILD SUCCESSFUL (total time: 0 seconds)

在字节96513536,我把它包括在内:

enter image description here

经过一番研究后,我发现这是PAX Extended标头。问题是这个标题在弹出之前不会被发送到任何地方。

如何预测此标题并按照其处理?

这是我程序有效传递的输出。

run:
Reading at 0
Verifying header checksum...
Checksum valid.
Found: Test1/
Header is PAX: false
File size: 0
Next header offset: 512
--------------------------------------
Reading at 512
Verifying header checksum...
Checksum valid.
Found: Test1/test_1
Header is PAX: false
File size: 0
Next header offset: 1024
--------------------------------------
Reading at 1024
Verifying header checksum...
Checksum valid.
Found: Test2/
Header is PAX: false
File size: 0
Next header offset: 1536
--------------------------------------
Reading at 1536
Verifying header checksum...
Checksum valid.
Found: Test2/Test_2
Header is PAX: false
File size: 0
Next header offset: 2048
--------------------------------------
Reading at 2048
Verifying header checksum...
Checksum valid.
Found: test_3
Header is PAX: false
File size: 0
Next header offset: 2560
--------------------------------------
Reading at 2560
Verifying header checksum...
Invalid checksum, Tar EOF found.

Finnished reading, read 5 files and folders.
This took 15ms
BUILD SUCCESSFUL (total time: 0 seconds)

如何预测PAX标头? PAX如何工作?什么是PaxHeader文件夹?

2 个答案:

答案 0 :(得分:0)

问题在于我计算下一个标题的逻辑。

Reading at 96508416
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/chrome/icons/default/default48.png
Header is PAX: false
File size: 4096
Next header offset: 96513536
--------------------------------------
Reading at 96513536
Verifying header checksum...
An tar error occured: Invalid Tar header checksum!
BUILD SUCCESSFUL (total time: 0 seconds)

文件大小为4096字节。这是问题,我的代码看起来像这样:

private void setOffsetToNextHeader(int size) {
        if (size == 0) {
            offset += 512;
        } else {
            offset += (((size + 512) / 512) + 1) * 512;
        }
    }

这样,偏移量被设置为512字节太多,因为算法依赖于在除以512时整数舍入。

如果没有发生骚扰,结果将乘以过多一次512。

将上述代码更改为:

private void setOffsetToNextHeader(int size) {
        if (size == 0) {
            offset += 512;
        } else if ((size % 512) == 0) {
            offset += size + 512;
        } else {
            offset += (((size + 512) / 512) + 1) * 512;
        }
    }

解决了这个问题。

这是我期待的程序的有效输出:

--------------------------------------
Reading at 96508416
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/chrome/icons/default/default48.png
PAX Header prefix: false
File size: 4096
Next header offset: 96513024
Extracting...
--------------------------------------
Reading at 96513024
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/icons/PaxHeader/mozicon128.png
PAX Header prefix: true
File size: 88
Next header offset: 96514048
Extracting...
--------------------------------------
Reading at 96514048
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/browser/icons/mozicon128.png
PAX Header prefix: false
File size: 17225
Next header offset: 96531968
Extracting...
--------------------------------------
Reading at 96531968
Verifying header checksum...
Checksum valid.
Found: usr/lib/firefox/gtk2/libmozgtk.so
PAX Header prefix: false
File size: 10096
Next header offset: 96542720
Extracting...
--------------------------------------
Reading at 96542720
Verifying header checksum...
Tar EOF found.

Finnished reading, read 109 files and folders.
This took 94ms
BUILD SUCCESSFUL (total time: 0 seconds)

答案 1 :(得分:0)

您可能会发现

offset += ((size + 511) / 512) + 512;

涵盖您的if/else if/else的所有三种情况。