[comp.os.minix] Posix P1003.2 & MINIX

ast@cs.vu.nl (Andy Tanenbaum) (06/29/90)

Now that everyone (especially me) has recovered from the 1.5 upgrade
trauma, it is time to find something else to keep busy with.  I'm going
to work on converting 1.5 to be P1003.1-1988 compatible.  That will keep
me busy for a year I imagine.

What about you folks?  To prevent acute boredom from setting in, I have a
modest suggestion: convert all the utilities to be P1003.2 conformant.
For the uninitiated, the IEEE Posix standards group has about a dozen
committees, numbered P1003.x for various x.  P1003.1 is concerned with
the system calls (actually library calls, for the purist).  They have
delivered a nice, readable green, black, and white book which other
people are actively trying to ruin by adding lots of new features to.
P1003.2 defines what the shell and utility programs do.  Other groups
deal with multiprocessors, real time, Fortran bindings, and a host of
other issues.

This message concerns P1003.2.  It defines the syntax and semantics of
a large number of commands that a conformant system must have.  I will
be busy with the OS proper (kernel, FS, and MM) and won't have time to
do this, but I thought that with 16,000 people in this group, if we could
find, say, 10-20 volunteers, it should be possible to make quite a bit
of progress on making conformant utilities.

The P1003.2 standard has not yet been approved, and won't be for a while.
I have a copy of Draft 9 (29 August 1989) as the working document.  I'll
check on how one can order a copy these days.  Below is a list of utilities
specified by P1003.2 draft 9.  If you would like to modify some MINIX
utilities to be conformant, or at least closer to conformant, please let
me know.  I'll try to co-ordinate work to avoid too much duplication.
If you "sign up" for say half a dozen utilities, I'll send you a photocopy
of the relevant pages of draft 9 (at least the specific pages for the
utilities).  Please don't sign up if you are not serious or don't really
have the time.

There is unfortunately a large amount of preliminary matter
dealing with locales, syntax, and a lot of other things.  One thing to
keep in mind is that numbers in arguments are supposed to be longs.  Thus

	head -20000000 file

is syntactically legal.  The program is not required to do anything intelligent
with it however.  At present few utilities accept longs as numeric args.

Most error messages are precisely specified in terms of the printf string
that must be used to produce them.  The idea is that programs can grep
for error strings, so they must be exact.  This means that close to 100%
of the error strings must be changed.

All this notwithstanding, the utilities are currently moderately small and
reasonably debugged.  PLEASE don't make any more changes than the standard
requires you to make.

I am going to London on July 6, as I am one of the invited speakers at the
UK UNIX Users' Group meeting.  After that, I'll be away for 2 weeks on
vacation.  Thus if we don't get sorted out before July 5, it will have to
wait until August.  Probably I should have started earlier, but I have
been doing real work (sorry). (If you are curious about what real work is
around here, see the May 1990 issue of IEEE Computer Magazine, pp. 44-53.)

Chapter 3 of P1003.2 deals with the shell in great detail.  Making a
conformant shell is not for the faint of heart.  It might be a suitable
Master's thesis, however.  Below are the synopses of the required
utilities.

The notation [x | y] below indicates either x or y may be chosen, but not
both.

