[Rd] Buig in bin/R script (PR#9375)

ripley at stats.ox.ac.uk ripley at stats.ox.ac.uk
Tue Nov 21 14:51:38 CET 2006

On Tue, 21 Nov 2006, gml4410 at ggr.co.uk wrote:

> Full_Name: Gordon Lack
> Version: 2.4.0
> OS: OSF1 v5.1
> Submission from: (NULL) (
> Changes to the bin/R front-end interlude script at 2.4.0 (cf: 2.2.0) have broken
> R on (Dec/Compaq/HP) OSF1.

This was not changed in 2.4.0, and indeed 2.2.0's bin/R used "${@}" in one 

> There are 3 occurrences of "${@}", but this is the incorrect syntax for adding
> $@, as on older Bourne shells this will add an empty (but present) parameter.
> The result is that the build fails while attempting to add in the Recommended
> libraries because "ARGUMENT '' __ignored__" end up on the gcc command line.
> The fix is to edit src/scripts//R.sh.in to use the correct, original Bourne
> shell syntax:

Surely this is an idiosyncracy (aka 'buig') of your OS rather than being 
'correct'?  The POSIX definition is

   @ Expands to the positional parameters, starting from one. When the
   expansion occurs within double-quotes, and where field splitting (see
   Field Splitting) is performed, each positional parameter shall expand as a
   separate field, with the provision that the expansion of the first
   parameter shall still be joined with the beginning part of the original
   word (assuming that the expanded parameter was embedded within a word),
   and the expansion of the last parameter shall still be joined with the
   last part of the original word. If there are no positional parameters, the
   expansion of '@' shall generate zero fields, even when '@' is

Note the declarative 'shall' there.

Further, Solaris has a genuine Bourne shell from the AT&T source code 
base, and it is both documented and behaves as this quotation.

Perhaps we need a workaround conditional on 'HAVE_OSF_BROKEN_SH', but I am 
not at all keen to complicate simple POSIX-compliant code unconditionally.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-devel mailing list