bug-inetutils
[Top][All Lists]
Advanced

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

Re: [bug-inetutils] Test script tooling.


From: Mats Erik Andersson
Subject: Re: [bug-inetutils] Test script tooling.
Date: Tue, 13 Mar 2012 22:58:34 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

(Creating a separate thread of sensible subject.)

tisdag den 13 mars 2012 klockan 15:12 skrev Alfred M. Szmidt detta:
>    diff --git a/configure.ac b/configure.ac
>    index 017d0ac..14dd6e3 100644
>    --- a/configure.ac
>    +++ b/configure.ac
>    @@ -129,6 +129,9 @@ AC_ISC_POSIX
>     AC_PROG_CC
>     gl_EARLY
>     AC_CHECK_TOOL(AR, ar)
>    +AC_PATH_PROG(DD, dd, dd)
>    +AC_PATH_PROG(MKTEMP, mktemp, mktemp)
>    +AC_PATH_PROG(NETSTAT, netstat, netstat)
> 
> What about if those are missing?  The third argument is the value when
> the program could not be found, so I would think that using the
> `missing' script would be appropriate here.

Are you imagining

   AC_PATH_PROG(NETSTAT, netstat, [$(SHELL) `pwd`/../build-aux/missing --run 
netstat])

My use of AC_PATH_PROG is to calculate the directory path [sic!] above
the file name [sic!] for the intended utility. Should it be missing,
the plain string is used, like "NETSTAT=netstat", thus producing a better
error message than

   AN_PROG_PATH(NETSTAT, netstat, false)

would ever achieve. AM_MISSING_PROG is clearly not desireable to
locate a utility with an absolute path.

>     AC_PATH_PROG(RM, rm, rm)
>     AC_PROG_CPP
>     AC_PROG_INSTALL
>    @@ -136,8 +139,13 @@ AC_PROG_MAKE_SET
>     AC_PROG_RANLIB
>     AC_PROG_YACC
>     AC_PROG_LN_S
>    +AC_PROG_SED
>     AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
>    -
>    +AC_ARG_VAR(GREP, [Preferred grep(1) utility.])
>    +AC_ARG_VAR(SED, [Preferred sed(1) utility.])
>    +AC_ARG_VAR(DD, [Path to dd(1).])
>    +AC_ARG_VAR(MKTEMP, [Path to mktemp(1).])
>    +AC_ARG_VAR(NETSTAT, [Path to netstat(8).])
> 
> Please say `file name' (two words) instead of path, a path in GNU is a
> search list, e.g. PATH, LD_LIBRARY_PATH, etc.  I'd skip the (8) stuff,

We have had this discussion before. In any human understanding the file name
(Datei) is the leaf name written into the file used by an operating system
to record the contents of a directory (Verzeichnis). The directory traversal
names are not included in that string. I find the FSF/GNU use to be contrived,
close to contrafactive. How about "absolute path" as compromise?

    AC_ARG_VAR(NETSTAT, [Absolute path to `netstat'.])

>    diff --git a/tests/tools.sh.in b/tests/tools.sh.in
>    new file mode 100644
>    index 0000000..a18a16d
>    --- /dev/null
>    +++ b/tests/tools.sh.in
>    @@ -0,0 +1,16 @@
>    address@hidden@
>    address@hidden@
>    address@hidden@
>    address@hidden@
>    address@hidden@
>    +
>    +# Some Solaris variants provide id(1) lacking `-u' switch.
>    +# Work around this by some computation.
>    +
>    +func_id_uid () {
>    +  id $1 | $SED -n 's,.*uid=\([0-9]*\).*,\1,p'
>    +}
>    +
>    +func_id_user () {
>    +  id $1 | $SED -n 's,.*uid=[0-9]*(\([^)]*\).*,\1,p'
>    +}
> 
> Would it maybe be better to provide a wrapper around id instead? So
> that `id -u' always works (or $ID).  I'm thinking something along the
> lines of,

Autoconf uses the identifier ID for a completely different purpose.

> id()
> {
>   case $1 in
>     -u) if id_without_u_p; then
>           command id $1 | $SED -n 's,.*uid=\([0-9]*\).*,\1,p'
>         fi
>       break
>     default)
>       command id -u
>   esac
> }

Excessively complicated, without any gain whatsoever. My use is

  if test func_id_uid != 0; then
    do_test_with_prio=false
  fi

Regards,
  Mats



reply via email to

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