mtree.5 8.3 KB

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