
CSE 401: Compilers

Each student group will be assigned a unix "group ID", e.g.
401z, and a directory will be created for you in
/projects/instr/cse401/98au/401z
. Use this directory to
hold files you need to share with your group-mates. Remember
that files you create here need to be made "group readable"
and/or "group writable", but should not have "world" access.
sanjuan% cd /projects/instr/cse401/98au
sanjuan% ls -lg
total 13
drwxrwx--x 3 root 401a 512 Apr 11 20:04 401a/
...etc...
drwxrwx--x 4 root 401z 512 Apr 11 17:21 401z/
sanjuan% cd 401z
sanjuan% cp ~/foo.c foo.c
sanjuan% ls -lg
total 3
-rw------- 1 ruzzo 401z 7 Apr 12 20:41 foo.c
sanjuan% ### Add read, write, exec/search to group, remove from others:
sanjuan% chmod g+rwX,o-rwx *
sanjuan% ls -lg
total 3
-rw-rw---- 1 ruzzo 401z 7 Apr 12 20:41 foo.c
sanjuan%
RCS Access control
It is highly recommended that you use RCS ("Revision Control
System") to control simultaneous access and to provide a version
history. If you don't, then you risk having large portions of
your work disappear when one of your partners writes over the
same file you were working on. Very briefly, using RCS involves
registering all files in your project and then checking them out
to use them, and checking them in when finished.
Here's one way that you can set up your directory for version control.
- Create a directory called RCS in your group's project
directory, and a symbolic link to it from your working directory:
cd /projects/instr/cse401/98au/401z
mkdir RCS
cd ~/myfavoritecourse/pl0
ln -s /projects/instr/cse401/98au/401z/RCS RCS
- Get the base project files:
cp /cse/courses/cse401/CurrentQtr/pl0_base/* ~/myfavoritecourse/pl0
- Register all the files with RCS.
cd ~/myfavoritecourse/pl0
foreach foo (*)
ci -u -t-$foo $foo
end
You only need to do this once for each file. If you create
a new file you should check it via the ci line above or
clicking on Tools->Version Control->Register
in emacs.
- The procedure above will leave you with a read-only copy
of each file. To edit a file, say
scanner.c
,
you need to "check out" a "locked" copy of it, then check it
back in when you're finished.
co -l scanner.c
emacs scanner.c
<...edit & test to your heart's content...>
ci -u scanner.c
Alternatively, it's easy to check files in and out using
emacs; simply visit the file and then hit C-x C-q (control-x
control-q). (Use the menus if you forget). Note that if
you haven't registered the file, the emacs mode-line won't
say RCS and C-x C-q will simply toggle the read-only status
of the file.
If you try to check out a file that someone's already using,
RCS and/or emacs will let you know who. Otherwise, it will
give you the lock to the file and nobody else will be able
to check out that file until you check it back in.
- RCS itself will not automatically give your partners a
file that you check back in. This is a feature; they can
choose when they want to synchronize their files with the
master versions. (For example, if they know that you've
checked in a buggy module that can't yet compile, but they
still want to keep working on their own part which isn't
dependent on it.)
If you want to make sure that all of your files are the most
current versions, you can run:
co RCS/*
Alternatively, the following may work on some systems (the
Indy's?):
rsync -v
- Some hints:
- The first time you edit a file, I recommend adding the
line:
// $Header$
at the top of the file; on subsequent checkouts, this line
will be replaced with RCS header info --- file name, version
number, time stamp, etc.
- Try not to check-in a module that won't compile. Your
partners will be irked if they synchronize their files
and find they can't work on their own modules until you
fix yours. (If it helps, you can check out a previous
version if this happens to you; see
man
co
.)
- To read about emacs's interface to RCS, type this within
emacs:
C-h i g (emacs)Version Control
You can click on the hypertext links with the middle-button.
- Split separate modules into different files so that your
partners can work on other routines simultaneously.
- Make Version Snapshots often. That makes RCS remember not
just the state one file is in, but the state that all of
the files are in. Emacs allows you to take a snapshot by
typing either M-x vc-create-snapshot, or C-x v s.
- To read about RCS, take a look at man rcsintro, rcs,
ci, co, rsync, rlog, and rcsdiff.
Thanks to Ben Wong for a preliminary version of this info.

401admin@cs.washington.edu
(Last modified: 10/20/98)