Text-mode apps (Was :Who are the "spacists"?)

eryk sun eryksun at gmail.com
Sat Apr 1 14:45:03 EDT 2017


On Sat, Apr 1, 2017 at 5:38 PM, Steve D'Aprano
<steve+python at pearwood.info> wrote:
> Or, for Windows, I suppose a dozen or so more characters:
>
> https://support.office.com/en-us/article/Invalid-characters-in-file-or-folder-names-or-invalid-
> file-types-in-OneDrive-for-Business-64883A5D-228E-48F5-B3D2-EB39E07630FA

It's more than a dozen reserved characters. If we're strictly
following the file-system runtime library conventions, then all ASCII
control characters (0-31) are reserved as well as pipe; the path
separators slash, backslash, and colon (named streams); and the
wildcard characters asterisk, question mark, less than, greater than,
and double quote.

Except for backslash, which is reserved by the object manager, these
reservations are imposed by the FsRtl, and in theory I think a custom
file system *could* ignore this. This would require using the \\?\
prefix and, in some cases, it would also require applications to use
the native NT API in order to avoid DOS conventions. It would also
need some private escape sequence to tell the file system, for
example, that an asterisk in a directory listing filter isn't supposed
to be a wildcard. These constraints would be too cumbersome,
confusing, and unworkable in general, so the system's use would
probably need to be restricted to a specific set of applications or an
NT subsystem that can hide the implementation details.

For a real-world example, the Linux subsystem in Windows 10 (WSL)
stores the POSIX namespace files that it creates using regular files
in a hidden folder in the user's profile. It has to escape characters
that are reserved:

    $ touch 'test*?<>":\|.txt'

    C:\>dir /b %localappdata%\lxss\home\%username%\test*
    test#002A#003F#003C#003E#0022#003A#005C#007C.txt



More information about the Python-list mailing list