[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Support for (system '("echo" "foo" "bar"))

From: Greg Troxel
Subject: Re: Support for (system '("echo" "foo" "bar"))
Date: 29 Oct 2003 08:58:02 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

This violates the Principle of Least Astonishment.  In guile we have a
lot of procedures that are essentially just the 'obvious'
scheme-wrapped versions of system calls and libc functions.

system(3) (on NetBSD, which claimes conformance with ANSI X3.159-1989
(``ANSI C'') and IEEE Std 1003.2-1992 (``POSIX.2'')), is specified to
use sh(1).

POLA to me says that system with a list of strings would append them
with spaces and then behave as if it had been called with that single
string.  This means /bin/sh, with globbing, file redirection, and
multiple commands, not the simpler exec treatment.

That said, a procedure to encapsulate the safer fork/exec/wait process
would be very nice.

So IMHO another name is warranted, and system* as already suggested
seems good, since it hints that it isn't really system(3), but
something else that is similar.

Also, it might be nice to have environments with system* but not
system (as a kind of 'safe environment').  A good case can be made
that system(3) should not be used, except perhaps with constant
strings - certainly not with unchecked user input.

Is it important/useful to you to have the extended functionality have
the same name?

        Greg Troxel <address@hidden>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]