cvs.sgml 26.2 KB
Newer Older
1
<!--
2
$Header: /cvsroot/pgsql/doc/src/sgml/cvs.sgml,v 1.24 2002/10/20 20:58:02 momjian Exp $
3 4 5 6
CVS code repository
Thomas Lockhart
-->

7
<appendix id="cvs">
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
 <docinfo>
  <authorgroup>
   <author>
    <firstname>Marc</firstname>
    <surname>Fournier</surname>
   </author>
   <author>
    <firstname>Tom</firstname>
    <surname>Lane</surname>
   </author>
   <author>
    <firstname>Thomas</firstname>
    <surname>Lockhart</surname>
   </author>
  </authorgroup>
  <date>1999-05-20</date>
 </docinfo>

 <title>The <productname>CVS</productname> Repository</title>
27

28
 <para>
29
  The <productname>PostgreSQL</productname> source code is stored and managed using the
30 31
  <productname>CVS</productname> code management system.
 </para>
32

33
 <para>
34
  At least two methods,
35 36
  anonymous CVS and <productname>CVSup</productname>,
  are available to pull the <productname>CVS</productname> code tree from the
37
  <productname>PostgreSQL</productname> server to your local machine.
38
 </para>
39

40
 <sect1 id="anoncvs">
41 42 43 44
  <title>Getting The Source Via Anonymous <productname>CVS</productname></title>

  <para>
   If you would like to keep up with the current sources on a regular
45
   basis, you can fetch them from our <productname>CVS</productname> server
46 47 48 49 50 51 52 53 54
   and then use <productname>CVS</productname> to
   retrieve updates from time to time.
  </para>

  <procedure>
   <title>Anonymous CVS</title>

   <step>
    <para>
55
     You will need a local copy of <productname>CVS</productname>
56 57
     (Concurrent Version Control System), which you can get from
     <ulink url="http://www.cyclic.com/">http://www.cyclic.com/</ulink> or
58
     any GNU software archive site.
59
     We currently recommend version 1.10 (the most recent at the time
60
     of writing). Many systems have a recent version of
61 62 63 64 65 66 67 68 69
     <application>cvs</application> installed by default.
    </para>
   </step>

   <step>
    <para>
     Do an initial login to the <productname>CVS</productname> server:

     <programlisting>
B
Bruce Momjian 已提交
70
$ cvs -d :pserver:anoncvs@anoncvs.postgresql.org:/projects/cvsroot login
71 72
     </programlisting>

73
     You will be prompted for a password; just press <literal>ENTER</literal>.
74 75 76 77 78 79 80
     You should only need to do this once, since the password will be
     saved in <literal>.cvspass</literal> in your home directory.
    </para>
   </step>

   <step>
    <para>
81
     Fetch the <productname>PostgreSQL</productname> sources:
82
     <programlisting>
B
Bruce Momjian 已提交
83
cvs -z3 -d :pserver:anoncvs@anoncvs.postgresql.org:/projects/cvsroot co -P pgsql
84 85
     </programlisting>

86
     which installs the <productname>PostgreSQL</productname> sources into a
87 88 89 90 91 92 93 94 95 96 97 98
     subdirectory <filename>pgsql</filename>
     of the directory you are currently in.

     <note>
      <para>
       If you have a fast link to the Internet, you may not need
       <option>-z3</option>, which instructs
       <productname>CVS</productname> to use gzip compression for transferred data.  But
       on a modem-speed link, it's a very substantial win.
      </para>
     </note>
    </para>
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
    <para>
     This initial checkout is a little slower than simply downloading
     a <filename>tar.gz</filename> file; expect it to take 40 minutes or so if you
     have a 28.8K modem.  The advantage of
     <productname>CVS</productname>
     doesn't show up until you want to update the file set later on.
    </para>
   </step>

   <step>
    <para>
     Whenever you want to update to the latest <productname>CVS</productname> sources,
     <command>cd</command> into
     the <filename>pgsql</filename> subdirectory, and issue
     <programlisting>
