From ripley at stats.ox.ac.uk  Tue May 20 21:03:01 2014
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Tue, 20 May 2014 20:03:01 +0100
Subject: [Rd] Question about fifo behavior on Linux between versions
 3.0.3 and 3.1.0
In-Reply-To: <e6d2f60d8be44752bfc7b0e2ee0e8e78@BY2PR01MB089.prod.exchangelabs.com>
References: <e6d2f60d8be44752bfc7b0e2ee0e8e78@BY2PR01MB089.prod.exchangelabs.com>
Message-ID: <537BA6E5.4040301@stats.ox.ac.uk>

It _was_ part of the fifo for Windows patch.  As if does not seem to be 
needed for Windows, it has been reverted.


On 20/05/2014 16:02, James Smith wrote:
> Version 3.1.0 of R has imposed a very small data limit on writing to fifos on Linux. Consider the following R code (Assumes that "ff" is a fifo in the R process's current directory):
>
> con <- fifo("ff", "a+b")
> writeBin(raw(12501), con)
>
> In R 3.0.3, this returns without error and the data is available on the fifo. In R 3.1.0, however, this returns the following error:
>
> Error in writeBin(raw(12501), con) : too large a block specified
>
> In investigating R's source, the difference seems to be in src/main/connections.c, in the function fifo_write() (around line 932). In R 3.0.3, fifo_write() has these lines:
>
>      if ((double) size * (double) nitems > SSIZE_MAX)
> 	error(_("too large a block specified"));
>
> R 3.1.0 has these lines changed to this:
>
>      if ((size * sizeof(wchar_t) * nitems) > 50000) {
>        error(_("too large a block specified"));
>      }
>
> The change effectively places a limit of 12500 bytes on writes (since sizeof(wchar_t) == 4). Does anyone know why this change was made? I understand that fifos on Windows were implemented for R 3.1.0, but the code for fifos on Windows is in a separate part of connections.c that doesn't get compiled on Linux (i.e., the code given is Unix only). I also couldn't find any references to fifo behavior changes under Linux in any of R's documentation.
>
> My platform is Fedora 20 (64-bit) and I have built and installed R from source.
>
> Thank you for your time and consideration.
>
> James O Smith
> Harmonia Holdings Group, LLC
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>


-- 
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



[Rd] Question about fifo behavior on Linux between versions 3.0.3 and 3.1.0
Prof Brian Ripley