Comment 21 for bug 81844

Revision history for this message
Richard Wilbur (richard-wilbur) wrote : Re: [Bug 81844] Re: backslash in filename causes InvalidEntryName etc

On Jan 13, 2018, at 18:31, Jelmer Vernooij <email address hidden> wrote:
>
> The reason to be careful with support for backslashes is that it's impossible to check out files with backslashes in their name on Windows, and that Bazaar treats backslashes as path separators.

So I'm guessing it's an issue in Windows because Windows considers the backslash as a path separator so it naturally has no business being part of a filename in Windows.

Do you think we could get away with doing the complement of what we do with path separators between the two ecosystems? In *nix filesystems we use the forward slash as a path separator and thus it would be confusing in a filename. By the same token in DOS/Windows filesystems the backslash is a path separator and hence not allowed in filenames.

We adapt the way we encode/decode path names depending on the filesystem:
if filesystem is in set(DOS, Windows):
    separator = '\'
else:
    separator = '/'
If we adapted the filename based on the filesystem similarly:
if filesystem is in set(DOS, Windows):
    separator, escape = ('\', '/')
else:
    separator, escape = ('/', '\')

would that solve some problems? Would it cause other problems? I would vote for encoding the filename in the repository in the *nix fashion (like your branch allows) and translating the name to and from the DOS/Windows filesystems.