From skostysh at princeton.edu  Sat Sep 20 14:53:15 2014
From: skostysh at princeton.edu (Scott Kostyshak)
Date: Sat, 20 Sep 2014 08:53:15 -0400
Subject: [Rd] [patch] Rscript off-by-one error in output
In-Reply-To: <CAE3=dmcnUbQeUmM5b7s_1Aj8H6BcQPkLam=6-nRsVAEkSwnx=w@mail.gmail.com>
References: <CAE3=dmcnUbQeUmM5b7s_1Aj8H6BcQPkLam=6-nRsVAEkSwnx=w@mail.gmail.com>
Message-ID: <CAE3=dmeAbgdvm8kKFjte9-6Y_LaKgQ-jKZ7j7DrQ4dJJusFzyA@mail.gmail.com>

On Wed, Jul 9, 2014 at 7:26 PM, Scott Kostyshak <skostysh at princeton.edu> wrote:
> Rscript eats up the last argument when reporting the command it runs:
>
> $ Rscript --verbose "/tmp/test.R" one two three
> running
>   '/usr/local/lib/R-devel/lib/R/bin/R --slave --no-restore
> --file=/tmp/test.R --args one two'
>
> With the patch below, I get the following:
>
> $ Rscript --verbose "/tmp/test.R" one two three
> running
>   '/usr/local/lib/R-devel/lib/R/bin/R --slave --no-restore
> --file=/tmp/test.R --args one two three'
>
>
> Index: src/unix/Rscript.c
> ===================================================================
> --- src/unix/Rscript.c  (revision 66100)
> +++ src/unix/Rscript.c  (working copy)
> @@ -249,7 +249,7 @@
>  #endif
>      if(verbose) {
>   fprintf(stderr, "running\n  '%s", cmd);
> - for(i = 1; i < ac-1; i++) fprintf(stderr, " %s", av[i]);
> + for(i = 1; i < ac; i++) fprintf(stderr, " %s", av[i]);
>   fprintf(stderr, "'\n\n");
>      }
>  #ifndef _WIN32
>
>
> Scott
>
>
>> sessionInfo()
> R Under development (unstable) (2014-07-08 r66100)
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> locale:
>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>  [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
>
> --
> Scott Kostyshak
> Economics PhD Candidate
> Princeton University

For archival purposes, this was fixed at r66644.

Scott


--
Scott Kostyshak
Economics PhD Candidate
Princeton University



[Rd] [patch] Rscript off-by-one error in output
Scott Kostyshak