1c26070a5StholoHow to write code for CVS 2c26070a5Stholo 3c26070a5Stholo* Compiler options 4c26070a5Stholo 5c26070a5StholoIf you are using GCC, you'll want to configure with -Wall, which can 6c26070a5Stholodetect many programming errors. This is not the default because it 7c26070a5Stholomight cause spurious warnings, but at least on some machines, there 8c26070a5Stholoshould be no spurious warnings. For example: 9c26070a5Stholo 10c26070a5Stholo $ CFLAGS="-g -Wall" ./configure 11c26070a5Stholo 12c26070a5StholoConfigure is not very good at remembering this setting; it will get 13c26070a5Stholowiped out whenever you do a ./config.status --recheck, so you'll need 14c26070a5Stholoto use: 15c26070a5Stholo 16c26070a5Stholo $ CFLAGS="-g -Wall" ./config.status --recheck 17c26070a5Stholo 18c26070a5Stholo* Indentation style 19c26070a5Stholo 20c26070a5StholoCVS mostly uses a consistent indentation style which looks like this: 21c26070a5Stholo 22c26070a5Stholovoid 23c26070a5Stholofoo (arg) 24c26070a5Stholo char *arg; 25c26070a5Stholo{ 26c26070a5Stholo if (arg != NULL) 27c26070a5Stholo { 28c26070a5Stholo bar (arg); 29c26070a5Stholo baz (arg); 30c26070a5Stholo } 312286d8edStholo switch (c) 322286d8edStholo { 332286d8edStholo case 'A': 342286d8edStholo aflag = 1; 352286d8edStholo break; 362286d8edStholo } 37c26070a5Stholo} 38c26070a5Stholo 39c26070a5StholoThe file cvs-format.el contains settings for emacs and the NEWS file 40c26070a5Stholocontains a set of options for the indent program which I haven't tried 41c26070a5Stholobut which are correct as far as I know. You will find some code which 42c26070a5Stholodoes not conform to this indentation style; the plan is to reindent it 43c26070a5Stholoas those sections of the code are changed (one function at a time, 44c26070a5Stholoperhaps). 45c26070a5Stholo 46c26070a5StholoIn a submitted patch it is acceptable to refrain from changing the 47c26070a5Stholoindentation of large blocks of code to minimize the size of the patch; 48c26070a5Stholothe person checking in such a patch should reindent it. 49c26070a5Stholo 50c26070a5Stholo* Portability 51c26070a5Stholo 5250bf276cStholoThe general rule for portability is that it is only worth including 5350bf276cStholoportability cruft for systems on which people are actually testing and 5450bf276cStholousing new CVS releases. Without testing, CVS will fail to be portable 5550bf276cStholofor any number of unanticipated reasons. 5650bf276cStholo 5750bf276cStholoThe current consequence of that general rule seems to be that if it 5850bf276cStholois in ANSI C and it is in SunOS4 (using /bin/cc), generally it is OK 5950bf276cStholoto use it without ifdefs (for example, assert() and void * as long as 6050bf276cStholoyou add more casts to and from void * than ANSI requires. But not 6150bf276cStholofunction prototypes). Such constructs are generally portable enough, 6250bf276cStholoincluding to NT, OS/2, VMS, etc. 63c26070a5Stholo 64c26070a5Stholo* Run-time behaviors 65c26070a5Stholo 66c26070a5StholoUse assert() to check "can't happen" conditions internal to CVS. We 67c26070a5Stholorealize that there are functions in CVS which instead return NULL or 68c26070a5Stholosome such value (thus confusing the meaning of such a returned value), 69c26070a5Stholobut we want to fix that code. Of course, bad input data, a corrupt 70c26070a5Stholorepository, bad options, etc., should always print a real error 71c26070a5Stholomessage instead. 72c26070a5Stholo 732286d8edStholoDo not use arbitrary limits (such as PATH_MAX) except perhaps when the 742286d8edStholooperating system or some external interface requires it. We spent a 752286d8edSthololot of time getting rid of them, and we don't want to put them back. 762286d8edStholoIf you find any that we missed, please report it as with other bugs. 772286d8edStholoIn most cases such code will create security holes (for example, for 782286d8edStholoanonymous readonly access via the CVS protocol, or if a WWW cgi script 792286d8edStholopasses client-supplied arguments to CVS). 8050bf276cStholo 8150bf276cStholoAlthough this is a long-term goal, it also would be nice to move CVS 8250bf276cStholoin the direction of reentrancy. This reduces the size of the data 8350bf276cStholosegment and will allow a multi-threaded server if that is desirable. 8450bf276cStholoIt is also useful to write the code so that it can be easily be made 8550bf276cStholoreentrant later. For example, if you need to pass data from a 8650bf276cStholoParse_Info caller to its callproc, you need a static variable. But 8750bf276cStholouse a single pointer so that when Parse_Info is fixed to pass along a 8850bf276cStholovoid * argument, then the code can easily use that argument. 8950bf276cStholo 90c26070a5Stholo* Coding standards in general 91c26070a5Stholo 92c26070a5StholoGenerally speaking the GNU coding standards are mostly used by CVS 93c26070a5Stholo(but see the exceptions mentioned above, such as indentation style, 94c26070a5Stholoand perhaps an exception or two we haven't mentioned). This is the 95c26070a5Stholofile standards.text at the GNU FTP sites. 96c26070a5Stholo 9750bf276cStholoFilenames for .c and .h files may contain _ but should not contain - 9850bf276cStholo(the latter causes Visual C++ 2.1 to create makefiles which Visual C++ 9950bf276cStholo4.0 cannot use). 10050bf276cStholo 101461cc63eStholo* Submitting patches (strategy) 102461cc63eStholo 103461cc63eStholoOnly some kinds of changes are suitable for inclusion in the 104461cc63eStholo"official" CVS. Bugfixes, where CVS's behavior contradicts the 105461cc63eStholodocumentation and/or expectations that everyone agrees on, should be 106461cc63eStholoOK (strategically). For features, the desirable attributes are that 107461cc63eStholothe need is clear and that they fit nicely into the architecture of 108461cc63eStholoCVS. 109461cc63eStholo 110461cc63eStholoHowever, if there is reason to think that a change would significantly 111461cc63eStholoinconvenience any significant body of CVS users, or would be 112461cc63eStholocontroversial for other reasons, then the design should be re-thought. 113461cc63eStholoGo back to the requirements (writing documentation might help, if you 114461cc63eStholowrite the documentation to explain why one would use the feature not 115461cc63eStholojust what the feature does). Think about whether there is a behavior 116461cc63eStholowhich works in both your situation and the other situations. Make a 117461cc63eSthololist of the issues (for example, submit a comment or documentation 118461cc63eStholochange). Ask your coworkers, a newsgroup, or a mailing list, and see 119461cc63eStholowhat other people think. Distribute some experimental patches outside 120461cc63eStholothe "official" CVS and see what people think. By this process, the 121461cc63eStholointention is that once-controversial changes can be refined to the 122461cc63eStholopoint where they are relatively uncontroversial before they are 123461cc63eStholoactually checked in to the "official" CVS. Features like zlib, 124461cc63eStholoencryption, and others have benefitted from this process in the past 125461cc63eStholoby being mentioned in the documentation and/or discussed, before an 126461cc63eStholoimplementation was checked in. 127461cc63eStholo 128461cc63eStholoIf longstanding CVS behavior, that people may be relying on, is 129461cc63eStholoclearly deficient, it can be changed, but only slowly and carefully. 130461cc63eStholoFor example, the global -q option was introduced in CVS 1.3 but the 131461cc63eStholocommand -q options, which the global -q replaced, were not removed 132461cc63eStholountil CVS 1.6. 133461cc63eStholo 134461cc63eStholo* Submitting patches (tactics) 135c26070a5Stholo 136c26070a5StholoPlease include a ChangeLog entry (see the GNU coding standards for 137c26070a5Stholoinformation on writing one) with patches. Include a description of 138c26070a5Stholowhat the patch does (sometimes the ChangeLog entry and/or comments in 139c26070a5Stholothe code are appropriate for this, but not always)--patches should not 140c26070a5Stholobe checked in unless there is some reason for them, and the 141c26070a5Stholodescription may be helpful if there is a better way to solve the 142c26070a5Stholoproblem. In addition to the ChangeLog entry, there should be a change 143780d15dfStholoto the NEWS file and cvs.texinfo, if the change is a user-visible 144780d15dfStholochange worth mentioning. 145c26070a5Stholo 146461cc63eStholoIt is nice to have a test case (see TESTS), especially for fixes which 147461cc63eStholoinvolve subtle behaviors or twisted sections of the code. 148461cc63eStholo 149c26070a5StholoIf you solve several unrelated problems, submit a separate 150c26070a5Stholopatch for each one. Patches should be tested before submission. Use 151c26070a5Stholocontext diffs or unidiffs for patches. 152c26070a5Stholo 153c26070a5StholoNote that all submitted changes may be distributed under the terms of 154c26070a5Stholothe GNU Public License, so if you don't like this, don't submit them. 1552286d8edStholoSubmit changes to bug-cvs@gnu.org. 156c26070a5Stholo 157c26070a5StholoGenerally speaking if you follow the guidelines in this file you can 158c26070a5Stholoexpect a yes or no answer about whether your patch is accepted. But 159c26070a5Stholoeven in this case there is no guarantee because wading through a bunch 160c26070a5Stholoof submissions can be time consuming, and noone has volunteered to 161c26070a5Stholooffer any such guarantee. If you don't receive an answer one way or 162c26070a5Stholoanother within a month, feel free to ask what the status is. You can, 163c26070a5Stholoif you wish, distribute your patch on mailing lists or newsgroups, if 164c26070a5Stholoyou want to make it available before it gets merged. 165c26070a5Stholo 166c26070a5Stholo* What is the schedule for the next release? 167c26070a5Stholo 168c26070a5StholoThere isn't one. That is, upcoming releases are not announced (or 169c26070a5Stholoeven hinted at, really) until the feature freeze which is 170c26070a5Stholoapproximately 2 weeks before the final release (at this time test 171c26070a5Stholoreleases start appearing and are announced on info-cvs). This is 172c26070a5Stholointentional, to avoid a last minute rush to get new features in. 173780d15dfStholo 174780d15dfStholo* Mailing lists 175780d15dfStholo 176780d15dfStholoAnyone can add themselves to the following mailing lists: 177780d15dfStholo 178780d15dfStholo devel-cvs. Unless you are accepted as a CVS developer as 179780d15dfStholo described in the DEVEL-CVS file, you will only be able to 180780d15dfStholo read this list, not send to it. The charter of the list is 181780d15dfStholo also in DEVEL-CVS. 182780d15dfStholo commit-cvs. The only messages sent to this list are sent 183780d15dfStholo automatically, via the CVS `loginfo' mechanism, when someone 184780d15dfStholo checks something in to the master CVS repository. 185780d15dfStholo test-results. The only messages sent to this list are sent 186780d15dfStholo automatically, daily, by a script which runs "make check" 187780d15dfStholo and "make remotecheck" on the master CVS sources. 188780d15dfStholoTo subscribe to devel-cvs, commit-cvs, or test-results, send 189780d15dfStholoa message to "majordomo@cyclic.com" whose body consists of 190780d15dfStholo"subscribe <list>", where <list> is devel-cvs, commit-cvs or 191780d15dfStholotest-results. 192780d15dfStholo 193780d15dfStholoOne other list related to CVS development is bug-cvs. This is the 194780d15dfSthololist which users are requested to send bug reports to. Anyone can 1952286d8edStholosubscribe; to do so send mail to bug-cvs-request@gnu.org. 196780d15dfStholo 197780d15dfStholoOther CVS discussions take place on the info-cvs mailing list 198*c71bc7e2Stholo(send mail to info-cvs-request@gnu.org to subscribe) or on 199780d15dfStholothe newsgroup comp.software.config-mgmt. 200