1 .\"----------------------------------------------------------------------------
2 .\""THE BEER-WARE LICENSE" (Revision 42):
3 .\"<joerg@FreeBSD.org> wrote this file. As long as you retain this notice you
4 .\"can do whatever you want with this stuff. If we meet some day, and you think
5 .\"this stuff is worth it, you can buy me a beer in return. Joerg Wunsch
6 .\"----------------------------------------------------------------------------
8 .\" This manual page is partially obtained from Poul-Hennings CTM README
11 .\" CTM and ctm(1) by <phk@FreeBSD.org>
13 .\" $FreeBSD: src/usr.sbin/ctm/ctm/ctm.1,v 1.17.2.9 2003/03/12 22:08:14 trhodes Exp $
20 .Nd source code mirror program
25 .Op Fl B Ar backup-file
26 .Op Fl e Ar include-regex
27 .Op Fl t Ar tar-command
30 .Op Fl x Ar exclude-regex
35 utility was originally
36 .Dq Cvs Through eMail ,
37 but now instead it seems more fitting to call it
38 .Dq Current Through eMail .
42 utility is now meant to be the definitive way to make and apply a delta between
43 two versions of a directory tree.
45 There are two parts to this, making the delta and applying it. These are two
46 entirely different things.
48 To apply a CTM delta, you pass it to the
50 command. You can pass a CTM delta on stdin, or you can give the
51 filename as an argument. If you do the latter, you make life a lot
52 easier for your self, since the program can accept gzip'ed files and
53 since it will not have to make a temporary copy of your file. You can
54 specify multiple deltas at one time, they will be processed one at a
55 time. Deltas that are already applied will be ignored.
59 command runs in a number of passes. It will process the entire
60 input file in each pass, before commencing with the next pass.
62 Before working on a file
65 first checks for the existence of the file
71 Pass 1 will verify that the input file is OK. The syntax, the data
72 and the global MD5 checksum will be checked. If any of these fail,
74 will simply reject the input file.
76 Pass 2 will validate that the directory tree is in the state expected by
77 the CTM delta. This is done by looking for files and directories which
78 should/should not exist and by checking the MD5 checksums of files.
82 had been specified using the
84 option, all files that would be modified by this
86 invocation are backed up
87 to this file using the archiver command specified by the
89 option. The default archiver command is
90 .Nm "tar -rf %s -T -" .
92 Pass 3 will actually apply the delta.
94 The list of files that would be modified by
96 is subject to filtering regular expressions specified
106 options are applied in order of appearance on the command line. The last
107 filter that matched a given file name determines whether the file would be
108 operated on or left alone by
114 will extract the file hierarchy below its working directory. Absolute
115 filenames or filenames containing references through
119 are explicitly prohibited as a security measure.
121 .Bl -tag -width indent
126 .It Fl B Ar backup-file
127 Backup all files that would be modified by this CTM run to
129 If any filters are specified using the
133 options, then the final set of files backed up are those that would be
134 modified by CTM after the filters are applied.
136 Check it out, don't do anything.
137 .It Fl e Ar regular_expression
138 Match each name in the CTM file against
139 .Ar regular_expression ,
140 and if it matches process the file, otherwise leave it alone. There may be
141 any number of these options. Use of this option disables the
143 sequence number checks. For example, the expression
145 for example, will select the
147 source directory and all pathnames under it.
149 Pathnames can be disabled from being considered by CTM using the
155 Keep files and directories and don't remove them even if the CTM file
156 specifies they are to be removed. If the
158 option is specified, these files and directories will not be backed up.
160 List files that would be modified by this invocation of CTM and the
161 actions that would be performed on them. Use of the
165 checks and integrity checks on the source tree being operated on. The
167 option can be combined with the
171 options to determine which files would be modified by the given set of
172 command line options.
175 .It Fl t Ar tar-command
178 instead of the default archiver
180 This option takes effect only if a backup file had been specified using the
182 option. A %s in the tar command will be replaced by the name of the backup
185 Put temporary files under
188 Set modification time of created and modified files to the CTM delta
195 is the level of verbosity.
196 .It Fl x Ar regular_expression
197 Match each name in the CTM file against
198 .Ar regular_expression
199 and if it matches, leave the file alone. There may be any number of these
200 options. Use of this option disables the
202 sequence number checks.
204 Pathnames can be selected for CTM's consideration using the
209 On its own, CTM is an insecure protocol
210 - there is no authentication performed that the
211 changes applied to the source code were sent by a
212 trusted party, and so care should be taken if the
213 CTM deltas are obtained via an unauthenticated
214 medium such as regular email.
215 It is a relatively simple matter for an attacker
216 to forge a CTM delta to replace or precede the
217 legitimate one and insert malicious code into your
219 If the legitimate delta is somehow prevented from
220 arriving, this will go unnoticed until a later
221 delta attempts to touch the same file, at which
222 point the MD5 checksum will fail.
224 To remedy this insecurity, CTM pieces generated by
225 FreeBSD.org are cryptographically signed in a
226 format compatible with the GNU Privacy Guard
227 utility, available in /usr/ports/security/gpg, and
228 the Pretty Good Privacy v5 utility,
229 /usr/ports/security/pgp5.
230 The relevant public key can be obtained by
231 fingering ctm@FreeBSD.org.
233 CTM deltas which are thus signed cannot be
234 undetectably altered by an attacker.
235 Therefore it is recommended that you make use of
236 GPG or PGP5 to verify the signatures if you
237 receive your CTM deltas via email.
240 if set to a pathname, will cause ctm to use that pathname
241 as the location of temporary file.
244 for more details on this.
245 The same effect may be achieved with the
250 contains the sequence number of the last CTM delta applied. Changing
251 or removing this file will greatly confuse
258 options can update a partial subset of the source tree and causes sources
259 to be in an inconsistent state. It is assumed that you know what you are
260 doing when you use these options.
264 /usr/sbin/ctm ~ctm/cvs-*
267 To extract and patch all sources under `lib'
270 /usr/sbin/ctm -e '^lib' ~ctm/src-cur*
273 Numerous messages, hopefully self-explanatory. The
275 can be adjusted with the
285 Initial trials were run during the work on
288 methods were hashed out.
295 The CTM system has been designed and implemented by
296 .An Poul-Henning Kamp
297 .Aq phk@FreeBSD.org .
300 .Aq joerg@FreeBSD.org