automake
[Top][All Lists]
Advanced

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

Re: `missing' needs patch for Ultrix4.4


From: Jim Meyering
Subject: Re: `missing' needs patch for Ultrix4.4
Date: 19 Mar 2001 10:38:19 +0100
User-agent: Gnus/5.090001 (Oort Gnus v0.01) Emacs/21.0.101

Akim Demaille <address@hidden> wrote:

| | Alexandre Oliva <address@hidden> wrote:
| | | On Mar 17, 2001, Jim Meyering <address@hidden> wrote:
| | |
| | | >         * missing (--run): Use `eval' to run `"$@"'.  Otherwise, 
Ultrix4.4's
| | | >         /bin/sh fails and outputs garbage.
| | |
| | | Won't this evaluate the arguments one too many times?
| |
| | Thanks!  You're right.
| |
| | | How about:
| | |
| | | prog=$1
| | | shift
| | | $prog ${1+"$@"} && exit 0
|
| I was about to suggest the same.
|
| | But wouldn't that'd have the same problem, in the unlikely event
| | that $1 contains shell meta-characters.  How about this instead?
|
| Given that "$@" is expected to be valid a valid shell command, there
| should be no new problems, "$@" takes everything in charge.  In
| addition, the idiom above is very common, so it must be sound.

IMHO, it is always best to `do it right'.
Evaluating `$1' one extra time is probably just fine
for all current uses of `missing --run PROG_AND_ARGS',
but someone may well have to use it on a program whose
name contains spaces.  We shouldn't prohibit that.

Here's an example showing the difference.
With my latest suggested change it works:

  $ echo '#!/bin/sh' > 'cat file'
  $ chmod a+x !$
  chmod a+x 'cat file'
  $ PATH=$PATH:. sh missing --run 'cat file'

With what Alexandre suggested, it fails:

  $ PATH=$PATH:. sh missing --run 'cat file'
  cat: file: No such file or directory
  WARNING: `' is needed, and you do not seem to have it handy on your
           system.  You might have modified some files without having the
           proper tools for further handling them.  Check the `README' file,
           it often tells you about the needed prerequirements for installing
           this package.  You may also peek at any GNU archive site, in case
           some other package would contain this missing `' program.
  [Exit 1]



reply via email to

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