FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=18702&edit=1

ID: 18702
Updated by: mrook@php.net
Reported By: landeholm at gmail dot com
Summary: Unpacks incorrectly on long file names using header
prefix
-Status: Open
+Status: Assigned
Type: Bug
Package: Archive_Tar
Operating System: Irrelevant
Package Version: 1.3.7
PHP Version: 5.3.6
-Roadmap Versions:
+Roadmap Versions: 1.3.8
New Comment:

-Status: Open
+Status: Assigned
-Roadmap Versions:
+Roadmap Versions: 1.3.8



Previous Comments:
------------------------------------------------------------------------

[2011-08-02 23:40:58] hannes_landeholm

Description:
------------
Long file names does not unpack correctly when the prefix field in the
TAR header is set. This is because Archive_Tar ignore that field.

Test script:
---------------
This is a sample tar that has some long image file names that
incorrectly get extracted to root rather than into their target
directory: https://github.com/melt/melt/tarball/1.0

Here is the patch I used which fixed the problem:

@@ -1314,8 +1314,10 @@

$v_data =
unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/"

."a8checksum/a1typeflag/a100link/a6magic/a2version/"
- ."a32uname/a32gname/a8devmajor/a8devminor",
+ ."a32uname/a32gname/a8devmajor/a8devminor/a131prefix",
$v_binary_data);
+ if (strlen($v_data["prefix"]) > 0)
+ $v_data["filename"] = "$v_data[prefix]/$v_data[filename]";

// ----- Extract the checksum
$v_header['checksum'] = OctDec(trim($v_data['checksum']));

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

Search Discussions

  • Mrook at Aug 7, 2011 at 11:58 am
    Edit report at http://pear.php.net/bugs/bug.php?id=18702&edit=1

    ID: 18702
    Updated by: mrook@php.net
    Reported By: landeholm at gmail dot com
    Summary: Unpacks incorrectly on long file names using header
    prefix
    -Status: Open
    +Status: Assigned
    Type: Bug
    Package: Archive_Tar
    Operating System: Irrelevant
    Package Version: 1.3.7
    PHP Version: 5.3.6
    -Assigned To:
    +Assigned To: mrook
    Roadmap Versions:
    New Comment:

    -Status: Open
    +Status: Assigned
    -Assigned To:
    +Assigned To: mrook



    Previous Comments:
    ------------------------------------------------------------------------

    [2011-08-07 13:58:12] mrook

    -Status: Open
    +Status: Assigned
    -Roadmap Versions:
    +Roadmap Versions: 1.3.8


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

    [2011-08-02 23:40:58] hannes_landeholm

    Description:
    ------------
    Long file names does not unpack correctly when the prefix field in the
    TAR header is set. This is because Archive_Tar ignore that field.

    Test script:
    ---------------
    This is a sample tar that has some long image file names that
    incorrectly get extracted to root rather than into their target
    directory: https://github.com/melt/melt/tarball/1.0

    Here is the patch I used which fixed the problem:

    @@ -1314,8 +1314,10 @@

    $v_data =
    unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/"

    ."a8checksum/a1typeflag/a100link/a6magic/a2version/"
    - ."a32uname/a32gname/a8devmajor/a8devminor",
    + ."a32uname/a32gname/a8devmajor/a8devminor/a131prefix",
    $v_binary_data);
    + if (strlen($v_data["prefix"]) > 0)
    + $v_data["filename"] = "$v_data[prefix]/$v_data[filename]";

    // ----- Extract the checksum
    $v_header['checksum'] = OctDec(trim($v_data['checksum']));

    ------------------------------------------------------------------------
  • Mrook at Aug 7, 2011 at 2:45 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=18702&edit=1

    ID: 18702
    Updated by: mrook@php.net
    Reported By: landeholm at gmail dot com
    Summary: Unpacks incorrectly on long file names using header
    prefix
    -Status: Assigned
    +Status: Closed
    Type: Bug
    Package: Archive_Tar
    Operating System: Irrelevant
    Package Version: 1.3.7
    PHP Version: 5.3.6
    Assigned To: mrook
    Roadmap Versions:
    New Comment:

    -Status: Assigned
    +Status: Closed
    This bug has been fixed in SVN.

    If this was a documentation problem, the fix will appear on pear.php.net
    by the end of next Sunday (CET).

    If this was a problem with the pear.php.net website, the change should
    be live shortly.

    Otherwise, the fix will appear in the package's next release.

    Thank you for the report and for helping us make PEAR better.




    Previous Comments:
    ------------------------------------------------------------------------

    [2011-08-07 13:58:28] mrook

    -Status: Open
    +Status: Assigned
    -Assigned To:
    +Assigned To: mrook


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

    [2011-08-07 13:58:12] mrook

    -Status: Open
    +Status: Assigned
    -Roadmap Versions:
    +Roadmap Versions: 1.3.8


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

    [2011-08-02 23:40:58] hannes_landeholm

    Description:
    ------------
    Long file names does not unpack correctly when the prefix field in the
    TAR header is set. This is because Archive_Tar ignore that field.

    Test script:
    ---------------
    This is a sample tar that has some long image file names that
    incorrectly get extracted to root rather than into their target
    directory: https://github.com/melt/melt/tarball/1.0

    Here is the patch I used which fixed the problem:

    @@ -1314,8 +1314,10 @@

    $v_data =
    unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/"

    ."a8checksum/a1typeflag/a100link/a6magic/a2version/"
    - ."a32uname/a32gname/a8devmajor/a8devminor",
    + ."a32uname/a32gname/a8devmajor/a8devminor/a131prefix",
    $v_binary_data);
    + if (strlen($v_data["prefix"]) > 0)
    + $v_data["filename"] = "$v_data[prefix]/$v_data[filename]";

    // ----- Extract the checksum
    $v_header['checksum'] = OctDec(trim($v_data['checksum']));

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedAug 7, '11 at 11:58a
activeAug 7, '11 at 2:45p
posts3
users1
websitepear.php.net

1 user in discussion

Mrook: 3 posts

People

Translate

site design / logo © 2022 Grokbase