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

Bug #10144 long filenames are not stored correctly
Submitted: 2007-02-21 14:31 UTC
From: fritsch+pear dot php dot net at in dot tum dot de Assigned: cbrunet
Status: Verified Package: File_Archive (version 1.5.3)
PHP Version: Irrelevant OS: Ubuntu
Roadmaps: 1.5.5    
Subscription  
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
2010-09-06 19:05 UTC
Package:
Bug Type:
Summary:
From: fritsch+pear dot php dot net at in dot tum dot de
New email:
PHP Version: Package Version: OS:

 

 [2007-02-21 14:31 UTC] fritsch+pear dot php dot net at in dot tum dot de (Hagen Fritsch)
Description: ------------ In Writer/Tar.php it reads like this: $filePrefix = ''; if (strlen($filename) > 255) { return PEAR::raiseError( "$filename is too long to be put in a tar archive" ); } else if (strlen($filename) > 100) { $filePrefix = substr($filename, 0, strlen($filename)-100); $filename = substr($filename, -100); } Actually (at least unix tar handles archives like that) the prefix needs to be a path-component, so that "$filePrefix/$filename" is the actual filename. This is not handled correctly by the above code, so it will inject a slash at strlen()-100 for the filename, resulting in really messy tarfiles. Test script: --------------- A solution might look like this: } else if (strlen($filename) > 100) { #need a path component of max 155 bytes $pos = strrpos(substr($filename, 0, 155), '/'); if(strlen($filename) - $pos > 100) #filename-component may not exceed 100 bytes return PEAR::raiseError( "$filename is too long to be put in a tar archive" ); $filePrefix = substr($filename, 0, $pos); $filename = substr($filename, $pos+1); echo "$filePrefix vs $filename<br>\n"; }

Comments

 [2008-06-04 19:15 UTC] cbrunet (Charles Brunet)
Tar archives use a special way to store long filenames. It seems that File_Archive doesn't actually fully support it. I integrated your patch, but it doesn't fully solve the problem.
 [2010-09-06 19:05 UTC] doconnor (Daniel O'Connor)
Related to Bug #14622 ?