awk [-F expr] program [argument ...] or awk [-F ere] [-f progfile] [arg ...]
basename string [suffix]
bc [-l] [file ...]
cat [-c] [-u] [file ...]
cd [dir]
chgrp [-R] group file ...
chmod [-R] mode file ...
chown [-R] owner file ...
cksum [file ...] (easy one--the full source code is provided!)
cmp [-l | -s] file1 file2
comm [-123] file1 file2
command [argument ...]
cp [-f | -i] [-pR] source target
create [-d | -f] [-npqtP] [-m mode] [-x prefix] name ...
cut -c list [file ...] or cut -f list [-d string] [-s] [file]
date [-u] [+format]
dd [operand ...]
diff [-c | -e | -C n] [-br] file1 file2
dirname string
echo [string ...]
ed [-p string[ ] [-] [file]
env [-] [-i] [name=value] ... [utility [arg ...]]
expr operand ...
false
find path ... [operand_expr]
fold [-b] [-s] [-w width] [file ...]
getconf system_var or getconf path_var pathname
getopts optstring name [arg ...]
grep [-E | -F] [-cilnsvx] [-f pattern_file | -e pattern] ...
head [-c | -l] [-n number] [file ...]
hexdump [-bcdov] [-e format_string] [-f file] [-n ct] [-s skip] [file ...]
id [-g | -u] [-nr] [user]
join [options]
kill [-signal_name] pid ... or kill -1
ln [-f | -i] source ... target
locale [-a | -l locale] [-ckv] [-f charmap] [name ...]
localedef [-f charmap] name
logger string ...
logname
lp [-c] [-d dest] [-n copies] [file ...]
ls [-CFRacdilqrstul] [file ...]
mkdir [-p] [-m mode] dir ...
mkfifo [-p] [-m mode] file ...
mv [-f | -i] source target
nohup utility [arg ...]
paste [-d list] [-s] file ...
pax [options] (writing it is a bachelor's thesis; doing it in 64K is a Masters)
pr [options]
printf fomrat [args ...]
pwd
read [-r] var ...
rm [-f | -i] [-Rr] file ...
rmdir [-p] dir ...
sed [-n] script [file ...] or sed [-n] [-e script] [-f script_file] [file ...]
sendto [-s subject] address ... 
sh [-aefinuvx] [-c string | -s] [argument]
sleep time
sort [options]
stty [options]
tail [-c | -l] [-f] [-n number] [file]
tee [ai] [file ...]
test expression
touch [-acm] [-r ref_file | -t time] file ...
tr [-c] [-d | -s] string1 string2
true
tty [-s]
umask [-o | -s | mask]
uname [-amnrsv]
uniq [-c | -d | -u] [-f fields] [-s chars] [input_file [output_file]]
wait [pid]
wc [-clw] [file ...]
xargs [-n number] [-s size] [-t] [utility argument ...]]

In addition to these, Chap. 6 specifies:

ar [options]
make [-f makefile] ... [-eiknpqrSst] [macro=name] ... [target] ...
strip file ...

archer%segin4.segin.fr@prime.com (Vincent Archer) (06/29/90)

Andy Tanenbaum <ast@cs.vu.nl> says:
> This message concerns P1003.2.  It defines the syntax and semantics of
> a large number of commands that a conformant system must have.  I will
> be busy with the OS proper (kernel, FS, and MM) and won't have time to
> do this, but I thought that with 16,000 people in this group, if we could
> find, say, 10-20 volunteers, it should be possible to make quite a bit
> of progress on making conformant utilities.

Here's one!!!

> If you "sign up" for say half a dozen utilities, I'll send you a photocopy
> of the relevant pages of draft 9 (at least the specific pages for the
> utilities).  Please don't sign up if you are not serious or don't really
> have the time.

I have some spare time for, let's say, three-four months. Pick the utilities,
I'll take my whip and make them behave :-) (not too many, or it might take too
long)

> All this notwithstanding, the utilities are currently moderately small and
> reasonably debugged.  PLEASE don't make any more changes than the standard
> requires you to make.

Btw, I'll post (next week, first thing) a new backup(1) command. I'll split
the patch in three parts:
    1> Posixify code (use readdir(), include <limits.h>)
    2> Implement a -k option (keep user & group ids, if you're root)
    3> Implement such nice thing as "backup . /dev/dd0" (without using a shell)
Patch 1 is necessary. Patch 2 & 3 are reasonably independant, you can apply one
and not the other if you want...

> In addition to these, Chap. 6 specifies:
>
> ar [options]

Do you mean that ar(1) will have the same options on PC and STs? :-) (I'm not
asking about internal compatibility)


    Vincent


Vincent Archer                   | Email:archer%segin4.segin.fr@prime.com
"People that are good at finding excuses are never good at anything else"

meulenbr@cst.philips.nl (Frans Meulenbroeks) (06/29/90)

Note that an implementation of pax once appeared in comp.sources.unix
(volume 17, early '89).
I don't know how conformant it is.
I remember that it was big, so perhaps it won't fit in 64k.

regards, Frans.
--
Frans Meulenbroeks        (meulenbr@cst.philips.nl)
	Centre for Software Technology
	( or try: ...!mcsun!phigate!prle!cst!meulenbr)