$ cvs -z3 update -d -P
     </programlisting>

     This will fetch only the changes since the last time you updated.
     You can update in just a couple of minutes, typically, even over
     a modem-speed line.
    </para>
   </step>

   <step>
    <para>
     You can save yourself some typing by making a file <filename>.cvsrc</filename>
     in your home directory that contains
128

129
     <programlisting>
130 131
cvs -z3
update -d -P
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
     </programlisting>

     This supplies the <option>-z3</option> option to all cvs commands, and the
     <option>-d</option> and <option>-P</option> options to cvs update.  Then you just have
     to say
     <programlisting>
$ cvs update
     </programlisting>

     to update your files.
    </para>
   </step>
  </procedure>

  <caution>
   <para>
    Some older versions of <productname>CVS</productname> have a bug that
    causes all checked-out files to be stored world-writable in your
    directory.  If you see that this has happened, you can do something like
    <programlisting>
$ chmod -R go-w pgsql
    </programlisting>
    to set the permissions properly.
155
    This bug is fixed as of
156 157 158
    <productname>CVS</productname> version 1.9.28.
   </para>
  </caution>
159

160 161 162
  <para>
   <productname>CVS</productname> can do a lot of other things,
   such as fetching prior revisions
163
   of the <productname>PostgreSQL</productname> sources
