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

Bug #18877 Incorrect handling of backslashes in filenames on Linux
Submitted: 2011-09-27 16:15 UTC Modified: 2012-02-16 19:08 UTC
From: ced_le_pingouin Assigned: mrook
Status: Closed Package: Archive_Tar (version 1.3.7)
PHP Version: Irrelevant OS: Linux
Roadmaps: 1.3.9    
Subscription  


 [2011-09-27 16:15 UTC] ced_le_pingouin (Cédric Floquet)
Description: ------------ In a project, I have several directories filled with files uploaded by users, and I have to move them to another machine, so I'm putting them in tar files (using Phing and its tar task, which uses Archive_Tar). Several of these files have backslashes in their name. I know it's generally a bad idea, but I have no control over this situation. The problem is that Archive_Tar "translates" the backslashes in the names to forward slashes. So the archive sees these files as a directory (the first part of the name before the slash), and a file inside it (named after the second part, after the slash). I looked at the code, and noticed that there is a _translateWinPath() method, which correctly translates paths with baskslahses *only* if the current OS is Windows. This method is used in several places, including a method named _addFile(). The problem is that _addFile() then calls another method, _pathReduction(), which performs its duty, then at the end... blindly replaces all backslashes with forward slashes, regardless of the current OS. So the efforts of _translateWinPath() are thrown away. I have written a small patch against v1.3.7, but I'm 100% sure it doesn't break anything else (I don't have the dev environment nor the tests for Archive_Tar installed). Expected result: ---------------- The following files should be in the archive: myfolder/A l\'ecole.txt myfolder/A l\'envers.txt Actual result: -------------- But the created archive contains this: myfolder/A l/'ecole.txt myfolder/A l/'envers.txt When extracted, I end up with a subfolder named "myfolder/A l", containing two files.

Comments

 [2011-09-27 16:19 UTC] ced_le_pingouin (Cédric Floquet)
 [2012-02-16 19:08 UTC] mrook (Michiel Rook)
-Status: Open +Status: Closed -Assigned To: +Assigned To: mrook -Roadmap Versions: +Roadmap Versions: 1.3.9
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.