Issue1576

classification
Title: files opened in 'a+' mode not readable
Type: behaviour Severity: major
Components: Core Versions: 2.5.1
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: pjenvey Nosy List: crankycoder, pjenvey
Priority: Keywords:

Created on 2010-03-19.12:41:03 by crankycoder, last changed 2010-03-21.21:48:33 by pjenvey.

Files
File name Uploaded Description Edit Remove
test_io.py crankycoder, 2010-03-19.12:41:02
Messages
msg5577 (view) Author: Victor Ng (crankycoder) Date: 2010-03-19.12:41:02
Jython's append + read operation crashes when trying to read data.

java.nio.channels.NonReadableChannelException is raised in the attached test case.

The sample script works fine under CPython 2.5.2
msg5578 (view) Author: Philip Jenvey (pjenvey) Date: 2010-03-19.16:17:48
Guessing this is a regression from 2.5, due to the fix for a better plain append mode
msg5580 (view) Author: Philip Jenvey (pjenvey) Date: 2010-03-21.17:31:24
Yes, this is indeed a regression from the O_APPEND fix in r6796 (#1466). We're now using an underlying FileOutputStream for append mode so we can force a real underlying O_APPEND mode on the file. But of course this FileOuputSTream is opened in write only mode. So in the meantime we're just going to have disable this behavior in a+ mode.

In the future we should take advantage of our jnr-posix library to open native files in whatever mode we need. Though we'd need to somehow translate that underlying file handle to a java FileDescriptor or FileChannel
msg5583 (view) Author: Philip Jenvey (pjenvey) Date: 2010-03-21.21:48:33
fixed in r6988
History
Date User Action Args
2010-03-21 21:48:33pjenveysetstatus: open -> closed
resolution: fixed
messages: + msg5583
title: append + read file i/o is not consistent with cpython -> files opened in 'a+' mode not readable
2010-03-21 17:31:26pjenveysetmessages: + msg5580
2010-03-19 16:17:49pjenveysetassignee: pjenvey
messages: + msg5578
nosy: + pjenvey
2010-03-19 12:41:03crankycodercreate