Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document os.open #52646

Closed
techtonik mannequin opened this issue Apr 14, 2010 · 5 comments
Closed

Document os.open #52646

techtonik mannequin opened this issue Apr 14, 2010 · 5 comments
Assignees
Labels
docs Documentation in the Doc dir stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@techtonik
Copy link
Mannequin

techtonik mannequin commented Apr 14, 2010

BPO 8399
Nosy @birkenfeld
Files
  • 8399.os-open-default-behavior.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/birkenfeld'
    closed_at = <Date 2010-04-14.19:17:45.411>
    created_at = <Date 2010-04-14.13:26:01.301>
    labels = ['type-bug', 'library', 'docs']
    title = 'Document os.open'
    updated_at = <Date 2010-04-14.19:17:45.410>
    user = 'https://bugs.python.org/techtonik'

    bugs.python.org fields:

    activity = <Date 2010-04-14.19:17:45.410>
    actor = 'georg.brandl'
    assignee = 'georg.brandl'
    closed = True
    closed_date = <Date 2010-04-14.19:17:45.411>
    closer = 'georg.brandl'
    components = ['Documentation', 'Library (Lib)']
    creation = <Date 2010-04-14.13:26:01.301>
    creator = 'techtonik'
    dependencies = []
    files = ['16924']
    hgrepos = []
    issue_num = 8399
    keywords = ['patch']
    message_count = 5.0
    messages = ['103128', '103130', '103131', '103139', '103142']
    nosy_count = 2.0
    nosy_names = ['georg.brandl', 'techtonik']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue8399'
    versions = ['Python 2.6', 'Python 3.1', 'Python 2.7', 'Python 3.2', 'Python 3.3']

    @techtonik
    Copy link
    Mannequin Author

    techtonik mannequin commented Apr 14, 2010

    Need to document the that os.O_BINARY flag is obligatory for cross-platform behavior of os.open() on Windows. By default os.open() opens file as binary on Unix, but as text on Windows.

    See also bpo-2028 for discussion of making os.O_BINARY default on py3k. I can reopen this issue.

    @techtonik techtonik mannequin assigned birkenfeld Apr 14, 2010
    @techtonik techtonik mannequin added docs Documentation in the Doc dir stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Apr 14, 2010
    @techtonik
    Copy link
    Mannequin Author

    techtonik mannequin commented Apr 14, 2010

    s/ can / can't /

    @birkenfeld
    Copy link
    Member

    Since there is no distinction between text and binary mode on Unix, you shouldn't claim the behavior is not consistent - you get text mode. You need O_BINARY on Windows to get binary mode. O_BINARY is already documented; I've added a better link to it from the description of os.open() in r80069.

    Do not reopen bpo-2028, it was not about os.open() anyway. For os.open(),
    as it is only a wrapper for the OS's own POSIX layer, the flags argument
    shouldn't be touched.

    @techtonik
    Copy link
    Mannequin Author

    techtonik mannequin commented Apr 14, 2010

    On Unix all files are opened in binary mode. On Windows linefeeds are translated to CRLF corrupting files that are meant to be binary. This is the reason of HgGit failure - it uses Dulwich library that creates corrupted Git index file, because on Windows it is opened without os.O_BINARY flag. Developers do not know anything about it, because they develop on Unix. This could be prevented if we supply a note about how to preserve crossplatform behavior.
    https://bugs.edge.launchpad.net/dulwich/+bug/557585

    I've attached a patch that adds required note. Please revise it. It should clearly apply over your changes in r80069. I reworded description towards Python users without C background, but I am still worried that they need a POSIX background to understand umask part.

    @techtonik techtonik mannequin reopened this Apr 14, 2010
    @birkenfeld
    Copy link
    Member

    I've added a paragraph about O_BINARY in r80080.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    docs Documentation in the Doc dir stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant