The problem comes from
StreamNative.cpp
const char *StreamInfo::streamOpen(const char *options)
When the O_WRONLY flag is set, ooRexx tries read-write first,
but does not fallback to write-only in case of failure (limited to device)
After replacing the test isDevice() by true, the open is ok, but...
another problem in this method, when testing if the last character is
ctrl_z.
Since the handle is write-only, the attempt to read the last character
fails and notReadyError is called.
Fixed by not testing if ctrl_z when write-only.
The same workaround for ctrl_z must be done in
StreamInfo::implicitOpen
StreamInfo::handleOpen
Tested under MacOs, looks good.
Not tested under Linux or Windows.
Not sure if I break something by not testing ctrl_z... For me, ctrl_z is
Windows specific, no ? is the write-only mode supported under Windows ?
Jean-Louis
---------- Forwarded message ----------
From: <jfauc...@users.sourceforge.net>
Date: 2011/11/11
Subject: [Oorexx-svn] SF.net SVN: oorexx:[7286]
sandbox/jlf/trunk/interpreter/streamLibrary/ StreamNative.cpp
To: oorexx-...@lists.sourceforge.net
Revision: 7286
http://oorexx.svn.sourceforge.net/oorexx/?rev=7286&view=rev
Author: jfaucher
Date: 2011-11-11 16:04:41 +0000 (Fri, 11 Nov 2011)
Log Message:
-----------
A possible fix for bug 3274050 (to discuss on the dev list)
Modified Paths:
--------------
sandbox/jlf/trunk/interpreter/streamLibrary/StreamNative.cpp
Modified: sandbox/jlf/trunk/interpreter/streamLibrary/StreamNative.cpp
===================================================================
--- sandbox/jlf/trunk/interpreter/streamLibrary/StreamNative.cpp
2011-11-11 04:23:38 UTC (rev 7285)
+++ sandbox/jlf/trunk/interpreter/streamLibrary/StreamNative.cpp
2011-11-11 16:04:41 UTC (rev 7286)
@@ -632,6 +632,8 @@
// position at the end, and set the write position
setPosition(size(), charWritePosition);
+ if (!write_only)
+ {
char char_buffer;
size_t bytesRead;
// read the last character of the buffer.
@@ -651,6 +653,7 @@
/* explicitly set the position */
setPosition(charWritePosition, charWritePosition);
}
+ }
}
lineWritePosition = 0;
lineWriteCharPosition = 0;
@@ -793,6 +796,8 @@
// position at the end, and set the write position
setPosition(size(), charWritePosition);
+ if (!write_only)
+ {
char char_buffer;
size_t bytesRead;
// read the last character of the buffer.
@@ -812,6 +817,7 @@
/* explicitly set the position */
setPosition(charWritePosition, charWritePosition);
}
+ }
}
// set default line positioning
lineWritePosition = 0;
@@ -2384,7 +2390,8 @@
{
// if this is some sort of device, it might be output only (i.e., a
// printer). Try opening again write only
- if (fileInfo.isDevice())
+ // bug 3274050 : no longer limited to device, a regular file can
have write-only permissions
+ if (true /*fileInfo.isDevice()*/)
{
if (!open(WR_CREAT, S_IWRITE, shared))
{
@@ -2428,6 +2435,8 @@
// position at the end, and set the write position
setPosition(size(), charWritePosition);
+ if (!write_only)
+ {
char char_buffer;
size_t bytesRead;
// read the last character of the buffer.
@@ -2447,6 +2456,7 @@
/* explicitly set the position */
setPosition(charWritePosition, charWritePosition);
}
+ }
}
/* set default line positioning */
lineWritePosition = 0;
This was sent by the SourceForge.net collaborative development platform,
the world's largest Open Source development site.
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Oorexx-svn mailing list
oorexx-...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-svn
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel