Bug #18877 [Opn->Csd]: Incorrect handling of backslashes in filenames on Linux

From: Date: Thu, 16 Feb 2012 19:08:40 +0000
Subject: Bug #18877 [Opn->Csd]: Incorrect handling of backslashes in filenames on Linux
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-8277@lists.php.net to get a copy of this message
Edit report at https://pear.php.net/bugs/bug.php?id=18877&edit=1 ID: 18877 Updated by: mrook@php.net Reported By: cedric dot floquet at gmail dot com Summary: Incorrect handling of backslashes in filenames on Linux -Status: Open +Status: Closed Type: Bug Package: Archive_Tar Operating System: Linux Package Version: 1.3.7 PHP Version: Irrelevant -Assigned To: +Assigned To: mrook -Roadmap Versions: +Roadmap Versions: 1.3.9 New Comment: -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. Previous Comments: ------------------------------------------------------------------------ [2011-09-27 17:19:44] ced_le_pingouin Added #patch bug:18877;patch:dont-translate-backslashes-on-linux;revision:1317140384;. ------------------------------------------------------------------------ [2011-09-27 17:15:44] ced_le_pingouin 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. ------------------------------------------------------------------------ -- Edit this bug report at https://pear.php.net/bugs/bug.php?id=18877&edit=1

« previous php.pear.bugs (#8277) next »