164 165 166 167 168 169 170
   rather than the latest development version.
   For more info consult the manual that comes with
   <productname>CVS</productname>, or see the online
   documentation at
   <ulink url="http://www.cyclic.com/">http://www.cyclic.com/</ulink>.
  </para>
 </sect1>
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
 <sect1 id="cvs-tree">
  <title><productname>CVS</productname> Tree Organization</title>

  <para>
   <note>
    <title>Author</title>
    <para>
     Written by Marc G. Fournier (<email>scrappy@hub.org</email>) on 1998-11-05
    </para>
   </note>
  </para>

  <para>
   The command <command>cvs checkout</command> has a flag, <option>-r</option>,
   that lets you check out a
   certain revision of a module.  This flag makes it easy to, for example,
   retrieve the
   sources that make up release 6_4 of the module `tc' at any time in the
   future:

   <programlisting>
$ cvs checkout -r REL6_4 tc
   </programlisting>

   This is useful, for instance, if someone claims that there is a bug in
   that release, but you cannot find the bug in the current working copy.

   <tip>
    <para>
     You can also check out a module as it was at any given date using the
     <option>-D</option> option.
    </para>
   </tip>
  </para>

  <para>
   When you tag more than one file with the same tag you can think
209 210
   about the tag as <quote>a curve drawn through a matrix of filename vs.
   revision number</quote>.  Say we have 5 files with the following revisions:
211

212 213
   <programlisting>
             file1   file2   file3   file4   file5
214

215 216 217 218 219 220 221 222
             1.1     1.1     1.1     1.1  /--1.1*      <-*-  TAG
             1.2*-   1.2     1.2    -1.2*-
             1.3  \- 1.3*-   1.3   / 1.3
             1.4          \  1.4  /  1.4
                           \-1.5*-   1.5
                             1.6
   </programlisting>

223
   then the tag <literal>TAG</literal> will reference
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
   file1-1.2, file2-1.3, etc.

   <note>
    <para>
     For creating a release branch, other then a
     -b option added to the command, it's the same thing.</para>
   </note>
  </para>

  <para>
   So, to create the 6.4 release
   I did the following:

   <programlisting>
$ cd pgsql
$ cvs tag -b REL6_4
   </programlisting>

   which will create the tag and the branch for the RELEASE tree.
  </para>

  <para>
   For those with <productname>CVS</productname> access, it's simple to
   create directories for different versions.
   First, create two subdirectories, RELEASE and CURRENT, so that you don't
   mix up the two.  Then do:

   <programlisting>
cd RELEASE
cvs checkout -P -r REL6_4 pgsql
cd ../CURRENT
cvs checkout -P pgsql
   </programlisting>

   which results in two directory trees, <filename>RELEASE/pgsql</filename> and
   <filename>CURRENT/pgsql</filename>. From that point on,
   <productname>CVS</productname>
   will keep track of which repository branch is in which directory tree, and will
   allow independent updates of either tree.
  </para>

  <para>
   If you are <emphasis>only</emphasis> working on the <literal>CURRENT</literal>
   source tree, you just do
   everything as before we started tagging release branches.
  </para>

  <para>
   After you've done the initial checkout on a branch

   <programlisting>
$ cvs checkout -r REL6_4
   </programlisting>

   anything you do within that directory structure is restricted to that
   branch.  If you apply a patch to that directory structure and do a

   <programlisting>
cvs commit
   </programlisting>

   while inside of it, the patch is applied to the branch and
   <emphasis>only</emphasis> the branch.
  </para>
 </sect1>

290
 <sect1 id="cvsup">
291
  <title>Getting The Source Via <productname>CVSup</productname></title>
292

293
  <para>
294
   An alternative to using anonymous CVS for retrieving
295
   the <productname>PostgreSQL</productname> source tree
296 297
   is <productname>CVSup</productname>.
   <productname>CVSup</productname> was developed by
298
   John Polstra (<email>jdp@polstra.com</email>) to
299 300 301
   distribute CVS repositories and other file trees for
   <ulink url="http://www.freebsd.org">the FreeBSD project</ulink>.
  </para>
302

303 304 305 306 307 308
  <para>
   A major advantage to using
   <productname>CVSup</productname> is that it can reliably
   replicate the <emphasis>entire</emphasis> CVS repository on your local system,
   allowing fast local access to cvs operations such as <option>log</option>
   and <option>diff</option>. Other advantages include fast synchronization to
309
   the <productname>PostgreSQL</productname> server due to an efficient
310 311
   streaming transfer protocol which only sends the changes since the last update.
  </para>
312

313 314 315 316 317 318 319 320 321 322 323 324 325
  <sect2>
   <title>Preparing A <productname>CVSup</productname> Client System</title>

   <para>
    Two directory areas are required for <productname>CVSup</productname>
    to do it's job: a local <productname>CVS</productname> repository
    (or simply a directory area if you are fetching a snapshot rather
    than a repository; see below)
    and a local <productname>CVSup</productname> bookkeeping
    area. These can coexist in the same directory tree.
   </para>

   <para>
326
    Decide where you want to keep your local copy of the
327
    <productname>CVS</productname> repository. On one of our systems we
328
    recently set up a repository in <filename>/home/cvs/</filename>,
329
    but had formerly kept it under a
330
    <productname>PostgreSQL</productname> development tree in
331 332 333 334 335 336 337 338 339
    <filename>/opt/postgres/cvs/</filename>. If you intend to keep your
    repository in <filename>/home/cvs/</filename>, then put

    <programlisting>
setenv CVSROOT /home/cvs
    </programlisting>

    in your <filename>.cshrc</filename> file, or a similar line in
    your <filename>.bashrc</filename> or
340
    <filename>.profile</filename> file, depending on your shell.
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
   </para>

   <para>
    The <application>cvs</application> repository area must be initialized.
    Once <envar>CVSROOT</envar> is set, then this can be done with a
    single command:

    <programlisting>
$ cvs init
    </programlisting>

    after which you should see at least a directory named
    <filename>CVSROOT</filename> when listing the
    <envar>CVSROOT</envar> directory:

    <programlisting>
$ ls $CVSROOT
CVSROOT/
    </programlisting>
   </para>
  </sect2>

  <sect2>
   <title>Running a <productname>CVSup</productname> Client</title>

   <para>
    Verify that
    <application>cvsup</application> is in your path; on most systems
    you can do this by typing

    <programlisting>
which cvsup
    </programlisting>

375
    Then, simply run
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395
    <application>cvsup</application> using:

    <programlisting>
$ cvsup -L 2 <replaceable class="parameter">postgres.cvsup</replaceable>
    </programlisting>

    where <option>-L 2</option> enables some status messages so you
    can monitor the progress of the update,
    and <replaceable class="parameter">postgres.cvsup</replaceable> is
    the path and name you have given to your
    <productname>CVSup</productname> configuration file.
   </para>

   <para>
    Here is a <productname>CVSup</productname> configuration file
    modified for a specific installation, and which maintains a full
    local <productname>CVS</productname> repository:

    <programlisting>
# This file represents the standard CVSup distribution file
396
# for the <productname>PostgreSQL</> ORDBMS project
397
# Modified by lockhart@fourpalms.org 1997-08-28
398 399 400 401
# - Point to my local snapshot source tree
# - Pull the full CVS repository, not just the latest snapshot
#
# Defaults that apply to all the collections
402
*default host=cvsup.postgresql.org
403 404 405 406 407 408 409 410
*default compress
*default release=cvs
*default delete use-rel-suffix
# enable the following line to get the latest snapshot
#*default tag=.
# enable the following line to get whatever was specified above or by default
# at the date specified below
#*default date=97.08.29.00.00.00
411

412
# base directory where CVSup will store its 'bookmarks' file(s)
413 414 415
# will create subdirectory sup/
#*default base=/opt/postgres # /usr/local/pgsql
*default base=/home/cvs
416

417
# prefix directory where CVSup will store the actual distribution(s)
418
*default prefix=/home/cvs
419

420
# complete distribution, including all below
421
pgsql
422

423 424 425 426
# individual distributions vs 'the whole thing'
# pgsql-doc
# pgsql-perl5
# pgsql-src
427

428 429
   </programlisting>
   </para>
430

431 432
   <para>
    The following is a suggested <productname>CVSup</productname> config file from
433
    <ulink url="ftp://ftp.postgresql.org/pub/CVSup/README.cvsup">the <productname>PostgreSQL</> ftp site</ulink>
434
    which will fetch the current snapshot only:
435

436 437
    <programlisting>
# This file represents the standard CVSup distribution file
438
# for the <productname>PostgreSQL</> ORDBMS project
439 440
#
# Defaults that apply to all the collections
441
*default host=cvsup.postgresql.org
442 443 444 445
*default compress
*default release=cvs
*default delete use-rel-suffix
*default tag=.
446

447
# base directory where CVSup will store its 'bookmarks' file(s)
448
*default base=<replaceable class="parameter">/usr/local/pgsql</replaceable>
449

450
# prefix directory where CVSup will store the actual distribution(s)
451 452
*default prefix=<replaceable class="parameter">/usr/local/pgsql</replaceable>

453
# complete distribution, including all below
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468
pgsql

# individual distributions vs 'the whole thing'
# pgsql-doc
# pgsql-perl5
# pgsql-src

    </programlisting>
   </para>
  </sect2>

  <sect2>
   <title>Installing <productname>CVSup</productname></title>

   <para>
469
    <productname>CVSup</productname> is available as source, pre-built
470 471 472 473 474 475 476 477 478
    binaries, or Linux RPMs. It is far easier to use a binary than to
    build from source, primarily because the very capable, but
    voluminous, Modula-3 compiler is required for the build.
   </para>

   <procedure>
    <title><productname>CVSup</productname> Installation from Binaries</title>

    <para>
479
     You can use pre-built binaries
480
     if you have a platform for which binaries
481
     are posted on
482
     <ulink url="ftp://ftp.postgresql.org/pub">the <productname>PostgreSQL</productname> ftp site</ulink>,
483 484 485 486 487 488 489
     or if you are running FreeBSD, for which
     <productname>CVSup</productname> is available as a port.

     <note>
      <para>
       <productname>CVSup</productname> was originally developed as a
       tool for distributing the <productname>FreeBSD</productname>
490
       source tree. It is available as a <quote>port</quote>, and for those running
491 492 493 494 495 496 497 498 499
       FreeBSD, if this is not sufficient to tell how to obtain and
       install it then please contribute a procedure here.
      </para>
     </note>
    </para>

    <para>
     At the time of writing, binaries are available for
     Alpha/Tru64, ix86/xBSD,
500
     HPPA/HP-UX 10.20, MIPS/IRIX,
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518
     ix86/linux-libc5, ix86/linux-glibc,
     Sparc/Solaris, and Sparc/SunOS.
    </para>

    <step>
     <para>
      Retrieve the binary tar file for
      <application>cvsup</application>
      (<application>cvsupd</application> is not required
      to be a client) appropriate for your platform.
     </para>

     <substeps>
      <step performance="optional">
       <para>
	If you are running FreeBSD, install the <productname>CVSup</productname> port.
       </para>
      </step>
519

520 521 522
      <step performance="optional">
       <para>
	If you have another platform, check for and download the appropriate binary from
523
	<ulink url="ftp://ftp.postgresql.org/pub">the <productname>PostgreSQL</productname> ftp site</ulink>.
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538
       </para>
      </step>
     </substeps>
    </step>

    <step>
     <para>
      Check the tar file to verify the contents and directory
      structure, if any. For the linux tar file at least, the static binary
      and man page is included without any directory packaging.
     </para>

     <substeps>
      <step>
       <para>
539
	If the binary is in the top level of the tar file, then simply
540 541 542 543 544 545 546 547 548 549 550 551
	unpack the tar file into your target directory:

	<programlisting>
$ cd /usr/local/bin
$ tar zxvf /usr/local/src/cvsup-16.0-linux-i386.tar.gz
$ mv cvsup.1 ../doc/man/man1/
	</programlisting>
       </para>
      </step>

      <step>
       <para>
552
	If there is a directory structure in the tar file, then unpack
553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606
	the tar file within /usr/local/src and move the binaries into
	the appropriate location as above.
       </para>
      </step>
     </substeps>
    </step>

    <step>
     <para>
      Ensure that the new binaries are in your path.

      <programlisting>
$ rehash
$ which cvsup
$ set path=(<replaceable>path to cvsup</replaceable> $path)
$ which cvsup
/usr/local/bin/cvsup
      </programlisting>
     </para>
    </step>
   </procedure>
  </sect2>

  <sect2>
   <title>Installation from Sources</title>

   <para>
    Installing <productname>CVSup</productname> from sources is not
    entirely trivial, primarily because most systems will need to
    install a Modula-3 compiler first.
    This compiler is available as Linux <productname>RPM</productname>,
    FreeBSD package, or source code.

    <note>
     <para>
      A clean-source installation of Modula-3 takes roughly 200MB of disk space,
      which shrinks to roughly 50MB of space when the sources are removed.</para>
    </note>
   </para>

   <procedure>
    <title>Linux installation</title>

    <step>
     <para>
      Install Modula-3.
     </para>

     <substeps>
      <step>
       <para>
	Pick up the <productname>Modula-3</productname>
	distribution from
	<ulink url="http://m3.polymtl.ca/m3">Polytechnique Montréal</ulink>,
607
	who are actively maintaining the code base originally developed by
608 609
	<ulink
	 url="http://www.research.digital.com/SRC/modula-3/html/home.html">the DEC Systems Research Center</ulink>.
610
       The <productname>PM3</productname> <productname>RPM</productname> distribution is roughly
611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658
	30MB compressed. At the time of writing, the 1.1.10-1 release
	installed cleanly on RH-5.2, whereas the 1.1.11-1 release is
	apparently built for another release (RH-6.0?) and does not run on RH-5.2.

	<tip>
	 <para>
	  This particular rpm packaging has
	  <emphasis>many</emphasis> <productname>RPM</productname> files,
	  so you will likely want to place them into a separate
	  directory.
	 </para>
	</tip>
       </para>
      </step>

      <step>
       <para>
	Install the Modula-3 rpms:

	<programlisting>
# rpm -Uvh pm3*.rpm
	</programlisting>
       </para>
      </step>
     </substeps>
    </step>

    <step>
     <para>
     Unpack the cvsup distribution:

      <programlisting>
# cd /usr/local/src
# tar zxf cvsup-16.0.tar.gz
      </programlisting>
     </para>
    </step>

    <step>
     <para>
      Build the cvsup distribution, suppressing the GUI interface
      feature to avoid requiring X11 libraries:

      <programlisting>
# make M3FLAGS="-DNOGUI"
      </programlisting>

      and if you want to build a static binary to move to systems
659
      that may not have Modula-3 installed, try:
660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681

      <programlisting>
# make M3FLAGS="-DNOGUI -DSTATIC"
      </programlisting>
     </para>
    </step>

    <step>
     <para>
      Install the built binary:

      <programlisting>
# make M3FLAGS="-DNOGUI -DSTATIC" install
      </programlisting>
     </para>
    </step>
   </procedure>
  </sect2>
 </sect1>
</appendix>

<!--
682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744
> It became clear that I had a problem with my m3 installation; some
> X11 libraries were not being found correctly.

By the way, you can build the client without the GUI by doing this
in the "client" subdirectory:

    m3build -DNOGUI

If you build it that way, then it doesn't need the X11 libraries and
it's quite a bit smaller.  The GUI is fun to watch, but it's not
very useful.  I originally implemented it because it made debugging
the multi-threaded client program much easier.

To build a statically-linked client, edit <filename>client/src/m3makefile</filename>
to add <literal>build_standalone()</literal>
 just before the <literal>program()</literal> entry near
the end of the file:

<programlisting>
build_standalone()
program(cvsup)
</programlisting>

Then, if cvsup has already been built, remove the machine-specific build directory
(e.g. <filename>LINUXELF/</filename>) and rebuild:

<programlisting>
rm -rf LINUXELF
m3build -DNOGUI -v
cp -p LINUXELF/cvsup /usr/local/bin
</programlisting>

> Anyway, with the reinstall and the two-line patch above (and that
> one include-file _POSIX_SOURCE workaround from the previous try),
> things built cleanly.

Good!

> Now I just need a server somewhere to test.

If you want to try it out, there are public servers for the FreeBSD
source repository at cvsup.freebsd.org and cvsup2.freebsd.org.
Here's a suggested supfile:

*default host=cvsup.freebsd.org compress
*default release=cvs
*default base=/home/jdp/cvsup-test	# FIX THIS
*default delete use-rel-suffix
# *default tag=.
src-bin

This will fetch you the source repository for the programs that get
installed into "/bin".  I chose it because it's one of the smaller
pieces of the system.  Make an empty directory someplace for
testing, and change the "FIX THIS" line to specify that directory
after the "base=".

If you are on a T1 or better, you should probably delete the
"compress" keyword in the first line.

As shown, it will get the repository (RCS) files.  If you uncomment
the line containing "tag=." then it will instead check out the
latest version of each file.  There's a bunch more information about
745 746
what you can do in
<ulink url="http://www.freebsd.org/handbook/cvsup.html">the CVSup Handbook</ulink>.
747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766

There is one other thing I want to send you, but not tonight.  I
discovered the hard way that you need a malloc package that is
thread-safe with respect to the Modula-3 threads package.  The
Modula-3 runtime takes care to do the proper mutual exclusion around
all calls it makes to malloc.  But if you call certain functions in
the native C library which in turn call malloc, then the mutual
exclusion gets bypassed.  This can lead to rare but baffling core
dumps.

For FreeBSD, I solved this by adding a thread-safe malloc package
into the Modula-3 runtime.  The package is quite portable, and I'm
sure it will work well for Linux with very few changes (probably
none at all).  I want to send it to you along with instructions
for making it a part of the "libm3core" library.  It's very simple,
but I've run out of steam for tonight. :-)  Once you have this
malloc in place, the CVSup system should be rock solid.  We have
servers that have been up for weeks and have served many thousands
of clients without any observed problems.

767
> We hope to have the PostgreSQL tree using CVSup within a month or
768 769 770 771 772 773 774 775 776 777 778
> so, and hope to retire sup in September...

Great!  I'll do my best to help make sure you don't regret it.

John

Tom,

I'm appending the sources for the thread safe version of malloc that
I told you about.  I believe that it will simply compile and work
under Linux, but I've never had an opportunity to test it there.
779
I urge you to put it into your Modula-3 system; otherwise, you
780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817
are guaranteed to get occasional mysterious core dumps from cvsupd.

As a first step, I'd suggest simply trying to compile it under
Linux, like this:

    cc -O -c malloc.c

You shouldn't get any errors or warnings.  If you do, contact me
before you waste any more time on it.

Assuming it compiles OK, copy malloc.c into this directory of your
Modula-3 source tree:

    m3/m3core/src/runtime/LINUXELF

In that same directory, edit "m3makefile" and add this line to the
end of the file:

    c_source       ("malloc")

Then chdir up into "m3/m3core" of the Modula-3 tree and type
"m3build".  (I'm assuming you already have a working Modula-3
installation.)  After that finishes, become root and type "m3ship"
to install it.

That's all there is to it.  If you built cvsup and cvsupd to use
shared libraries, you don't even need to re-link them.  They'll pick
up the change automatically from the updated shared library.

Let me know if you run into any problems with it.

By the way, this is a very good malloc in its own right.  It's worth
using even aside from the thread safety of it.

Regards,
John

I've deposited a statically built cvsup client executable (and man pages
818
and test configuration) in
819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834

  /pub/incoming/cvsup-15.1-client-linux.tar.gz

This was built and linked on Linux/v2.0.30, RH/v4.2, gnulib/v5.3.12 and
includes the thread-safe malloc provided by John Polstra. I'll forward
to you the malloc code and an additional installation e-mail from John.

The Modula-3 installation takes a good bit of room (~50MB?) and the
build environment is unique to Modula-3, but suprisingly enough it
pretty much works.

The cvsup Makefiles do not work on my machine (they are not portable
yet) but each major package (there are 4) can be built without needing
the makefiles with two commands each. Not difficult at all. John gives
some hints in his e-mail on how to build a static executable, and on how
to shrink the size of the executable by leaving out the GUI support.
835
Again, easy to do.
836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851

My client test case, picking up a sub-tree of the FreeBSD distribution,
worked flawlessly. I haven't tried running a server.

Thanks to John for getting me going.

			- Tom


For the thread-safe malloc, do the following:
1) install Modula-3
2) add the enclosed file "malloc.c" to m3/m3core/src/runtime/LINUXELF
3) edit the last line of m3makefile in the same directory to add
     c_source       ("malloc")
4) do an "m3build" and an m3ship from the appropriate directory.

852
From what John said, the malloc problem can be noticable for the
853 854 855 856 857 858 859 860
server-side running cvsupd. Clients may not need it.

Unfortunately I seem to have lost John's original good instructions for
this, so am doing this from memory. May need to ask John to give
instructions again...

			- Tom

861
-->
862 863 864 865


<!-- Keep this comment at the end of the file
Local variables:
866
mode:sgml
867
sgml-omittag:nil
868 869 870 871 872 873 874 875
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"./reference.ced"
sgml-exposed-tags:nil
876
sgml-local-catalogs:("/usr/lib/sgml/catalog")
877 878 879
sgml-local-ecat-files:nil
End:
-->