Full_Name: Gordon Lack Version: 2.4.0 OS: OSF1 v5.1 Submission from: (NULL) (198.28.92.5) 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. 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: ${1+"$@"} (ie: if there is a $1, add quoted $@, else do nothing) on the THREE occurrences of "${@}"
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) (198.28.92.5) > > > 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 place.> 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 double-quoted. 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
Prof Brian Ripley wrote:>> >> 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 place.The 2.2.0 usage only came into play if CMD was on the command line, and there would then be a following parameter, so "${@}" contained something. At 2.4.0 this has been appended to 2 further lines in circumstances where it can easily be empty.>> 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 > > [http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_05_02] > > Note the declarative 'shall' there.Agreed, but that definition was post-dated. Many systems behaved differently before that was written.> Further, Solaris has a genuine Bourne shell from the AT&T source code > base, and it is both documented and behaves as this quotation.I'll agree it works (Sol8, Sol9 and Sol10), but it isn't documented in the sh man page.> 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.Using ${1+"$@"} is POSIX compliant also, and has the advantage of working everywhere. See: http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_02