1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
.\" Copyright (c) 1989, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" From: @(#)mtree.8 8.2 (Berkeley) 12/11/93
.\" $FreeBSD$
.\"
.Dd September 4, 2013
.Dt MTREE 5
.Os
.Sh NAME
.Nm mtree
.Nd format of mtree dir hierarchy files
.Sh DESCRIPTION
The
.Nm
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
.Nm
file consists of a series of lines, each providing information
about a single filesystem object.
Leading whitespace is always ignored.
.Pp
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.
.Pp
Each line is interpreted independently as one of the following types:
.Bl -tag -width Cm
.It Blank
Blank lines are ignored.
.It Comment
Lines beginning with
.Cm #
are ignored.
.It Special
Lines beginning with
.Cm /
are special commands that influence
the interpretation of later lines.
.It 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.
.It 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.
.It 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.
.El
.Pp
Some tools that process
.Nm
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:
.Bl -tag -width Cm
.It 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.
.It 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.
.El
.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.
.Pp
Currently supported keywords are as follows:
.Bl -tag -width Cm
.It Cm cksum
The checksum of the file using the default algorithm specified by
the
.Xr cksum 1
utility.
.It Cm device
The device number for
.Sy block
or
.Sy char
file types.
The value must be one of the following forms:
.Pp
.Bl -tag -width 4n
.It Ar format , Ns Ar major , Ns Ar minor Ns Bo , Ns Ar subunit Bc
A device with
.Ar major , minor
and optional
.Ar subunit
fields.
Their meaning is specified by the operating's system
.Ar format .
See below for valid formats.
.It Ar number
Opaque number (as stored on the file system).
.El
.Pp
The following values for
.Ar format
are recognized:
.Sy native ,
.Sy 386bsd ,
.Sy 4bsd ,
.Sy bsdos ,
.Sy freebsd ,
.Sy hpux ,
.Sy isc ,
.Sy linux ,
.Sy netbsd ,
.Sy osf1 ,
.Sy sco ,
.Sy solaris ,
.Sy sunos ,
.Sy svr3 ,
.Sy svr4 ,
and
.Sy ultrix .
.Pp
See
.Xr mknod 8
for more details.
.It Cm contents
The full pathname of a file that holds the contents of this file.
.It Cm flags
The file flags as a symbolic name.
See
.Xr 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.
.It Cm gid
The file group as a numeric value.
.It Cm gname
The file group as a symbolic name.
.It Cm ignore
Ignore any file hierarchy below this file.
.It Cm inode
The inode number.
.It Cm link
The target of the symbolic link when type=link.
.It Cm md5
The MD5 message digest of the file.
.It Cm md5digest
A synonym for
.Cm md5 .
.It Cm mode
The current file's permissions as a numeric (octal) or symbolic
value.
.It Cm nlink
The number of hard links the file is expected to have.
.It Cm nochange
Make sure this file or directory exists but otherwise ignore all attributes.
.It Cm optional
The file is optional; do not complain about the file if it is not in
the file hierarchy.
.It Cm resdevice
The
.Dq resident
device number of the file, e.g. the ID of the device that
contains the file.
Its format is the same as the one for
.Cm device .
.It Cm ripemd160digest
The
.Tn RIPEMD160
message digest of the file.
.It Cm rmd160
A synonym for
.Cm ripemd160digest .
.It Cm rmd160digest
A synonym for
.Cm ripemd160digest .
.It Cm sha1
The
.Tn FIPS
160-1
.Pq Dq Tn SHA-1
message digest of the file.
.It Cm sha1digest
A synonym for
.Cm sha1 .
.It Cm sha256
The
.Tn FIPS
180-2
.Pq Dq Tn SHA-256
message digest of the file.
.It Cm sha256digest
A synonym for
.Cm sha256 .
.It Cm sha384
The
.Tn FIPS
180-2
.Pq Dq Tn SHA-384
message digest of the file.
.It Cm sha384digest
A synonym for
.Cm sha384 .
.It Cm sha512
The
.Tn FIPS
180-2
.Pq Dq Tn SHA-512
message digest of the file.
.It Cm sha512digest
A synonym for
.Cm sha512 .
.It Cm size
The size, in bytes, of the file.
.It Cm time
The last modification time of the file.
.It Cm type
The type of the file; may be set to any one of the following:
.Pp
.Bl -tag -width Cm -compact
.It Cm block
block special device
.It Cm char
character special device
.It Cm dir
directory
.It Cm fifo
fifo
.It Cm file
regular file
.It Cm link
symbolic link
.It Cm socket
socket
.El
.It Cm uid
The file owner as a numeric value.
.It Cm uname
The file owner as a symbolic name.
.El
.Pp
.Sh SEE ALSO
.Xr cksum 1 ,
.Xr find 1 ,
.Xr mtree 8
.Sh BUGS
.Sh HISTORY
The
.Nm
utility appeared in
.Bx 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
.Xr 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 .
|