[Rd] bug + insufficient doc in R CMD INSTALL (PR#5703)

dpierce at ucsd.edu dpierce at ucsd.edu
Thu Dec 11 19:34:00 MET 2003


Hello,

I believe I have found a bug in the R INSTALL script
(src/scripts/INSTALL.in). The problem comes up when a user tries to
specify more than one "--config-args" (or, I imagine, "--config-vars") on
the R CMD INSTALL line. In such a case, no error message is generated, but
the first specification is silently overwritten by the second
specification.  The process therefore fails.

So for instance, a user contacted me after typing this:

R CMD INSTALL
--configure-args=-with-netcdf_incdir=/usr/local/netcdf/include
--configure-args=-with-netcdf_libdir=/usr/local/netcdf/lib ncdf_1.1.tar.gz

and it failed (they contacted me because I'm the maintainer of the ncdf
package).

I would say that this is both a bug and something that needs more
documentation.  It's a bug because it accepts the incorrect line without
giving an error message, but does not parse it "as expected."  And I would
say it needs more documentation because I looked through the R docs on
this, and could find no place where the correct syntax is given.  You
probably already know (I didn't), but the syntax should be this instead:

R CMD INSTALL
--configure-args="-with-netcdf_incdir=/usr/local/netcdf/include
-with-netcdf_libdir=/usr/local/netcdf/lib" ncdf_1.1.tar.gz

and, of course, although I'm using the ncdf package as an example for
concreteness, this is a general problem for any R package.

The place in INSTALL.in that seems to be problematic is this bit:

----------------------------------
configure_args=
configure_vars=
with_package_versions=false
save="CHECK"
save_args=
fake=false

while test -n "${1}"; do
  case ${1} in
    -h|--help)
      echo "${usage}"; exit 0 ;;
...skip stuff...
    --configure-args=*)
      configure_args=`echo "${1}" | sed -e 's/[^=]*=//'` ;;
    --configure-vars=*)
      configure_vars=`echo "${1}" | sed -e 's/[^=]*=//'` ;;

---------------------------------

It seems pretty clear that if multiple --configure-args are given on the
command line, they are silently overwritten.

One possible fix is to check and make sure the configure_args variable is
empty before setting it, as follows:

-----------------------------------

    --configure-args=*)
      if test x${configure_args} != x; then
        echo "INSTALL: command line error: only one --configure_args
argument can be given.  To specify multiple args to the configure
script, put them in quotes, separated by a space, like this:
--configure_args=\"--config_arg_1 --config_arg_2\""
        exit 1
      fi
      configure_args=`echo "${1}" | sed -e 's/[^=]*=//'` ;;
    --configure-vars=*)
      if test x${configure_vars} != x; then
        echo "INSTALL: command line error: only one --configure_vars
argument can be given.  To specify multiple vars to the configure
script, put them in quotes, separated by a space, like this:
--configure_vars=\"--config_vars_1 --config_vars_2\""
        exit 1
      fi
      configure_vars=`echo "${1}" | sed -e 's/[^=]*=//'` ;;

-------------------------------------

Another option would be to concatenate multiple --configure-args arguments
... I imagine it's your call on which way to go.

Regards,

--Dave

---------------------------------------------------------------
David W. Pierce        / Climate Research Division
Scripps Inst. Oceanog. / (858) 534-8276 (voice)
dpierce at ucsd.edu       / (858) 534-8561 (fax)



More information about the R-devel mailing list