From jsmith at harmonia.com  Tue May 20 17:02:11 2014
From: jsmith at harmonia.com (James Smith)
Date: Tue, 20 May 2014 15:02:11 +0000
Subject: [Rd] Question about fifo behavior on Linux between versions 3.0.3
 and 3.1.0
Message-ID: <e6d2f60d8be44752bfc7b0e2ee0e8e78@BY2PR01MB089.prod.exchangelabs.com>

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



[Rd] Question about fifo behavior on Linux between versions 3.0.3 and 3.1.0
James Smith