[mod.unix] Unix Technical Digest V2 #11

netnews@wnuxb.UUCP (Heiby) (06/19/85)

Unix Technical Digest       Wed, 19 Jun 85       Volume  2 : Issue  11

Today's Topics:
                           make and include
                       not enough core (2 msgs)
                   Problems with make & sh (4 msgs)
----------------------------------------------------------------------

Date: Wed, 5 Jun 85 19:05:27 edt
From: packard!harvard!macrakis (Stavros Macrakis)
Subject: make and include

The difficulties with `make' and `include' stem from one of Unix's
fundamental flaws, namely the dependence on strictly syntactic
mechanisms such as textual substitution for solution of semantic
problems.  To show what I mean, I will use as an example the Ada
mechanisms.

Goal			Syntactic mechanism	Ada mechanism

Resource sharing	include			with
Constants		define			constant definitions
Inline subroutines	define			pragma inline


The implication is that, if you want to stay within Unix, rather than
try to patch `make', one ought to define higher-level conventions and
tools to process them.

------------------------------

Date: Thu, 13 Jun 85 00:07:57 PDT
From: sun!guy (Guy Harris)
Subject: not enough core

> 	When our 4.2 bsd 11/750 is heavily loaded, we often get "not
> enough core" messages from the shell when trying to run a program.
> However, when I run vmstat, and ps, I often see relatively small amounts
> of active virtual memory and large amounts of free memory.

Under 4.2BSD, whenever you do an "exec", or increase your data segment size,
or do a "fork", the system tries to allocate swap space for the new
data+stack segment; if it fails, either the system call returns ENOMEM or,
if it's not at a place where it's convenient to return an error, just blows
your process away with SIGKIL.  Other version of UNIX do something similar.
4.2BSD uses swap space rather prodigiously.  On paging systems you aren't
likely to get told you're running out of primary memory; the symptom of
running out of primary memory is reduced performance.

I'm all too familiar with this; I lost four pieces of mail because my
machine ran out of swap space when trying to run "/bin/mail" to deliver the
message.  I run EMACS, too, and it certainly eats its share of swap space...

	Guy Harris

------------------------------

Date: Sun, 16 Jun 85 10:33:24 edt
From: Chris Torek <seismo!maryland.ARPA!chris>
Subject: not enough core

The only way to get "not enough core" errors in 4BSD is to run out of
swap space (or swap map space I guess, though I've never seen that
happen).  Real memory only determines how often you have to actually
*use* that backing store.  (Of course this isn't the *only* thing that
determines this.)

VM systems are always hungry for more disk space,
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@maryland

------------------------------

Date: 6-Jun-1985 11:30-EDT (Thursday)
From: masscomp!leiby
Subject: Problems with make & sh

>From: allegra!phri!roy (Roy Smith)
>
>	I'm trying to make make an ADC for a library.  The idea is to
>have a list of source modules, grep each module for 'include' lines and
>then run the grep output through sed and awk to put it in the right
>format.
>	The problem is with modules that don't have any includes; grep
>exits with status 1 which causes make to die.  

Try grepping for #include in all the files at once:

	egrep #include ${MODULES} /dev/null > ${TMPFILE}

This will produce output in ${TMPFILE} in the format

	modulename:#include <foobar>

which you can then massage any way you want.  Two short notes about
using this method: (1) it uses egrep, which is faster, and (2) it 
specifically asks to check /dev/null, so that even if ${MODULES} 
denotes a single file you'll still get the modulename in the output.

--
Rt. Rev. Mike Leibensperger, Archbishop of Chelmsford
Church of St. Clint the Righteous  ("Feel lucky, Pink Boy?")
Masscomp; 1 Technology Park; Westford, MA 01886
{decvax,harpo,tektronix}!masscomp!leiby

------------------------------

Date: Fri, 7 Jun 85 11:21:52 pdt
From: allegra!fluke!joe
Subject: Problems with make & sh

The problem with make and sh -e on 4.2 systems is a bug in sh.  About 6 
months ago, I posted a fix to this problem to all apropriate newsgroups.
If you have sources, the bug is in sh.xec.c, and what you have to do is
to save the state of the -e flag during the execution of the conditional
part of if's and while's.  It is a relatively easy fix once you stare
at the code for a while.  I did send this bug to Berkeley, but who knows
whether it will be in 4.3 or not.

Anyone wanting a diff can request it via mail.

/Joe

------------------------------

Date: Mon, 10 Jun 85 05:29:41 EST
From: seismo!munnari!basser.oz!john
Subject: Problems with make & sh

I am at a loss to understand why your problem happens.  A well-known
(and documented) feature of the shell is that the exit status of
a pipeline is the exit status of the last command.  Thus, the
exit status of your grep shouldn't ever be seen by make, -e or no -e.
No doubt this is just another thing that is broken in 4.2BSD, though.

However, you ask how you can turn the -e flag off, and note that "-=''"
won't work (which is quite correct).  You can turn any flag off or on
at any time under sh by using the "set" builtin.  "set -e" will turn
it on, as if the shell had been invoked with it; and "set +e" will
turn it off.  (Unless Berkeley have broken it, of course...)

------------------------------

Date: Fri, 14 Jun 85 04:51:54 edt
From: clyde!watmath!utcsri!garfield!dalcs!forceten (ForceTen Enterprises)
Subject: Problems with make & sh

    Make will not terminate on non-zero status if the pseudo target
.IGNORE is defined (affects entire Makefile), or if the line begins
with <tab><hyphen>, as in this example. The .IGNORE target is the
same as running the command with "make -i".

#
# Sample Makefile
#
all:
	-false
	echo "Still going"
	false
	echo "This will not print"

    I don't know if any method exists to get rid of the nasty messages
make insists on printing even when "ignoring" the non-zero status,
however.

				Neil Erskine

------------------------------

End of Unix Technical Digest
******************************
-- 
Ronald W. Heiby / netnews@wnuxb.UUCP | unix-request@cbosgd.UUCP
AT&T Information Systems, Inc., Lisle, IL  (CU-D21)