python / python/cpython

os.writev() behaviour unpredictable when hitting file system full (28)

Open
#99,691 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs type-bug
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

Bug report

os.writev() has an unpredictable behaviour when writing on a file system that becomes full:

For example:

try:
    fd=os.open(file,  os.O_WRONLY|os.O_CREAT|os.O_APPEND)
    result = os.writev(fd,iovtable[0:MAXIOV])
except OSError as e:
    ...
    # at this point result might return some bytes written (not necessarly corresponding to iov lengths, or even not be defined at all.

Your environment

centos 7.
Python 3.9 (but probably the same on 3.11)

This can easily be worked around by specifying in the documentation that os.writev() returns the actual number of bytes written in case of success, but the contents of the return value are unpredicatbale in case of errors.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the os.writev() documentation and review how its return value and OSError behavior are currently described. Compare that wording with the reported full-filesystem case; done means the documentation clearly states what callers can rely on after success and after an error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.