mtree - format of mtree dir hierarchy files
2. DESCRIPTION ▲
The format is a textual format that describes a collection of filesystem objects. Such files are typically used to create or verify directory hierarchies. .Ss General Format An file consists of a series of lines, each providing information about a single filesystem object. Leading whitespace is always ignored.
When encoding file or pathnames, any backslash character or character outside of the 95 printable ASCII characters must be encoded as a a backslash followed by three octal digits. When reading mtree files, any appearance of a backslash followed by three octal digits should be converted into the corresponding character.
Each line is interpreted independently as one of the following types:
-tag -width Cm
Signature The first line of any mtree file must begin with .Dq #mtree . If a file contains any full path entries, the first line should begin with .Dq #mtree v2.0 , otherwise, the first line should begin with .Dq #mtree v1.0 .
Blank Blank lines are ignored.
Comment Lines beginning with .Cm # are ignored.
Special Lines beginning with .Cm / are special commands that influence the interpretation of later lines.
Relative If the first whitespace-delimited word has no .Cm / characters, it is the name of a file in the current directory. Any relative entry that describes a directory changes the current directory.
dot-dot As a special case, a relative entry with the filename .Pa .. changes the current directory to the parent directory. Options on dot-dot entries are always ignored.
Full If the first whitespace-delimited word has a .Cm / character after the first character, it is the pathname of a file relative to the starting directory. There can be multiple full entries describing the same file.
Some tools that process files may require that multiple lines describing the same file occur consecutively. It is not permitted for the same file to be mentioned using both a relative and a full file specification. .Ss Special commands Two special commands are currently defined:
-tag -width Cm
Cm /set This command defines default values for one or more keywords. It is followed on the same line by one or more whitespace-separated keyword definitions. These definitions apply to all following files that do not specify a value for that keyword.
Cm /unset This command removes any default value set by a previous .Cm /set command. It is followed on the same line by one or more keywords separated by whitespace. .Ss Keywords After the filename, a full or relative entry consists of zero or more whitespace-separated keyword definitions. Each such definition consists of a key from the following list immediately followed by an '=' sign and a value. Software programs reading mtree files should warn about unrecognized keywords.
Currently supported keywords are as follows:
-tag -width Cm
Cm cksum The checksum of the file using the default algorithm specified by the cksum(1) utility.
Cm contents The full pathname of a file that holds the contents of this file.
Cm flags The file flags as a symbolic name. See chflags(1) for information on these names. If no flags are to be set the string .Dq none may be used to override the current default.
Cm gid The file group as a numeric value.
Cm gname The file group as a symbolic name.
Cm ignore Ignore any file hierarchy below this file.
Cm link The target of the symbolic link when type=link.
Cm md5 The MD5 message digest of the file.
Cm md5digest A synonym for .Cm md5 .
Cm mode The current file's permissions as a numeric (octal) or symbolic value.
Cm nlink The number of hard links the file is expected to have.
Cm nochange Make sure this file or directory exists but otherwise ignore all attributes.
Cm ripemd160digest The .Tn RIPEMD160 message digest of the file.
Cm rmd160 A synonym for .Cm ripemd160digest .
Cm rmd160digest A synonym for .Cm ripemd160digest .
Cm sha1 The .Tn FIPS 160-1 .Pq Dq Tn SHA-1 message digest of the file.
Cm sha1digest A synonym for .Cm sha1 .
Cm sha256 The .Tn FIPS 180-2 .Pq Dq Tn SHA-256 message digest of the file.
Cm sha256digest A synonym for .Cm sha256 .
Cm size The size, in bytes, of the file.
Cm time The last modification time of the file.
Cm type The type of the file; may be set to any one of the following:
-tag -width Cm -compact
Cm block block special device
Cm char character special device
Cm dir directory
Cm fifo fifo
Cm file regular file
Cm link symbolic link
Cm socket socket
Cm uid The file owner as a numeric value.
Cm uname The file owner as a symbolic name.
3. SEE ALSO ▲
4. BUGS ▲
The .Fx implementation of mtree does not currently support the 2.0 format. The requirement for a .Dq #mtree signature line is new and not yet widely implemented.
5. HISTORY ▲
The utility appeared in
x 4.3 Reno . The .Tn MD5 digest capability was added in .Fx 2.1 , in response to the widespread use of programs which can spoof cksum(1) . The .Tn SHA-1 and .Tn RIPEMD160 digests were added in .Fx 4.0 , as new attacks have demonstrated weaknesses in .Tn MD5 . The .Tn SHA-256 digest was added in .Fx 6.0 . Support for file flags was added in .Fx 4.0 , and mostly comes from .Nx . The .Dq full entry format was added by .Nx .