Safe coding practices (was Re: Bug in users command)

Scott Schwartz schwartz at groucho.cs.psu.edu
Wed Jan 30 15:58:04 AEST 1991


barmar at think.com (Barry Margolin) writes:
| I agree with this most emphatically.  The kind of software design Mr.Manson
| is complaining about is rampant in the industry, and pervades Unix.  Most
| programmers learn software design by example.  Sometimes this is good, when
| a good programming style (e.g. programs that filter stdin to stdout) is
| mimicked, but it also propogates poor programming practices.  When I talk
| about the "brokenness" of Unix, it's this kind of stuff I'm thinking of.

Part of the problem is that the standard libraries most systems supply
are flawed in various ways.  In stdio, ``gets'' leaps to mind.
Moreover, ``fgets'' imposes an upper bound on input length, so lots of
programs inherit that flaw.  In V10 the fast io library imposes a
fixed length (not even user selectable) on lines that ``Frdline'' will
return.  Happily, Chris Torek's new 4.4BSD stdio provides a way to
read lines of any length using ``fgetline''.  The only problem with
that is that there is no general mechanism to read arbitrarily long
tokens -- fgetline should either take a user supplied delimiter, or
there should be a separate routine (fgettoken?)  to do the job.  Now's
that time to fix this, before 4.4BSD really hits the streets.

| I'm biased, because I do much of my programming in Lisp, which
| makes it easy to write programs with few arbitrary limits.

I'd kill for a scheme compiler that was suitable for writing systems
programs.



More information about the Comp.bugs.4bsd.ucb-fixes mailing list