Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0

Bug #18702 Unpacks incorrectly on long file names using header prefix
Submitted: 2011-08-03 03:40 UTC
From: hannes_landeholm Assigned: mrook
Status: Closed Package: Archive_Tar (version 1.3.7)
PHP Version: 5.3.6 OS: Irrelevant
Roadmaps: 1.3.8    
Subscription  


 [2011-08-03 03:40 UTC] hannes_landeholm (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']));

Comments

 [2011-08-07 17:58 UTC] mrook (Michiel Rook)
-Status: Open +Status: Assigned -Roadmap Versions: +Roadmap Versions: 1.3.8
 [2011-08-07 17:58 UTC] mrook (Michiel Rook)
-Status: Open +Status: Assigned -Assigned To: +Assigned To: mrook
 [2011-08-07 20:46 UTC] mrook (Michiel Rook)
-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.