/contrib/cvs/doc/cvsclient.texi

https://bitbucket.org/freebsd/freebsd-head/ · Unknown · 2080 lines · 1788 code · 292 blank · 0 comment · 0 complexity · d0204570b0f364de896fd056ee1a9ca7 MD5 · raw file

Large files are truncated click here to view the full file

  1. \input texinfo @c -*- texinfo -*-
  2. @setfilename cvsclient.info
  3. @include version-client.texi
  4. @dircategory Programming
  5. @direntry
  6. * cvsclient: (cvsclient). The CVS client/server protocol.
  7. @end direntry
  8. @node Top
  9. @top CVS Client/Server
  10. This document describes the client/server protocol used by CVS. It does
  11. not describe how to use or administer client/server CVS; see the regular
  12. CVS manual for that. This is version @value{VERSION} of the protocol
  13. specification---@xref{Introduction}, for more on what this version number
  14. means.
  15. @menu
  16. * Introduction:: What is CVS and what is the client/server protocol for?
  17. * Goals:: Basic design decisions, requirements, scope, etc.
  18. * Connection and Authentication:: Various ways to connect to the server
  19. * Password scrambling:: Scrambling used by pserver
  20. * Protocol:: Complete description of the protocol
  21. * Protocol Notes:: Possible enhancements, limitations, etc. of the protocol
  22. @end menu
  23. @node Introduction
  24. @chapter Introduction
  25. CVS is a version control system (with some additional configuration
  26. management functionality). It maintains a central @dfn{repository}
  27. which stores files (often source code), including past versions,
  28. information about who modified them and when, and so on. People who
  29. wish to look at or modify those files, known as @dfn{developers}, use
  30. CVS to @dfn{check out} a @dfn{working directory} from the repository, to
  31. @dfn{check in} new versions of files to the repository, and other
  32. operations such as viewing the modification history of a file. If
  33. developers are connected to the repository by a network, particularly a
  34. slow or flaky one, the most efficient way to use the network is with the
  35. CVS-specific protocol described in this document.
  36. Developers, using the machine on which they store their working
  37. directory, run the CVS @dfn{client} program. To perform operations
  38. which cannot be done locally, it connects to the CVS @dfn{server}
  39. program, which maintains the repository. For more information on how
  40. to connect see @ref{Connection and Authentication}.
  41. This document describes the CVS protocol. Unfortunately, it does not
  42. yet completely document one aspect of the protocol---the detailed
  43. operation of each CVS command and option---and one must look at the CVS
  44. user documentation, @file{cvs.texinfo}, for that information. The
  45. protocol is non-proprietary (anyone who wants to is encouraged to
  46. implement it) and an implementation, known as CVS, is available under
  47. the GNU Public License. The CVS distribution, containing this
  48. implementation, @file{cvs.texinfo}, and a copy (possibly more or less up
  49. to date than what you are reading now) of this document,
  50. @file{cvsclient.texi}, can be found at the usual GNU FTP sites, with a
  51. filename such as @file{cvs-@var{version}.tar.gz}.
  52. This is version @value{VERSION} of the protocol specification. This
  53. version number is intended only to aid in distinguishing different
  54. versions of this specification. Although the specification is currently
  55. maintained in conjunction with the CVS implementation, and carries the
  56. same version number, it also intends to document what is involved with
  57. interoperating with other implementations (such as other versions of
  58. CVS); see @ref{Requirements}. This version number should not be used
  59. by clients or servers to determine what variant of the protocol to
  60. speak; they should instead use the @code{valid-requests} and
  61. @code{Valid-responses} mechanism (@pxref{Protocol}), which is more
  62. flexible.
  63. @node Goals
  64. @chapter Goals
  65. @itemize @bullet
  66. @item
  67. Do not assume any access to the repository other than via this protocol.
  68. It does not depend on NFS, rdist, etc.
  69. @item
  70. Providing a reliable transport is outside this protocol. The protocol
  71. expects a reliable transport that is transparent (that is, there is no
  72. translation of characters, including characters such as
  73. linefeeds or carriage returns), and can transmit all 256 octets (for
  74. example for proper handling of binary files, compression, and
  75. encryption). The encoding of characters specified by the protocol (the
  76. names of requests and so on) is the invariant ISO 646 character set (a
  77. subset of most popular character sets including ASCII and others). For
  78. more details on running the protocol over the TCP reliable transport,
  79. see @ref{Connection and Authentication}.
  80. @item
  81. Security and authentication are handled outside this protocol (but see
  82. below about @samp{cvs kserver} and @samp{cvs pserver}).
  83. @item
  84. The protocol makes it possible for updates to be atomic with respect to
  85. checkins; that is if someone commits changes to several files in one cvs
  86. command, then an update by someone else would either get all the
  87. changes, or none of them. The current @sc{cvs} server can't do this,
  88. but that isn't the protocol's fault.
  89. @item
  90. The protocol is, with a few exceptions, transaction-based. That is, the
  91. client sends all its requests (without waiting for server responses),
  92. and then waits for the server to send back all responses (without
  93. waiting for further client requests). This has the advantage of
  94. minimizing network turnarounds and the disadvantage of sometimes
  95. transferring more data than would be necessary if there were a richer
  96. interaction. Another, more subtle, advantage is that there is no need
  97. for the protocol to provide locking for features such as making checkins
  98. atomic with respect to updates. Any such locking can be handled
  99. entirely by the server. A good server implementation (such as the
  100. current @sc{cvs} server) will make sure that it does not have any such
  101. locks in place whenever it is waiting for communication with the client;
  102. this prevents one client on a slow or flaky network from interfering
  103. with the work of others.
  104. @item
  105. It is a general design goal to provide only one way to do a given
  106. operation (where possible). For example, implementations have no choice
  107. about whether to terminate lines with linefeeds or some other
  108. character(s), and request and response names are case-sensitive. This
  109. is to enhance interoperability. If a protocol allows more than one way
  110. to do something, it is all too easy for some implementations to support
  111. only some of them (perhaps accidentally).
  112. @c I vaguely remember reading, probably in an RFC, about the problems
  113. @c that were caused when some people decided that SMTP should accept
  114. @c other line termination (in the message ("DATA")?) than CRLF. However, I
  115. @c can't seem to track down the reference.
  116. @end itemize
  117. @node Connection and Authentication
  118. @chapter How to Connect to and Authenticate Oneself to the CVS server
  119. Connection and authentication occurs before the CVS protocol itself is
  120. started. There are several ways to connect.
  121. @table @asis
  122. @item server
  123. If the client has a way to execute commands on the server, and provide
  124. input to the commands and output from them, then it can connect that
  125. way. This could be the usual rsh (port 514) protocol, Kerberos rsh,
  126. SSH, or any similar mechanism. The client may allow the user to specify
  127. the name of the server program; the default is @code{cvs}. It is
  128. invoked with one argument, @code{server}. Once it invokes the server,
  129. the client proceeds to start the cvs protocol.
  130. @item kserver
  131. The kerberized server listens on a port (in the current implementation,
  132. by having inetd call "cvs kserver") which defaults to 1999. The client
  133. connects, sends the usual kerberos authentication information, and then
  134. starts the cvs protocol. Note: port 1999 is officially registered for
  135. another use, and in any event one cannot register more than one port for
  136. CVS, so GSS-API (see below) is recommended instead of kserver as a way
  137. to support kerberos.
  138. @item pserver
  139. The name @dfn{pserver} is somewhat confusing. It refers to both a
  140. generic framework which allows the CVS protocol to support several
  141. authentication mechanisms, and a name for a specific mechanism which
  142. transfers a username and a cleartext password. Servers need not support
  143. all mechanisms, and in fact servers will typically want to support only
  144. those mechanisms which meet the relevant security needs.
  145. The pserver server listens on a port (in the current
  146. implementation, by having inetd call "cvs pserver") which defaults to
  147. 2401 (this port is officially registered). The client
  148. connects, and sends the following:
  149. @itemize @bullet
  150. @item
  151. the string @samp{BEGIN AUTH REQUEST}, a linefeed,
  152. @item
  153. the cvs root, a linefeed,
  154. @item
  155. the username, a linefeed,
  156. @item
  157. the password trivially encoded (see @ref{Password scrambling}), a
  158. linefeed,
  159. @item
  160. the string @samp{END AUTH REQUEST}, and a linefeed.
  161. @end itemize
  162. The client must send the
  163. identical string for cvs root both here and later in the
  164. @code{Root} request of the cvs
  165. protocol itself. Servers are encouraged to enforce this restriction.
  166. The possible server responses (each of which is followed by a linefeed)
  167. are the following. Note that although there is a small similarity
  168. between this authentication protocol and the cvs protocol, they are
  169. separate.
  170. @table @code
  171. @item I LOVE YOU
  172. The authentication is successful. The client proceeds with the cvs
  173. protocol itself.
  174. @item I HATE YOU
  175. The authentication fails. After sending this response, the server may
  176. close the connection. It is up to the server to decide whether to give
  177. this response, which is generic, or a more specific response using
  178. @samp{E} and/or @samp{error}.
  179. @item E @var{text}
  180. Provide a message for the user. After this response, the authentication
  181. protocol continues with another response. Typically the server will
  182. provide a series of @samp{E} responses followed by @samp{error}.
  183. Compatibility note: @sc{cvs} 1.9.10 and older clients will print
  184. @code{unrecognized auth response} and @var{text}, and then exit, upon
  185. receiving this response.
  186. @item error @var{code} @var{text}
  187. The authentication fails. After sending this response, the server may
  188. close the connection. The @var{code} is a code describing why it
  189. failed, intended for computer consumption. The only code currently
  190. defined is @samp{0} which is nonspecific, but clients must silently
  191. treat any unrecognized codes as nonspecific.
  192. The @var{text} should be supplied to the
  193. user. Compatibility note: @sc{cvs} 1.9.10 and older clients will print
  194. @code{unrecognized auth response} and @var{text}, and then exit, upon
  195. receiving this response.
  196. Note that @var{text} for this response, or the @var{text} in an @code{E}
  197. response, is not designed for machine parsing. More vigorous use of
  198. @var{code}, or future extensions, will be needed to prove a cleaner
  199. machine-parseable indication of what the error was.
  200. @end table
  201. @c If you are thinking of putting samp or code around BEGIN AUTH REQUEST
  202. @c and friends, watch for overfull hboxes.
  203. If the client wishes to merely authenticate without starting the cvs
  204. protocol, the procedure is the same, except BEGIN AUTH REQUEST is
  205. replaced with BEGIN VERIFICATION REQUEST, END AUTH REQUEST
  206. is replaced with END VERIFICATION REQUEST, and upon receipt of
  207. I LOVE YOU the connection is closed rather than continuing.
  208. Another mechanism is GSSAPI authentication. GSSAPI is a
  209. generic interface to security services such as kerberos. GSSAPI is
  210. specified in RFC2078 (GSSAPI version 2) and RFC1508 (GSSAPI version 1);
  211. we are not aware of differences between the two which affect the
  212. protocol in incompatible ways, so we make no attempt to specify one
  213. version or the other.
  214. The procedure here is to start with @samp{BEGIN
  215. GSSAPI REQUEST}. GSSAPI authentication information is then exchanged
  216. between the client and the server. Each packet of information consists
  217. of a two byte big-endian length, followed by that many bytes of data.
  218. After the GSSAPI authentication is complete, the server continues with
  219. the responses described above (@samp{I LOVE YOU}, etc.).
  220. @item future possibilities
  221. There are a nearly unlimited number of ways to connect and authenticate.
  222. One might want to allow access based on IP address (similar to the usual
  223. rsh protocol but with different/no restrictions on ports < 1024), to
  224. adopt mechanisms such as Pluggable Authentication Modules (PAM), to
  225. allow users to run their own servers under their own usernames without
  226. root access, or any number of other possibilities. The way to add
  227. future mechanisms, for the most part, should be to continue to use port
  228. 2401, but to use different strings in place of @samp{BEGIN AUTH
  229. REQUEST}.
  230. @end table
  231. @node Password scrambling
  232. @chapter Password scrambling algorithm
  233. The pserver authentication protocol, as described in @ref{Connection and
  234. Authentication}, trivially encodes the passwords. This is only to
  235. prevent inadvertent compromise; it provides no protection against even a
  236. relatively unsophisticated attacker. For comparison, HTTP Basic
  237. Authentication (as described in RFC2068) uses BASE64 for a similar
  238. purpose. CVS uses its own algorithm, described here.
  239. The scrambled password starts with @samp{A}, which serves to identify
  240. the scrambling algorithm in use. After that follows a single octet for
  241. each character in the password, according to a fixed encoding. The
  242. values are shown here, with the encoded values in decimal. Control
  243. characters, space, and characters outside the invariant ISO 646
  244. character set are not shown; such characters are not recommended for use
  245. in passwords. There is a long discussion of character set issues in
  246. @ref{Protocol Notes}.
  247. @example
  248. 0 111 P 125 p 58
  249. ! 120 1 52 A 57 Q 55 a 121 q 113
  250. " 53 2 75 B 83 R 54 b 117 r 32
  251. 3 119 C 43 S 66 c 104 s 90
  252. 4 49 D 46 T 124 d 101 t 44
  253. % 109 5 34 E 102 U 126 e 100 u 98
  254. & 72 6 82 F 40 V 59 f 69 v 60
  255. ' 108 7 81 G 89 W 47 g 73 w 51
  256. ( 70 8 95 H 38 X 92 h 99 x 33
  257. ) 64 9 65 I 103 Y 71 i 63 y 97
  258. * 76 : 112 J 45 Z 115 j 94 z 62
  259. + 67 ; 86 K 50 k 93
  260. , 116 < 118 L 42 l 39
  261. - 74 = 110 M 123 m 37
  262. . 68 > 122 N 91 n 61
  263. / 87 ? 105 O 35 _ 56 o 48
  264. @end example
  265. @node Protocol
  266. @chapter The CVS client/server protocol
  267. In the following, @samp{\n} refers to a linefeed and @samp{\t} refers to
  268. a horizontal tab; @dfn{requests} are what the client sends and
  269. @dfn{responses} are what the server sends. In general, the connection is
  270. governed by the client---the server does not send responses without
  271. first receiving requests to do so; see @ref{Response intro} for more
  272. details of this convention.
  273. It is typical, early in the connection, for the client to transmit a
  274. @code{Valid-responses} request, containing all the responses it
  275. supports, followed by a @code{valid-requests} request, which elicits
  276. from the server a @code{Valid-requests} response containing all the
  277. requests it understands. In this way, the client and server each find
  278. out what the other supports before exchanging large amounts of data
  279. (such as file contents).
  280. @c Hmm, having 3 sections in this menu makes a certain amount of sense
  281. @c but that structure gets lost in the printed manual (not sure about
  282. @c HTML). Perhaps there is a better way.
  283. @menu
  284. General protocol conventions:
  285. * Entries Lines:: Transmitting RCS data
  286. * File Modes:: Read, write, execute, and possibly more...
  287. * Filenames:: Conventions regarding filenames
  288. * File transmissions:: How file contents are transmitted
  289. * Strings:: Strings in various requests and responses
  290. * Dates:: Times and dates
  291. The protocol itself:
  292. * Request intro:: General conventions relating to requests
  293. * Requests:: List of requests
  294. * Response intro:: General conventions relating to responses
  295. * Response pathnames:: The "pathname" in responses
  296. * Responses:: List of responses
  297. * Text tags:: More details about the MT response
  298. An example session, and some further observations:
  299. * Example:: A conversation between client and server
  300. * Requirements:: Things not to omit from an implementation
  301. * Obsolete:: Former protocol features
  302. @end menu
  303. @node Entries Lines
  304. @section Entries Lines
  305. Entries lines are transmitted as:
  306. @example
  307. / @var{name} / @var{version} / @var{conflict} / @var{options} / @var{tag_or_date}
  308. @end example
  309. @var{tag_or_date} is either @samp{T} @var{tag} or @samp{D} @var{date}
  310. or empty. If it is followed by a slash, anything after the slash
  311. shall be silently ignored.
  312. @var{version} can be empty, or start with @samp{0} or @samp{-}, for no
  313. user file, new user file, or user file to be removed, respectively.
  314. @c FIXME: should distinguish sender and receiver behavior here; the
  315. @c "anything else" and "does not start with" are intended for future
  316. @c expansion, and we should specify a sender behavior.
  317. @var{conflict}, if it starts with @samp{+}, indicates that the file had
  318. conflicts in it. The rest of @var{conflict} is @samp{=} if the
  319. timestamp matches the file, or anything else if it doesn't. If
  320. @var{conflict} does not start with a @samp{+}, it is silently ignored.
  321. @var{options} signifies the keyword expansion options (for example
  322. @samp{-ko}). In an @code{Entry} request, this indicates the options
  323. that were specified with the file from the previous file updating
  324. response (@pxref{Response intro}, for a list of file updating
  325. responses); if the client is specifying the @samp{-k} or @samp{-A}
  326. option to @code{update}, then it is the server which figures out what
  327. overrides what.
  328. @node File Modes
  329. @section File Modes
  330. A mode is any number of repetitions of
  331. @example
  332. @var{mode-type} = @var{data}
  333. @end example
  334. separated by @samp{,}.
  335. @var{mode-type} is an identifier composed of alphanumeric characters.
  336. Currently specified: @samp{u} for user, @samp{g} for group, @samp{o}
  337. for other (see below for discussion of whether these have their POSIX
  338. meaning or are more loose). Unrecognized values of @var{mode-type}
  339. are silently ignored.
  340. @var{data} consists of any data not containing @samp{,}, @samp{\0} or
  341. @samp{\n}. For @samp{u}, @samp{g}, and @samp{o} mode types, data
  342. consists of alphanumeric characters, where @samp{r} means read, @samp{w}
  343. means write, @samp{x} means execute, and unrecognized letters are
  344. silently ignored.
  345. The two most obvious ways in which the mode matters are: (1) is it
  346. writeable? This is used by the developer communication features, and
  347. is implemented even on OS/2 (and could be implemented on DOS), whose
  348. notion of mode is limited to a readonly bit. (2) is it executable?
  349. Unix CVS users need CVS to store this setting (for shell scripts and
  350. the like). The current CVS implementation on unix does a little bit
  351. more than just maintain these two settings, but it doesn't really have
  352. a nice general facility to store or version control the mode, even on
  353. unix, much less across operating systems with diverse protection
  354. features. So all the ins and outs of what the mode means across
  355. operating systems haven't really been worked out (e.g. should the VMS
  356. port use ACLs to get POSIX semantics for groups?).
  357. @node Filenames
  358. @section Conventions regarding transmission of file names
  359. In most contexts, @samp{/} is used to separate directory and file
  360. names in filenames, and any use of other conventions (for example,
  361. that the user might type on the command line) is converted to that
  362. form. The only exceptions might be a few cases in which the server
  363. provides a magic cookie which the client then repeats verbatim, but as
  364. the server has not yet been ported beyond unix, the two rules provide
  365. the same answer (and what to do if future server ports are operating
  366. on a repository like e:/foo or CVS_ROOT:[FOO.BAR] has not been
  367. carefully thought out).
  368. Characters outside the invariant ISO 646 character set should be avoided
  369. in filenames. This restriction may need to be relaxed to allow for
  370. characters such as @samp{[} and @samp{]} (see above about non-unix
  371. servers); this has not been carefully considered (and currently
  372. implementations probably use whatever character sets that the operating
  373. systems they are running on allow, and/or that users specify). Of
  374. course the most portable practice is to restrict oneself further, to the
  375. POSIX portable filename character set as specified in POSIX.1.
  376. @node File transmissions
  377. @section File transmissions
  378. File contents (noted below as @var{file transmission}) can be sent in
  379. one of two forms. The simpler form is a number of bytes, followed by a
  380. linefeed, followed by the specified number of bytes of file contents.
  381. These are the entire contents of the specified file. Second, if both
  382. client and server support @samp{gzip-file-contents}, a @samp{z} may
  383. precede the length, and the `file contents' sent are actually compressed
  384. with @samp{gzip} (RFC1952/1951) compression. The length specified is
  385. that of the compressed version of the file.
  386. In neither case are the file content followed by any additional data.
  387. The transmission of a file will end with a linefeed iff that file (or its
  388. compressed form) ends with a linefeed.
  389. The encoding of file contents depends on the value for the @samp{-k}
  390. option. If the file is binary (as specified by the @samp{-kb} option in
  391. the appropriate place), then it is just a certain number of octets, and
  392. the protocol contributes nothing towards determining the encoding (using
  393. the file name is one widespread, if not universally popular, mechanism).
  394. If the file is text (not binary), then the file is sent as a series of
  395. lines, separated by linefeeds. If the keyword expansion is set to
  396. something other than @samp{-ko}, then it is expected that the file
  397. conform to the RCS expectations regarding keyword expansion---in
  398. particular, that it is in a character set such as ASCII in which 0x24 is
  399. a dollar sign (@samp{$}).
  400. @node Strings
  401. @section Strings
  402. In various contexts, for example the @code{Argument} request and the
  403. @code{M} response, one transmits what is essentially an arbitrary
  404. string. Often this will have been supplied by the user (for example,
  405. the @samp{-m} option to the @code{ci} request). The protocol has no
  406. mechanism to specify the character set of such strings; it would be
  407. fairly safe to stick to the invariant ISO 646 character set but the
  408. existing practice is probably to just transmit whatever the user
  409. specifies, and hope that everyone involved agrees which character set is
  410. in use, or sticks to a common subset.
  411. @node Dates
  412. @section Dates
  413. The protocol contains times and dates in various places.
  414. For the @samp{-D} option to the @code{annotate}, @code{co}, @code{diff},
  415. @code{export}, @code{history}, @code{rannotate}, @code{rdiff},
  416. @code{rtag}, @code{tag},
  417. and @code{update} requests, the server should support two formats:
  418. @example
  419. 26 May 1997 13:01:40 -0000 ; @r{RFC 822 as modified by RFC 1123}
  420. 5/26/1997 13:01:40 GMT ; @r{traditional}
  421. @end example
  422. The former format is preferred; the latter however is sent by the CVS
  423. command line client (versions 1.5 through at least 1.9).
  424. For the @samp{-d} option to the @code{log} and @code{rlog} requests,
  425. servers should at
  426. least support RFC 822/1123 format. Clients are encouraged to use this
  427. format too (the command line CVS client, version 1.10 and older, just passed
  428. along the date format specified by the user, however).
  429. The @code{Mod-time} response and @code{Checkin-time} request use RFC
  430. 822/1123 format (see the descriptions of that response and request for
  431. details).
  432. For @code{Notify}, see the description of that request.
  433. @node Request intro
  434. @section Request intro
  435. By convention, requests which begin with a capital letter do not elicit
  436. a response from the server, while all others do -- save one. The
  437. exception is @samp{gzip-file-contents}. Unrecognized requests will
  438. always elicit a response from the server, even if that request begins
  439. with a capital letter.
  440. The term @dfn{command} means a request which expects a response (except
  441. @code{valid-requests}). The general model is that the client transmits
  442. a great number of requests, but nothing happens until the very end when
  443. the client transmits a command. Although the intention is that
  444. transmitting several commands in one connection should be legal,
  445. existing servers probably have some bugs with some combinations of more
  446. than one command, and so clients may find it necessary to make several
  447. connections in some cases. This should be thought of as a workaround
  448. rather than a desired attribute of the protocol.
  449. @node Requests
  450. @section Requests
  451. Here are the requests:
  452. @table @code
  453. @item Root @var{pathname} \n
  454. Response expected: no. Tell the server which @code{CVSROOT} to use.
  455. Note that @var{pathname} is @emph{not} a fully qualified @code{CVSROOT}
  456. variable, but only the local directory part of it. @var{pathname} must
  457. already exist on the server. Again, @var{pathname} @emph{does not} include
  458. the hostname of the server, how to access the server, etc.; by the time
  459. the CVS protocol is in use, connection, authentication, etc., are
  460. already taken care of.
  461. The @code{Root} request must be sent only once, and it must be sent
  462. before any requests other than @code{Valid-responses},
  463. @code{valid-requests}, @code{UseUnchanged}, @code{Set},
  464. @code{Global_option}, @code{noop}, or @code{version}.
  465. @item Valid-responses @var{request-list} \n
  466. Response expected: no.
  467. Tell the server what responses the client will accept.
  468. request-list is a space separated list of tokens.
  469. The @code{Root} request need not have been previously sent.
  470. @item valid-requests \n
  471. Response expected: yes.
  472. Ask the server to send back a @code{Valid-requests} response.
  473. The @code{Root} request need not have been previously sent.
  474. @item Directory @var{local-directory} \n
  475. Additional data: @var{repository} \n. Response expected: no.
  476. Tell the server what directory to use. The @var{repository} should be a
  477. directory name from a previous server response. Note that
  478. this both gives a default for @code{Entry} and @code{Modified} and
  479. also for @code{ci} and the other commands; normal usage is to send
  480. @code{Directory} for each directory in which there will be an
  481. @code{Entry} or @code{Modified}, and then a final @code{Directory}
  482. for the original directory, then the command.
  483. The @var{local-directory} is relative to
  484. the top level at which the command is occurring (i.e., the last
  485. @code{Directory} which is sent before the command);
  486. to indicate that top level, @samp{.} should be sent for
  487. @var{local-directory}.
  488. Here is an example of where a client gets @var{repository} and
  489. @var{local-directory}. Suppose that there is a module defined by
  490. @example
  491. moddir 1dir
  492. @end example
  493. That is, one can check out @code{moddir} and it will take @code{1dir} in
  494. the repository and check it out to @code{moddir} in the working
  495. directory. Then an initial check out could proceed like this:
  496. @example
  497. C: Root /home/kingdon/zwork/cvsroot
  498. . . .
  499. C: Argument moddir
  500. C: Directory .
  501. C: /home/kingdon/zwork/cvsroot
  502. C: co
  503. S: Clear-sticky moddir/
  504. S: /home/kingdon/zwork/cvsroot/1dir/
  505. . . .
  506. S: ok
  507. @end example
  508. In this example the response shown is @code{Clear-sticky}, but it could
  509. be another response instead. Note that it returns two pathnames.
  510. The first one, @file{moddir/}, indicates the working
  511. directory to check out into. The second one, ending in @file{1dir/},
  512. indicates the directory to pass back to the server in a subsequent
  513. @code{Directory} request. For example, a subsequent @code{update}
  514. request might look like:
  515. @example
  516. C: Directory moddir
  517. C: /home/kingdon/zwork/cvsroot/1dir
  518. . . .
  519. C: update
  520. @end example
  521. For a given @var{local-directory}, the repository will be the same for
  522. each of the responses, so one can use the repository from whichever
  523. response is most convenient. Typically a client will store the
  524. repository along with the sources for each @var{local-directory}, use
  525. that same setting whenever operating on that @var{local-directory}, and
  526. not update the setting as long as the @var{local-directory} exists.
  527. A client is free to rename a @var{local-directory} at any time (for
  528. example, in response to an explicit user request). While it is true
  529. that the server supplies a @var{local-directory} to the client, as noted
  530. above, this is only the default place to put the directory. Of course,
  531. the various @code{Directory} requests for a single command (for example,
  532. @code{update} or @code{ci} request) should name a particular directory
  533. with the same @var{local-directory}.
  534. Each @code{Directory} request specifies a brand-new
  535. @var{local-directory} and @var{repository}; that is,
  536. @var{local-directory} and @var{repository} are never relative to paths
  537. specified in any previous @code{Directory} request.
  538. Here's a more complex example, in which we request an update of a
  539. working directory which has been checked out from multiple places in the
  540. repository.
  541. @example
  542. C: Argument dir1
  543. C: Directory dir1
  544. C: /home/foo/repos/mod1
  545. . . .
  546. C: Argument dir2
  547. C: Directory dir2
  548. C: /home/foo/repos/mod2
  549. . . .
  550. C: Argument dir3
  551. C: Directory dir3/subdir3
  552. C: /home/foo/repos/mod3
  553. . . .
  554. C: update
  555. @end example
  556. While directories @code{dir1} and @code{dir2} will be handled in similar
  557. fashion to the other examples given above, @code{dir3} is slightly
  558. different from the server's standpoint. Notice that module @code{mod3}
  559. is actually checked out into @code{dir3/subdir3}, meaning that directory
  560. @code{dir3} is either empty or does not contain data checked out from
  561. this repository.
  562. The above example will work correctly in @sc{cvs} 1.10.1 and later. The
  563. server will descend the tree starting from all directories mentioned in
  564. @code{Argument} requests and update those directories specifically
  565. mentioned in @code{Directory} requests.
  566. Previous versions of @sc{cvs} (1.10 and earlier) do not behave the same
  567. way. While the descent of the tree begins at all directories mentioned
  568. in @code{Argument} requests, descent into subdirectories only occurs if
  569. a directory has been mentioned in a @code{Directory} request.
  570. Therefore, the above example would succeed in updating @code{dir1} and
  571. @code{dir2}, but would skip @code{dir3} because that directory was not
  572. specifically mentioned in a @code{Directory} request. A functional
  573. version of the above that would run on a 1.10 or earlier server is as
  574. follows:
  575. @example
  576. C: Argument dir1
  577. C: Directory dir1
  578. C: /home/foo/repos/mod1
  579. . . .
  580. C: Argument dir2
  581. C: Directory dir2
  582. C: /home/foo/repos/mod2
  583. . . .
  584. C: Argument dir3
  585. C: Directory dir3
  586. C: /home/foo/repos/.
  587. . . .
  588. C: Directory dir3/subdir3
  589. C: /home/foo/repos/mod3
  590. . . .
  591. C: update
  592. @end example
  593. Note the extra @code{Directory dir3} request. It might be better to use
  594. @code{Emptydir} as the repository for the @code{dir3} directory, but the
  595. above will certainly work.
  596. One more peculiarity of the 1.10 and earlier protocol is the ordering of
  597. @code{Directory} arguments. In order for a subdirectory to be
  598. registered correctly for descent by the recursion processor, its parent
  599. must be sent first. For example, the following would not work to update
  600. @code{dir3/subdir3}:
  601. @example
  602. . . .
  603. C: Argument dir3
  604. C: Directory dir3/subdir3
  605. C: /home/foo/repos/mod3
  606. . . .
  607. C: Directory dir3
  608. C: /home/foo/repos/.
  609. . . .
  610. C: update
  611. @end example
  612. The implementation of the server in 1.10 and earlier writes the
  613. administration files for a given directory at the time of the
  614. @code{Directory} request. It also tries to register the directory with
  615. its parent to mark it for recursion. In the above example, at the time
  616. @code{dir3/subdir3} is created, the physical directory for @code{dir3}
  617. will be created on disk, but the administration files will not have been
  618. created. Therefore, when the server tries to register
  619. @code{dir3/subdir3} for recursion, the operation will silently fail
  620. because the administration files do not yet exist for @code{dir3}.
  621. @item Max-dotdot @var{level} \n
  622. Response expected: no.
  623. Tell the server that @var{level} levels of directories above the
  624. directory which @code{Directory} requests are relative to will be
  625. needed. For example, if the client is planning to use a
  626. @code{Directory} request for @file{../../foo}, it must send a
  627. @code{Max-dotdot} request with a @var{level} of at least 2.
  628. @code{Max-dotdot} must be sent before the first @code{Directory}
  629. request.
  630. @item Static-directory \n
  631. Response expected: no. Tell the server that the directory most recently
  632. specified with @code{Directory} should not have
  633. additional files checked out unless explicitly requested. The client
  634. sends this if the @code{Entries.Static} flag is set, which is controlled
  635. by the @code{Set-static-directory} and @code{Clear-static-directory}
  636. responses.
  637. @item Sticky @var{tagspec} \n
  638. Response expected: no. Tell the server that the directory most recently
  639. specified with @code{Directory} has a sticky tag or date @var{tagspec}.
  640. The first character of @var{tagspec} is @samp{T} for a tag, @samp{D}
  641. for a date, or some other character supplied by a Set-sticky response
  642. from a previous request to the server. The remainder of @var{tagspec}
  643. contains the actual tag or date, again as supplied by Set-sticky.
  644. The server should remember @code{Static-directory} and @code{Sticky}
  645. requests for a particular directory; the client need not resend them
  646. each time it sends a @code{Directory} request for a given directory.
  647. However, the server is not obliged to remember them beyond the context
  648. of a single command.
  649. @item Entry @var{entry-line} \n
  650. Response expected: no. Tell the server what version of a file is on the
  651. local machine. The name in @var{entry-line} is a name relative to the
  652. directory most recently specified with @code{Directory}. If the user
  653. is operating on only some files in a directory, @code{Entry} requests
  654. for only those files need be included. If an @code{Entry} request is
  655. sent without @code{Modified}, @code{Is-modified}, or @code{Unchanged},
  656. it means the file is
  657. lost (does not exist in the working directory). If both @code{Entry}
  658. and one of @code{Modified}, @code{Is-modified}, or @code{Unchanged} are
  659. sent for the same file, @code{Entry} must be sent first. For a
  660. given file, one can send @code{Modified}, @code{Is-modified}, or
  661. @code{Unchanged}, but not more than one of these three.
  662. @item Kopt @var{option} \n
  663. This indicates to the server which keyword expansion options to use for
  664. the file specified by the next @code{Modified} or @code{Is-modified}
  665. request (for example @samp{-kb} for a binary file). This is similar to
  666. @code{Entry}, but is used for a file for which there is no entries line.
  667. Typically this will be a file being added via an @code{add} or
  668. @code{import} request. The client may not send both @code{Kopt} and
  669. @code{Entry} for the same file.
  670. @item Checkin-time @var{time} \n
  671. For the file specified by the next @code{Modified} request, use
  672. @var{time} as the time of the checkin. The @var{time} is in the format
  673. specified by RFC822 as modified by RFC1123. The client may specify any
  674. timezone it chooses; servers will want to convert that to their own
  675. timezone as appropriate. An example of this format is:
  676. @example
  677. 26 May 1997 13:01:40 -0400
  678. @end example
  679. There is no requirement that the client and server clocks be
  680. synchronized. The client just sends its recommendation for a timestamp
  681. (based on file timestamps or whatever), and the server should just believe
  682. it (this means that the time might be in the future, for example).
  683. Note that this is not a general-purpose way to tell the server about the
  684. timestamp of a file; that would be a separate request (if there are
  685. servers which can maintain timestamp and time of checkin separately).
  686. This request should affect the @code{import} request, and may optionally
  687. affect the @code{ci} request or other relevant requests if any.
  688. @item Modified @var{filename} \n
  689. Response expected: no. Additional data: mode, \n, file transmission.
  690. Send the server a copy of one locally modified file. @var{filename} is
  691. a file within the most recent directory sent with @code{Directory}; it
  692. must not contain @samp{/}. If
  693. the user is operating on only some files in a directory, only those
  694. files need to be included. This can also be sent without @code{Entry},
  695. if there is no entry for the file.
  696. @item Is-modified @var{filename} \n
  697. Response expected: no. Additional data: none. Like @code{Modified},
  698. but used if the server only needs
  699. to know whether the file is modified, not the contents.
  700. The commands which can take @code{Is-modified} instead of
  701. @code{Modified} with no known change in behavior are: @code{admin},
  702. @code{diff} (if and only if two @samp{-r} or @samp{-D} options are
  703. specified), @code{watch-on}, @code{watch-off}, @code{watch-add},
  704. @code{watch-remove}, @code{watchers}, @code{editors},
  705. @code{log}, and @code{annotate}.
  706. For the @code{status} command, one can send @code{Is-modified} but if
  707. the client is using imperfect mechanisms such as timestamps to determine
  708. whether to consider a file modified, then the behavior will be
  709. different. That is, if one sends @code{Modified}, then the server will
  710. actually compare the contents of the file sent and the one it derives
  711. from to determine whether the file is genuinely modified. But if one
  712. sends @code{Is-modified}, then the server takes the client's word for
  713. it. A similar situation exists for @code{tag}, if the @samp{-c} option
  714. is specified.
  715. Commands for which @code{Modified} is necessary are @code{co},
  716. @code{ci}, @code{update}, and @code{import}.
  717. Commands which do not need to inform the server about a working
  718. directory, and thus should not be sending either @code{Modified} or
  719. @code{Is-modified}: @code{rdiff}, @code{rtag}, @code{history},
  720. and @code{release}.
  721. Commands for which further investigation is warranted are:
  722. @code{remove}, @code{add}, and @code{export}. Pending such
  723. investigation, the more conservative course of action is to stick to
  724. @code{Modified}.
  725. @item Unchanged @var{filename} \n
  726. Response expected: no. Tell the server that @var{filename} has not been
  727. modified in the checked out directory. The @var{filename} is
  728. a file within the most recent directory sent with @code{Directory}; it
  729. must not contain @samp{/}.
  730. @item UseUnchanged \n
  731. Response expected: no. To specify the version of the protocol described
  732. in this document, servers must support this request (although it need
  733. not do anything) and clients must issue it.
  734. The @code{Root} request need not have been previously sent.
  735. @item Empty-conflicts \n
  736. Response expected: yes. This request is an alias for @code{noop}. Its
  737. presence in the list of @code{valid-requests} is intended to be used as a
  738. placeholder to alert the client that the server does not require the contents
  739. of files with conflicts that have not been modified since the merge, for
  740. operations other than diff. It was a bug in pre 1.11.22 & pre 1.12.14 servers
  741. that the contents of files with conflicts was required for the server to
  742. acknowledge the existence of the conflicts.
  743. @item Notify @var{filename} \n
  744. Response expected: no.
  745. Tell the server that an @code{edit} or @code{unedit} command has taken
  746. place. The server needs to send a @code{Notified} response, but such
  747. response is deferred until the next time that the server is sending
  748. responses.
  749. The @var{filename} is a file within the most recent directory sent with
  750. @code{Directory}; it must not contain @samp{/}.
  751. Additional data:
  752. @example
  753. @var{notification-type} \t @var{time} \t @var{clienthost} \t
  754. @var{working-dir} \t @var{watches} \n
  755. @end example
  756. where @var{notification-type} is @samp{E} for edit, @samp{U} for
  757. unedit, undefined behavior if @samp{C}, and all other letters should be
  758. silently ignored for future expansion.
  759. @var{time} is the time at which the edit or unedit took place, in a
  760. user-readable format of the client's choice (the server should treat the
  761. time as an opaque string rather than interpreting it).
  762. @c Might be useful to specify a format, but I don't know if we want to
  763. @c specify the status quo (ISO C asctime() format plus timezone) without
  764. @c offering the option of ISO8601 and/or RFC822/1123 (see cvs.texinfo
  765. @c for much much more on date formats).
  766. @var{clienthost} is the name of the host on which the edit or unedit
  767. took place, and @var{working-dir} is the pathname of the working
  768. directory where the edit or unedit took place. @var{watches} are the
  769. temporary watches, zero or more of the following characters in the
  770. following order: @samp{E} for edit, @samp{U} for unedit, @samp{C} for
  771. commit, and all other letters should be silently ignored for future
  772. expansion. If @var{notification-type} is @samp{E} the temporary watches
  773. are set; if it is @samp{U} they are cleared.
  774. If @var{watches} is followed by \t then the
  775. \t and the rest of the line should be ignored, for future expansion.
  776. The @var{time}, @var{clienthost}, and @var{working-dir} fields may not
  777. contain the characters @samp{+}, @samp{,}, @samp{>}, @samp{;}, or @samp{=}.
  778. Note that a client may be capable of performing an @code{edit} or
  779. @code{unedit} operation without connecting to the server at that time,
  780. and instead connecting to the server when it is convenient (for example,
  781. when a laptop is on the net again) to send the @code{Notify} requests.
  782. Even if a client is capable of deferring notifications, it should
  783. attempt to send them immediately (one can send @code{Notify} requests
  784. together with a @code{noop} request, for example), unless perhaps if
  785. it can know that a connection would be impossible.
  786. @item Questionable @var{filename} \n
  787. Response expected: no. Additional data: no. Tell the server to check
  788. whether @var{filename} should be ignored, and if not, next time the
  789. server sends responses, send (in a @code{M} response) @samp{?} followed
  790. by the directory and filename. @var{filename} must not contain
  791. @samp{/}; it needs to be a file in the directory named by the most
  792. recent @code{Directory} request.
  793. @c FIXME: the bit about not containing / is true of most of the
  794. @c requests, but isn't documented and should be.
  795. @item Case \n
  796. Response expected: no. Tell the server that filenames should be matched
  797. in a case-insensitive fashion. Note that this is not the primary
  798. mechanism for achieving case-insensitivity; for the most part the client
  799. keeps track of the case which the server wants to use and takes care to
  800. always use that case regardless of what the user specifies. For example
  801. the filenames given in @code{Entry} and @code{Modified} requests for the
  802. same file must match in case regardless of whether the @code{Case}
  803. request is sent. The latter mechanism is more general (it could also be
  804. used for 8.3 filenames, VMS filenames with more than one @samp{.}, and
  805. any other situation in which there is a predictable mapping between
  806. filenames in the working directory and filenames in the protocol), but
  807. there are some situations it cannot handle (ignore patterns, or
  808. situations where the user specifies a filename and the client does not
  809. know about that file).
  810. Though this request will be supported into the foreseeable future, it has been
  811. the source of numerous bug reports in the past due to the complexity of testing
  812. this functionality via the test suite and client developers are encouraged not
  813. to use it. Instead, please consider munging conflicting names and maintaining
  814. a map for communicating with the server. For example, suppose the server sends
  815. files @file{case}, @file{CASE}, and @file{CaSe}. The client could write all
  816. three files to names such as, @file{case}, @file{case_prefix_case}, and
  817. @file{case_prefix_2_case} and maintain a mapping between the file names in, for
  818. instance a new @file{CVS/Map} file.
  819. @item Argument @var{text} \n
  820. Response expected: no.
  821. Save argument for use in a subsequent command. Arguments
  822. accumulate until an argument-using command is given, at which point
  823. they are forgotten.
  824. @item Argumentx @var{text} \n
  825. Response expected: no. Append \n followed by text to the current
  826. argument being saved.
  827. @item Global_option @var{option} \n
  828. Response expected: no.
  829. Transmit one of the global options @samp{-q}, @samp{-Q}, @samp{-l},
  830. @samp{-t}, @samp{-r}, or @samp{-n}. @var{option} must be one of those
  831. strings, no variations (such as combining of options) are allowed. For
  832. graceful handling of @code{valid-requests}, it is probably better to
  833. make new global options separate requests, rather than trying to add
  834. them to this request.
  835. The @code{Root} request need not have been previously sent.
  836. @item Gzip-stream @var{level} \n
  837. Response expected: no.
  838. Use zlib (RFC 1950/1951) compression to compress all further communication
  839. between the client and the server. After this request is sent, all
  840. further communication must be compressed. All further data received
  841. from the server will also be compressed. The @var{level} argument
  842. suggests to the server the level of compression that it should apply; it
  843. should be an integer between 1 and 9, inclusive, where a higher number
  844. indicates more compression.
  845. @item Kerberos-encrypt \n
  846. Response expected: no.
  847. Use Kerberos encryption to encrypt all further communication between the
  848. client and the server. This will only work if the connection was made
  849. over Kerberos in the first place. If both the @code{Gzip-stream} and
  850. the @code{Kerberos-encrypt} requests are used, the
  851. @code{Kerberos-encrypt} request should be used first. This will make
  852. the client and server encrypt the compressed data, as opposed to
  853. compressing the encrypted data. Encrypted data is generally
  854. incompressible.
  855. Note that this request does not fully prevent an attacker from hijacking
  856. the connection, in the sense that it does not prevent hijacking the
  857. connection between the initial authentication and the
  858. @code{Kerberos-encrypt} request.
  859. @item Gssapi-encrypt \n
  860. Response expected: no.
  861. Use GSSAPI encryption to encrypt all further communication between the
  862. client and the server. This will only work if the connection was made
  863. over GSSAPI in the first place. See @code{Kerberos-encrypt}, above, for
  864. the relation between @code{Gssapi-encrypt} and @code{Gzip-stream}.
  865. Note that this request does not fully prevent an attacker from hijacking
  866. the connection, in the sense that it does not prevent hijacking the
  867. connection between the initial authentication and the
  868. @code{Gssapi-encrypt} request.
  869. @item Gssapi-authenticate \n
  870. Response expected: no.
  871. Use GSSAPI authentication to authenticate all further communication
  872. between the client and the server. This will only work if the
  873. connection was made over GSSAPI in the first place. Encrypted data is
  874. automatically authenticated, so using both @code{Gssapi-authenticate}
  875. and @code{Gssapi-encrypt} has no effect beyond that of
  876. @code{Gssapi-encrypt}. Unlike encrypted data, it is reasonable to
  877. compress authenticated data.
  878. Note that this request does not fully prevent an attacker from hijacking
  879. the connection, in the sense that it does not prevent hijacking the
  880. connection between the initial authentication and the
  881. @code{Gssapi-authenticate} request.
  882. @item Set @var{variable}=@var{value} \n
  883. Response expected: no.
  884. Set a user variable @var{variable} to @var{value}.
  885. The @code{Root} request need not have been previously sent.
  886. @item expand-modules \n
  887. Response expected: yes. Expand the modules which are specified in the
  888. arguments. Returns the data in @code{Module-expansion} responses. Note
  889. that the server can assume that this is checkout or export, not rtag or
  890. rdiff; the latter do not access the working directory and thus have no
  891. need to expand modules on the client side.
  892. Expand may not be the best word for what this request does. It does not
  893. necessarily tell you all the files contained in a module, for example.
  894. Basically it is a way of telling you which working directories the
  895. server needs to know about in order to handle a checkout of the
  896. specified modules.
  897. For example, suppose that the server has a module defined by
  898. @example
  899. aliasmodule -a 1dir
  900. @end example
  901. That is, one can check out @code{aliasmodule} and it will take
  902. @code{1dir} in the repository and check it out to @code{1dir} in the
  903. working directory. Now suppose the client already has this module
  904. checked out and is planning on using the @code{co} request to update it.
  905. Without using @code{expand-modules}, the client would have two bad
  906. choices: it could either send information about @emph{all} working
  907. directories under the current directory, which could be unnecessarily
  908. slow, or it could be ignorant of the fact that @code{aliasmodule} stands
  909. for @code{1dir}, and neglect to send information for @code{1dir}, which
  910. would lead to incorrect operation.
  911. @c Those don't really seem like the only two options. I mean, what
  912. @c about keeping track of the correspondence from when we first checked
  913. @c out a fresh directory? Not that the CVS client does this, or that
  914. @c I've really thought about whether it would be a good idea...
  915. With @code{expand-modules}, the client would first ask for the module to
  916. be expanded:
  917. @example
  918. C: Root /home/kingdon/zwork/cvsroot
  919. . . .
  920. C: Argument aliasmodule
  921. C: Directory .
  922. C: /home/kingdon/zwork/cvsroot
  923. C: expand-modules
  924. S: Module-expansion 1dir
  925. S: ok
  926. @end example
  927. and then it knows to check the @file{1dir} directory and send
  928. requests such as @code{Entry} and @code{Modified} for the files in that
  929. directory.
  930. @item ci \n
  931. @itemx diff \n
  932. @itemx tag \n
  933. @itemx status \n
  934. @itemx admin \n
  935. @itemx history \n
  936. @itemx watchers \n
  937. @itemx editors \n
  938. @itemx annotate \n
  939. Response expected: yes. Actually do a cvs command. This uses any
  940. previous @code{Argument}, @code{Directory}, @code{Entry}, or
  941. @code{Modified} requests, if they have been sent. The
  942. last @code{Directory} sent specifies the working directory at the time
  943. of the operation. No provision is made for any input from the user.
  944. This means that @code{ci} must use a @code{-m} argument if it wants to
  945. specify a log message.
  946. @item log \n
  947. Response expected: yes. Show information for past revisions. This uses
  948. any previous @code{Directory}, @code{Entry}, or @code{Modified}
  949. requests, if they have been sent. The last @code{Directory} sent
  950. specifies the working directory at the time of the operation. Also uses
  951. previous @code{Argument}'s of which the canonical forms are the
  952. following (@sc{cvs} 1.10 and older cl…