Filename mangling
   HOME

TheInfoList



OR:

The process of filename mangling, in
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, ...
, involves a translation of the file name for compatibility at the
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs. Time-sharing operating systems schedule tasks for efficient use of the system and may also i ...
level. It occurs when a filename on a
filesystem In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is Computer data storage, stored and retrieved. Without a file system, data placed in a storage me ...
appears in a form incompatible with the operating system accessing it. Such mangling occurs, for example, on
computer network A computer network is a set of computers sharing resources located on or provided by network nodes. The computers use common communication protocols over digital interconnections to communicate with each other. These interconnections are ...
s when a
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for ser ...
machine attempts to access a file on a
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, an ...
server and that file has a filename which includes characters not valid in Windows.


FAT Derivative Filesystem


Legacy support under VFAT

A common example of name mangling occurs on VFAT file systems on versions of Windows from
Windows 95 Windows 95 is a consumer-oriented operating system developed by Microsoft as part of its Windows 9x family of operating systems. The first operating system in the 9x family, it is the successor to Windows 3.1x, and was released to manufacturi ...
onwards. The VFAT specification allows Long File Names (LFNs). For backwards-compatibility with
MS-DOS MS-DOS ( ; acronym for Microsoft Disk Operating System, also known as Microsoft DOS) is an operating system for x86-based personal computers mostly developed by Microsoft. Collectively, MS-DOS, its rebranding as IBM PC DOS, and a few ope ...
and older Windows software, which recognizes filenames of a maximum of 11 characters in length with 8.3 format (i.e.: an eight-letter filename, a dot and a three-letter extension, such as autoexec.bat), files with LFNs get stored on disk in 8.3 format (longfilename.txt becoming longfi~1.txt), with the long file name stored elsewhere on the disk. Normally, when using compatible Windows programs which use standard Windows methods of reading the disk, the I/O subsystem returns the long filename to the program — however, if an old DOS application or an old Windows application tries to address the file, it will use the older, 8.3-only APIs, or work at a lower level and perform its own disk access, which results in the return of an 8.3 filename. In this case, the filenames become mangled by taking the first six non-space characters in the filename and adding a
tilde The tilde () or , is a grapheme with several uses. The name of the character came into English from Spanish, which in turn came from the Latin '' titulus'', meaning "title" or "superscription". Its primary use is as a diacritic (accent) i ...
(~) and then a number to ensure the uniqueness of the 8.3 filename on the disk. This mangling scheme can turn (for example) Program Files into PROGRA~1. This technique persists today when people use DOSBox to play classic DOS games or use Windows 3.1 in conjunction to play
Win16 The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. The name Windows API collectively refers to several different platform implementations th ...
games on 64-bit Windows.


Unix Filesystems

Unix file names can contain colons or
backslash The backslash is a typographical mark used mainly in computing and mathematics. It is the mirror image of the common slash . It is a relatively recent mark, first documented in the 1930s. History , efforts to identify either the origin of ...
es, whereas Windows interprets such characters in other ways. Accordingly, software could mangle the Unix file "Notes: 11\04\03" as "Notes_ 11-04-03" to enable Windows software to remotely access the file. Other
Unix-like A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
systems, such as Samba on Unix, use different mangling systems to map long filenames to DOS-compatible filenames (although Samba administrators can configure this behavior in the config file).


Mac OS

macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and lapt ...
's Finder displays instances of " :" in file and directory names with a " /". This is because the classic Mac OS used the ":" character internally as a path separator. Listing these files or directories using a
terminal emulator A terminal emulator, or terminal application, is a computer program that emulates a video terminal within some other display architecture. Though typically synonymous with a shell or text terminal, the term ''terminal'' covers all remote term ...
displays a ":" rather than the "/" character, though.


References

{{Computer files Computer file systems Computer files