portsnap

jb jb.1234abcd at gmail.com
Wed Nov 21 21:45:04 UTC 2012


Robert Bonomi <bonomi <at> mail.r-bonomi.com> writes:

> 
> 
> > From: jb <jb.1234abcd <at> gmail.com>
> > Subject: Re: portsnap
> > Date: Wed, 21 Nov 2012 10:43:30 +0000 (UTC)
> >
> > So, the manual for portsnap(8) is imprecise, actually unfortunate because 
> > misleading.
> 
> The manual/ manpage for portsnap(8) and its use of 'command' is precise
> *and* entirely consistant with roughly 40(!!) years of Unix documentation
> history.  (see, for instance, the 'mt' manpage, which existed before
> 6th Edition Unix.)
> 
> And, of course, if one follows/accepts jb's "reasoning", that which follows
> the '-c' parameter on a shell invocation is not a command.
> nor is that which follows '-exec' on a 'find' invocation.
> nor is that which follows the 'exec' command.
> `
> *snicker*

How come ?

According to sh(1):
sh ... -c string ...
The -c option causes the commands to be read from the string operand.
Example:
- non-executable string argument
  $ sh -c "test1"
  test1: not found
- executable string argument, thus a command
  $ sh -c "echo test1"
  test1

According to find(1):
find ... expression ...
The expression is composed of "primaries" and "operands":
     -exec utility [argument ...] ;
             True if the program named utility returns a zero value as its
             exit status.  Optional arguments may be passed to the utility.
     -exec utility [argument ...] {} +
Well, that "utility" represents a program, thus a command.
Example:
- non-executable utility
  $ find . -type f -exec fakeutility {} \;
  find: fakeutility: No such file or directory
  ...
    OMG ! CAN YOU SEE THIS ?! 
- executable utility 
  $ find . -type f -exec echo {} \;
  ./.cshrc
  ...

According to bash(1):
$ type exec
exec is a shell builtin
$ help exec
exec: exec ... command [arguments ...] ...
    Replace the shell with the given command.
Example:
- non-executable string (non-command)
  $ exec fakecommand
  bash: exec: fakecommand: not found
- executable string (command)
  $ exec touch test-exec.file
  $ ls -al test*
  -rw-r--r--  1 jb  jb  0 Nov 21 22:37 test-exec.file

The examples you gave are about executable commands by themselves, and that's
what their documentations (man pages) truthfully state.
No Mickey Mouse here.

This is not the same what portsnap(8) does:
portsnap ... command ...
This "command" word is non-executable by itself; it has a meaning only as
a special word passed to portsnap command to tell it what to do internally,
just a kind of special indicator to be used for conditional processing:
if arg=fetch then do-fetch-routine
else if arg=update then do-update-routine
else ....

Well, being a liar is an honorable trait :-)
jb









More information about the freebsd-questions mailing list