[ python-Bugs-931902 ] f.flush() fails on FreeBSD 5.2

SourceForge.net noreply at sourceforge.net
Fri Apr 9 12:37:05 EDT 2004


Bugs item #931902, was opened at 2004-04-08 20:20
Message generated for change (Comment added) made by hsn
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=931902&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Radim Kolar (hsn)
Assigned to: Nobody/Anonymous (nobody)
Summary: f.flush() fails on FreeBSD 5.2

Initial Comment:
Hi,
 if you open file for read-only and want to flush() it, it fails on freebsd5.2.
 It works okay on linux. If file is openned for r/w it works on freebsd.

     
f=file("/etc/passwd","r")
f.read(10)
f.flush()
f.close()

result:
(hsn at ttyv2):~% python snakeoil.py
Traceback (most recent call last):
  File "snakeoil.py", line 3, in ?
      f.flush()
      IOError: [Errno 9] Bad file descriptor


----------------------------------------------------------------------

>Comment By: Radim Kolar (hsn)
Date: 2004-04-09 18:37

Message:
Logged In: YES 
user_id=590679

I have wrote a simple program which calls fsync() on file opened for readonly. Test programs works okay (no error) on both platforms (FreeBSD and Linux). So error is not in FreeBSD5 kernel.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2004-04-08 23:48

Message:
Logged In: YES 
user_id=21627

In C, flushing a file that was opened for read only causes
undefined behaviour. So it is not surprising that systems
behave differently in this respect.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=931902&group_id=5470



More information about the Python-bugs-list mailing list