[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: backslashes in filenames
From: |
Eli Zaretskii |
Subject: |
Re: backslashes in filenames |
Date: |
Thu, 19 Sep 2002 14:01:09 +0200 (IST) |
On Fri, 13 Sep 2002, David Shea wrote:
> GNU tar seems to break when fed filenames on the command-line containing
> backslashes, since it tries to decode them using C-style escape sequences,
> but never encoded them to begin with. The attached patch should fix this.
> It encodes the filenames fed to tar on the command-line, and adds a simple
> mechanism for the memory used by the freshly encoded filenames to be freed
> when the list of names is no longer needed.
IMHO, this is not a good idea. The reason is that many places of Tar's
code manipulate file names (e.g., to extract its directory part), and
those places have '/' hard-coded into them. More importantly, the Tar
file format specifies that the directory separator must be '/'.
For these reasons, I think it's much better to handle this problem by
converting each '\' into '/' where Tar processes command-line
arguments. A patch in that spirit was written for the MS-DOS/MS-Windows
port of Tar and submitted to the maintainer long ago, and it awaits
integration into the official sources since then. A binary based on
those patches can be found in the DJGPP collection of ports of GNU
software (see http://www.delorie.com/djgpp).