Bug 14727 - Uninitialized memory errors in file.append
Uninitialized memory errors in file.append
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: I/O
R 2.14.0
Other Linux
: P5 minor
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-11 22:26 UTC by Karl Millar
Modified: 2011-11-12 08:48 UTC (History)
0 users

See Also:


Attachments
Patch (1.18 KB, application/octet-stream)
2011-11-11 22:26 UTC, Karl Millar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Karl Millar 2011-11-11 22:26:07 UTC
Created attachment 1247 [details]
Patch

Calls to file.append() with non-readable or NA inputs or a non-writeable destination return uninitialized values.

eg:

> file.append("/", rep("", 10))
 [1]  TRUE FALSE  TRUE FALSE  TRUE FALSE  TRUE FALSE FALSE FALSE
> file.append("output", rep(NA_character_, 10))
 [1]  TRUE FALSE  TRUE FALSE  TRUE FALSE  TRUE FALSE  TRUE FALSE
> file.append("output", rep("/nosuchfile", 10))
 [1]  TRUE FALSE  TRUE FALSE  TRUE FALSE  TRUE FALSE  TRUE FALSE

I've attached a patch against current svn that fixes the issue.
Comment 1 Brian Ripley 2011-11-12 08:48:35 UTC
Fixed (in a simpler way) in 2.14.0 patched.