rose@galtee.cs.wisc.edu (Scott M. Rose) (01/20/91)
Coherent Digest Vol. 91.1, No. 5 Sat Jan 19 22:17:23 CST 1991 Today's Topics: ls Review of /rdb deleting Coherent news and others... Response to Mr. Miller's questions Help on new uux, uuxqt and other stuffs Coherent 3.1 AMI Drive Type 47 Also having problems w/ Clam-141 Administrivia: The Coherent Digest is a forum for discussion of the MWC Coherent 3.x operating system. Send submissions to "coherent@cs.wisc.edu" and administrivia to "coherent-reqeust@cs.wisc.edu". Previous issues are archived for anonymous FTP access on piggy.ucsb.edu in the directory "pub/coherent/mail-list". Thousands eat flaming death as I edit this week's edition. Somehow it seems obscene to conduct business as usual in such times... but I digress. ---------------------------------------------------------------------- Date: Wed, 16 Jan 91 08:13:35 EST From: kcr@mlb.semi.harris.com (Keighley C. Ross) To: coherent Subject: ls The single-column format of ls was quite annoying to me, and I gather to some others, as well. You might be interested in using or adapting the following small program, which looks at (1) whether the output is going to a tty, (2) whether there are options specified, and (3) whether files were specified, then chooses an appropriate method of listing. It's not as good as a "real" ls, but at least things don't scroll of the terminal as quickly. Just compile this, and place it somewhere in your search path before /bin/, or as an alias. Note that this should not replace /bin/ls, since it relies on it. /* ls - pick proper file lister for the job */ #include <stdio.h> #define MAXCMDLINE 1024 #define stripnl(xxx) if(xxx[0]) xxx[strlen(xxx)-1]='\0'; main(argc,argv) int argc; char **argv; { char buf[MAXCMDLINE+20], *tabs=""; FILE *fp; int option=0, i, wid; for(i=1; i<argc; ++i) if(argv[i][0] == '-') option=1; if(option || !isatty(stdout->_fd)) /* has options or piped */ execv("/bin/ls",argv); /* use regular ls */ else if(argc<2) /* no files */ execv("/bin/lc",argv); /* lc gives good results */ else { /* just plain list everything */ wid=0; /* try to columnize */ strcpy(buf,"/bin/ls"); for(i=1; i<argc && strlen(buf)<MAXCMDLINE; ++i) { strcat(buf," "); strcat(buf,argv[i]); } fp=popen(buf,"r"); while(fgets(buf,128,fp)!=NULL) { stripnl(buf); if(wid+strlen(buf) > 80) { fputc('\n',stdout); wid=0; } else fputs(tabs,stdout); fputs(buf,stdout); tabs=(strlen(buf)&010)? "\t" : "\t\t"; wid=(wid+strlen(buf)+16)/16*16; } fputc('\n',stdout); fclose(fp); exit(0); } fputs("oops, still here; execv() failed!\n",stderr); } Hope this helps. - -------------------------------------- Keighley Ross ---------------- HH _ HH kcr@mlb.semi.harris.com Design Systems Development H_/ |_HH Opinions expressed Harris Semiconductor HH HH are solely my own. Melbourne, Florida, ------------------------------ Date: 16 Jan 91 17:31:12 From: Anders Fongen <anders@fongen.uu.no> To: coherent Subject: Review of /rdb Dear Conference, this is a crude translation of my review on /rdb. While reading this, please keep in mind that English is not my mother tongue. I tried to post it on an earlier occasion, but I never received an echo, so this is perhaps a superflous attempt. All the best, Anders Fongen - ------------------------------------------------------------ A RELATIONAL DATABASE FOR COHERENT Abstract: For those of you that consider this column to be not practical oriented enough: We will in this roundup look at a relational database for UNIX. And for those of you that think that UNIX is for the wealthy: We'll look at /rdb which cost $50 - a relational database for Coherent, Coherent is a UNIX-clone that costs $100! - --- /rdb is a relational database that goes its own ways. What we from the PC-environmet is used to is integrated development tools, with its own menu system, its own (and often secret) filesystem, its own programming language and its own utility programs. Totally self-contained, take it or leave it. If you have data management and processing needs that these systems can't satisfy, then you are in trouble - the system won't normally allow you to make e.g. C-programs than accesses the data base. /rdb is designed under different conditions. It assumes that you already have UNIX, and have put some effort into learning the Shell programming language and the utility programs included, and perhaps also some C programming. UNIX Shell (e.g. Bourne Shell) can well be regarded as a 4 GL, where you treat whole files with single commands, so why not use this language in a data base system? And as you have spent much time learning the tools of UNIX, why can't the database be files that can be treated by these? This kind of resource economy is what the programmers had in mind when /rdb was made. The database is a collection of "flat" ASCII files, the operations on the files is done through small programs that is connected through redirection and piping. Why should you learn to use a new editing tool for each new program that you buy? With Turbo Pascal you learn one, with Dataease another, with Microsoft Windows a third and Word Perfect as a fourth. They are not very different, just enough to make you confused as you move from one to the other. /rdb is shipped without any editor, so you pick your favorite ASCII-editor. The programs AWK and Bourne Shell is the motor of /rdb. Many of the commands are shell-programs, and some of them writes small AWK-programs which is executed in due course. See the textbox: "Intro to AWK" (not present in the English translation). Tables A relational database consists of a number of tables. The tables have rows and columns, and each row has the same columns. A table kan look like this: $ cat utgifter dato konto belop ---- ----- ----- 901002 04 123.00 901004 01 45.50 901005 04 9.90 . . . . . . The columns are separated by by tabulator characters, and each row is on a separate line. On the top we find the column names, underneath is a line of dashes, so it will look pretty. This is so little exciting that we almost went disappointed. We were so used to databases with a cryptic file structure, if we TYPEd them to the screen we got cartoon-cursing all over the screen. "Speed", we said, "this will be too slow". "Security", we said also, "this look unsafe". We found answers to these questions during the test, and will comment on that later. Find columns Let os now do one operation on this table. We write $ column dato belop < utgifter dato belop ---- ----- 901002 123.00 901004 45.50 901005 9.90 . . . . We have now asked for a "projection" of the table, almost a "facet" of the data that is contained in the table. We can pick the columns we wish, in the order that we require. We can also make computations on columns when necessary. Another command that affects columns is "compute", that adds or alters columns. Find rows We can pick specific rows in a table, on the basis of conditions that the row must meet. We write $ row 'belop > 100' < utgifter dato konto belop ---- ----- ----- 901002 04 123.00 Please note that the output from these commands are themselves valid tables. Vi may therefore write them to a disk file and in turn do operations on them. Putting operations together If we only need the dates where account 04 has been debited, we may write $ row 'konto == 04' < utgifter | column dato dato ---- 901002 901005 With the command "row" we make a selection of rows in the table, but instead of writing the new table to screen or to disk, we use the "|"-character to send the table as input to the "column" command. Now you may start plumbing! With a choice of more than 100 /rdb-commands, plus a lot of the standard UNIX-commands, you may put together rather complex database operations. The designers of /rdb has thus not been obliged to make an intepreter for a query language. Less code and less bugs for the developer, and less training for you. The join-command One important property of a relational database is its ability to combine data in different tables. In this way we may avoid "functional dependency" (redundancy), because a e.g. customer number and a customer name is stored only once in the database (not with every order or invoice on this customer). In addition to the table "utgifter" (expenses) we've got the table "kontoer" (accounts). It can look like this: $ cat kontoer konto navn ----- ---- 01 Porto 02 Telefon 03 Transport 04 Rekvisita . . . . We may start a "join"-operation that combines these data with the account number as a basis, so that each row in the table "utgifter" gets a new column that is called "navn". $ sorttable konto utgifter > tmp $ jointable -j konto tmp kontoer dato konto belop navn ---- ----- ----- ---- 901002 04 123.00 Rekvisita 901004 01 45.50 Porto 901005 04 9.90 Rekvisita . . . . . . We have in this examples also used the command "sorttable", because the join-operation requires that the tables are sorted on the key columns. The four commands that we have shown so far, "column", "row", "sorttable" and "jointable" are all essential, but let us now look into the options for entering data and printing out reports. Reports In addition to the query language that you put together in the way we now have described, you will also need tools for precise formatting av table data. We will therefore look at the program "report". This program takes a template and a table, and does a merge-like operation to produce a report. Let us now take a look at what a report might look like: $ cat mal O v e r s i k t o v e r u t g i f t e r Dato: <dato> Belastet konto: <navn> Bel|p: <belop> Inside this table we may reference columns in the table, and the report will fill in the actual value from this columns as it runs through the table, making one "page" from each row. We have kept the result from the "join"-operation in the file tmp2, on are now writing: $ report mal < tmp2 O v e r s i k t o v e r u t g i f t e r Dato: 901005 Belastet konto: Porto Bel|p: 123.00 O v e r s i k t o v e r u t g i f t e r Dato: 901007 Belastet konto: Porto Bel|p: 9.10 . . . . This is pretty analogous to merge-operations in e.g. Word Perfect. We will also mention that UNIX- (as well as /rdb-) commands may be inserted into a template, they will be executed for each row in the table, and the output inserted into the report. Do you change "mal" to contain the string "<!cal!>" the calendar for this month will be inserted into the report at his point at every page. Talking about pages: If you really want data from each row on a new piece of paper you will have to make your own "eject"-command that puts Ctrl-L to standard output, and include a call to this program e.g. at the bottom of the template. Data entry can be done in several ways. You can add data to the table file in every way as long as you follow the rules for how columns and rows are separated. A program running in the background reading data from some kind of instrument may well write data to disk on a format that enables /rdb to process them. But /rdb also includes some program to support data entry from standard output. The "enter"-command gives you the simplest way of entering data. The command shows you a "heading" that tells you the name of the columns. Then you may enter data line by line, separating the columns with the TAB-key. This method is rather primitive because it does not allow you to backtab to earlier entries for corrections. The "enter"-command is usable, though, because it may be built into shell-scripts without problems. A more advanced program is called "ve", which is a "table editor". It resembles "vi", the standard editor of UNIX. With "ve" you are allowed to edit existing data as well as enter new date. You can design a screen form that is being used during operations, or "ve" can use a standard layout. Ve has the same advantages and draw-backs as similar programs from other systems. You have a lot of possibilities, both helpful and obstructive. When you make applications you will often need to limit this number of possibilities, especially when you deal with inexperienced users. Often this is not easy, nor it is in "ve", where all commands are hard-coded into the program without any e.g. table-driven mechanisms. "ve" gives you the option of data validation. You may in an additional file instruct "ve" to accept for one particular column only those data that meets requirements on character- ranges,field length, or that the value must be present in another table (look-up). Indexing We promised to speak of speed. To organize data in flat ASCII- files is seldom optimal with respect to processing speed. One retrieval operation would in average lead to a search through half of the table. A faster retrieval method is through indexing, where the system maintains a parallel data-structure specially designed for receiving a keyword and returning a pointer to the exact position of the corresponding data record. Several methods have been invented, but most often we find B-tree and Hashing in use. A lot of data base systems offers indexing high and low, without concern for the extra work involved with data entry, modifying or deletion. The volume of search and retrieval in the data base must obviously be weighted against the number of changes, but as a rule of thumb we may say that the use of indexing is not economical on tables with less than 1000 rows. /rdb offers indexing on tables based on hashing-algorithm or through binary search in sorted key-files. Security >From other data base systems you might be used to the habit of linking each column in a table to an access level, so that you as a the programmer kan decide that users should be allowed to see only specific columns. One example could be a personnel table, where everyone should be able to see how the names are spelled, to check phone numbers and organizational names, but information on salaries are kept secret. "This will not work", we thought, you will need read access to the table file, and then be allowed to view all columns and all rows through a "cat"-command. This turned out to be wrong. We will now outline a method that enables the owner of the data base to restrict the access to the information with unlimited flexibility: The data base files is owned by you and is protected so that noone can read them but yourself (group and others should have no access). All operations on the data base is done by shell-script which are write-protected (others need read access). Additionally, the "main program" (the shell-script started from command level) needs the SUID-bit ON. The SUID-bit has no automatic function on shell programs, but is a proof that you are the one that wrote the content (the chown-command will turn any SUID-bit OFF), on the condition that you have write-protected the file (remember to write-protect the directory as well!). On the basis of this framework it is now safe to make a small C-program that checks whether the SUID-bit is ON, and if it is, change the UID to the value of the owner of the file and start executing it. The user will now appear to the operating system as the owner of the data base, and get the rights given to him by the shell program. If he on the other hand attempts to run commands directly on the files he will be rejected. This particular C-program must be set SUID to "root", by the way. Flexible maybe, but watch your steps. To master the file protection mechanism is now becoming extremely important, and we would not be alone to establish such a mechanism in a large project. Several persons looking for security holes, and dedicated programs that routinely checks the file protection would provide us with a better sleep at night. Versions and price /rdb for Coherent costs $50. In addition, the authors have written an excellent book "Unix Relational Database Management", which in greater depth explains the practical uses of /rdb. The documentation that comes with /rdb under Coherent is rather brief, so you should consider this book (costs $40) as a mandatory part of the program. The price is obviously low for Coherent. For other versions of UNIX it costs between $795 and $2495. Consequently, you get the same bargain as when you bought Coherent. /rdb is also available under MS-DOS (called \rdb), inside an environment called MKS Toolkit. This is a set of programs that gives you an impression of having UNIX on your PC. You can buy MKS Toolkit and \rdb as one product for 429. Textbox: Facts /rdb is sold by Robinson Shaffer Wright 131 Rathburne Way, Santa Cruz, 95062 CA USA (Textbox "Intro to AWK" left out of translation). - -------------------------------------------------------------------- Anders Fongen BIX : afongen Vallerveien 57E INET: anders@fongen.uu.no N-1344 HASLUM USENET: ...uunet!fongen.uu.no!anders NORWAY tlf: +47-2-530505 - -------------------------------------------------------------------- ------------------------------ Date: Wed, 16 Jan 91 16:30 EST From: NMILLER@vax1.trincoll.edu To: coherent Subject: deleting Coherent I've decided to run Coherent on its own machine. In trying to reformat the partition it has occupied on my hard disk, I find it impossible to get rid of that small portion which pops up on the screen on booting up. It doesn't take up any space to speak of, but because I'm curious--how do I get rid of that protected area? Norman Miller ------------------------------ Date: 17 Jan 91 00:32:21 From: Gary Clark <gbdata!root@uwm.edu> To: coherent Subject: news and others... First question: I've got bootstrap news running here. Has anyone got the poster to work yet? If so could you either post your methods or email me and I will post a summary if there is interest in it. Second question: Does anyone know how Coherent running on a PC class platform compares to the older machines (e.g. PDP-11's, 3B1's) on what it can run and cannot run? (I'm talking about just not able to run, such as a program that just has to have large spaces) Third and last question: Has anyone else had problems running the pcmail on the the MWC bbs? It would tell me about a memory allcation error, core dump then lock up on me! Plus other minor problems.. Thanks Gary Gary Clark | root@gbdata.mixcom.com GB Data Systems | root%gbdata@uunet.uu.net Houston, Texas, USA | ...!mixcom.com!gbdata!root My views are the views of my company, considering I own it!... ------------------------------ Date: 15 Jan 91 11:56:40 From: mwc!fwb@uunet.UU.NET (Fred (We need a Sequent) Butzen) To: cohmail@uunet.UU.NET Cc: hal@uunet.UU.NET Subject: Response to Mr. Miller's questions Dear Mr. Miller, Thank you for your message. We'll try to answer your queries to your satisfaction. 1. You ask about multitasking. In part the answer is irrelevant, because your COHERENT system is already performing multitasking: type the command "ps -alx" and you'll see that your computer is already executing many processes, most of them without your knowing about it. To multi-task yourself, just type a command name, followed by an ampersand `&'. This will execute the command "in the background", and let you run another task "in the foreground". Note that some tasks (e.g., editors) should not be run in the background, and others (e.g., "ls") execute so quickly that there's no point in doing so, but many (such as UUCP commands or compiles) should be done in the background so you can carry on with your work. 2. Internal modems present a host of difficulties. Send us the name and make of yours, and we'll see what can be done. 3. You ask what it means to link /dev/dos to "the most commonly used device name". You are right, this phrase assumes more knowledge than many users have. Well ... to be brief: "Linking" means that the same file can be known by two or more names. Internally, COHERENT knows each file not by its name but by a unique number; any number of names can be associated, or "linked", to that number. When all "links" to a file are erased, then the file is removed from disk. "/dev/dos" is a file that the "dos" command accesses by default to read data. You should link this file to the device that you most commonly use with the dos command. COHERENT does not do this by default, because some users most often use the dos command to read files from the MS-DOS partition on their hard disks, whereas others use it to read one of the many varieties of floppy disk drives. To link two files, use the "ln" command, as described in the Lexicon. For a list of the devices used with your hard disk, see the entry for "at" (the device driver, not the command); for a list of the devices used with floppy disk drives, see the Lexicon entry for "floppy disks". 4. You ask about password protection on your COHERENT system. If you are certain you will be the only person to use your system, then no, you don't need to assign passwords to the superuser or yourself. If anyone else will use it -- that that includes remote systems contacted via UUCP -- then it would be extremely imprudent for you not to employ password protection. Password protection takes only a few seconds to implement and to use, and it can make an enormous difference to the integrity of your system. uunet!mwc!fwb ------------------------------ Date: 18 Jan 91 00:53:39 From: mhm!root@uop.uop.edu (Mohd H. Misnan) To: coherent@uop.edu Subject: Help on new uux, uuxqt and other stuffs Hi all, I had tried to install new uux and uuxqt but without any success. Do I need to make the owner and group to uucp or it is fine if I just leave the owner as root? I do change the mod by chmod 6401 to both of them. May be uux is OK when I change the ownership and group to uucp but not uuxqt. My incoming mail always end up at /usr/spool/uucp/uop without distributed to the owner. Who have succesfully installing PC-MAIL? I don't know how to configure the configuration. Do we need to that again after what we have when the first time we installed uucp? How about comb? I like its user interface but it always give me core dump. I don't know why this happened. It also won't give you read your mail, everytime I tried to read incoming e-mail, it show it too fast (I barely can read it that fast!!!). I know, everybody are now concentrated on what happens in middle east (War...!). Sorry guys to intterupt you with my problems. Thanks for any help. Hamid +---------------------------+-------------------------------------+ | Mohd H. Misnan | UUCP: mhm!{root|hamid}@uop.uop.edu | | 810, West Stadium Dr #6 | INET: hmisnan@madvax.uop.edu | | Stockton, CA 95204. | hamid@uop.uop.edu | +---------------------------+-------------------------------------+ ------------------------------ Date: Fri Jan 18 19:52:21 1991 From: Bill Henning <bhenning@bhami.wimsey.bc.ca> To: coherent Subject: Coherent 3.1 Well, I finally received Coherent 3.1 on Monday, and after backing up my hard drive, I installed it. Some observations: (for MWC) - - I could not get Coherent to boot from partition 5 (i.e. the second partition on drive 2) - - Catching the bootblock's attention with a digit is difficult - you have to get the timing JUST right. - - I backed up the distribution copies, but reads were very slow (and so was the installation) - are the floppy disks interleaved? - - compress needed a work file most of the time, it could not access /dev/ram1 for some reason for some files - - the man macro package is not very compatible with other man macros. - - The Tricom MEGA1024 1Mb SVGA card is compatible with Coherent (it is an Orichid ProDesigner+ compatible card) Some suggestions: (for MWC) - - a source level debugger for C? Please? - - allowing cc to store its temporary files on a ram disk - - print a message and wait 2 sec for boot partition number - - a 'setboot partition_num' utility, it could be dangerous to use fdisk (dos,coherent) to keep switching active partitions - Murphy would strike - - a 'hard logout' key - say CTRL-ALT-END that logs out the invoking user out, in case his console process crashed as using reset could be dangerous - - some way to assign relative priorities to jobs - a 'nice' utility at the very least. - - a better/more advanced shell - - virtual terminal support - - support for BSD sockets - - replace scat Some questions: (for MWC) - - Does the kernel cache any data read from the hard disk? running a make or other disk intensive job thrashes the disk like crazy, especially if several tasks compete for the disk. - - Is at.c the actual driver liked with the Coherent kernel? I may write a new one (or modify the old one) - by the way nice job on the driver kit, and the comments in the sources are much appreciated. Some musings: (for the mailing list) - - I've almost managed to get sc41 running. It is not stable yet, but when it is I'll put it up on piggy. I keep getting segmentation violations after moving the cursor around enough. Some problems: (for the mailing list) - - I'm having problems with Clam-141 (off piggy). I keep getting a 'bad termcap entry', and after typing one or two commands (which it does not execute) it logs out. - - I clobbered /usr/include/dirent.h when I was installing the libndir package. Should I re-install the original Coherent version? Some compliments: (for MWC) - - VERY nice documentation. The lexicon is a bit terse in places, but the layout, typesetting, indices, etc. are excellent. - - The device development kit is also well done. The example sources are most helpful. - - Easy installation. - - me is quite nice for smaller files - - A very impressive package for the price. Well worth $99US. I am very much looking forward to the 386 specific release. - -- +-----------+----------------------------------------------------------------+ | Amiga// | UUCP: bhenning@bhami.wimsey.bc.ca /* preferred address */ | | 1000// | -or- uunet!van-bc!bhami!bhenning | | \\ // | -or- uunet!wimsey!bhami!bhenning | | \X/bhami | | +-----------+----------------------------------------------------------------+ ------------------------------ Date: 18 Jan 91 10:51:03 From: mwc!hal@uunet.UU.NET (Hal Snyder) To: cohmail@uunet.UU.NET Subject: AMI Drive Type 47 For any customers with COHERENT 3.1.0 who are having trouble installing on a system with AMI BIOS and drive type 47 ("user installed") - we have a modification to the installation procedure which will probably solve the problem. Please contact MWC technical support. Mark Williams Tech. Support (708)-291-6700 (voice) uunet!mwc!support (708)-291-6750 (fax) ------------------------------ Date: Sat, 19 Jan 91 13:51:14 CST From: rosevax.rosemount.com!grante%rutgers.UUCP@spool.cs.wisc.edu (Grant B. Edwards) To: coherent@spool.cs.wisc.edu Subject: Also having problems w/ Clam-141 bhenning says: > Some problems: (for the mailing list) > > - I'm having problems with Clam-141 (off piggy). I keep > getting a 'bad termcap entry', and after typing one or > two commands (which it does not execute) it logs out. I've had exactly the same experience -- Clam complains about the termcap entry, then dies after one or two ignored commands. It leaves the terminal in raw noecho mode and sometimes seems to crash the console device completely. It didn't seem to matter if the extra field had been added to the termcap entry or not. If anybody has any hints, I'd appreciate the help. (I had no trouble with the previous version of Clam from piggy, and have been using it for a couple months.) > - I've almost managed to get sc41 running. It is not stable Just for curiosity's sake, what is sc41? And now for something completely different... Does anybody know where I can get the sources for the Coherent port of less? I find it's habit of clearing the screen on exit very annoying and would like to change that. Grant Edwards Rosemount Inc, CB7 He who dies with 12001 Technology Drive grante@hydro.rosemount.com the most manuals Eden Prairie, MN 55344 uunet!rosevax!hydro!grante wins. ------------------------------ End of Coherent Digest Vol. 91.1, No. 5 *************************************** -- Scott Rose rose@cs.wisc.edu