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

sendfile implementation is not compatible with Solaris #85853

Closed
kulikjak mannequin opened this issue Sep 1, 2020 · 6 comments
Closed

sendfile implementation is not compatible with Solaris #85853

kulikjak mannequin opened this issue Sep 1, 2020 · 6 comments
Labels
3.8 only security fixes 3.9 only security fixes 3.10 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@kulikjak
Copy link
Mannequin

kulikjak mannequin commented Sep 1, 2020

BPO 41687
Nosy @ambv, @1st1, @miss-islington, @isidentical, @kulikjak
PRs
  • bpo-41687: Fix sendfile implementation to work with Solaris #22040
  • bpo-41687: Fix error handling in Solaris sendfile implementation #22128
  • [3.9] bpo-41687: Fix sendfile implementation to work with Solaris (GH-22040) #22273
  • [3.9] bpo-41687: Fix error handling in Solaris sendfile implementation (GH-22128) #22274
  • 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 = None
    closed_at = <Date 2020-09-05.19:10:31.396>
    created_at = <Date 2020-09-01.13:55:22.051>
    labels = ['3.8', 'type-bug', 'library', '3.9', '3.10']
    title = 'sendfile implementation is not compatible with Solaris'
    updated_at = <Date 2020-09-16.12:25:16.758>
    user = 'https://github.com/kulikjak'

    bugs.python.org fields:

    activity = <Date 2020-09-16.12:25:16.758>
    actor = 'miss-islington'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-09-05.19:10:31.396>
    closer = 'yselivanov'
    components = ['Library (Lib)']
    creation = <Date 2020-09-01.13:55:22.051>
    creator = 'kulikjak'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41687
    keywords = ['patch']
    message_count = 6.0
    messages = ['376191', '376439', '376475', '376658', '376988', '376990']
    nosy_count = 5.0
    nosy_names = ['lukasz.langa', 'yselivanov', 'miss-islington', 'BTaskaya', 'kulikjak']
    pr_nums = ['22040', '22128', '22273', '22274']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue41687'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    @kulikjak
    Copy link
    Mannequin Author

    kulikjak mannequin commented Sep 1, 2020

    Hi,

    Sendfile on Solaris raises EINVAL if offset is equal or bigger than the size of the file. This is different from Linux, where similar sendfile call returns 0, which is used in an ad-hoc fashion to indicate EOF. Since Python sendfile implementation expects 0 to be returned, it breaks. I already reported this in bpo-36610, which led to sendfile eventually being disabled on Solaris to be safe before the 3.8 release.

    We were first looking into a possibility to change Solaris behavior of sendfile to reflect that of Linux but decided not to because of the significant risk that it can break existing programs. The other reason is that sendfile isn't standardized (Linux manpage explicitly states that) and hence Solaris implementation isn't broken, just different. Because of that, we patched the runtime and added #ifdef branch (of which there are already many due to os differences) with additional offset check. It is tested with the current master and also 3.7, which we are using internally.

    Thanks

    @kulikjak kulikjak mannequin added 3.7 (EOL) end of life 3.10 only security fixes 3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir labels Sep 1, 2020
    @terryjreedy terryjreedy removed 3.7 (EOL) end of life labels Sep 4, 2020
    @1st1
    Copy link
    Member

    1st1 commented Sep 5, 2020

    New changeset 8c0be6f by Jakub Kulík in branch 'master':
    bpo-41687: Fix sendfile implementation to work with Solaris (bpo-22040)
    8c0be6f

    @1st1 1st1 closed this as completed Sep 5, 2020
    @1st1 1st1 added the type-bug An unexpected behavior, bug, or error label Sep 5, 2020
    @1st1 1st1 closed this as completed Sep 5, 2020
    @1st1 1st1 added the type-bug An unexpected behavior, bug, or error label Sep 5, 2020
    @kulikjak
    Copy link
    Mannequin Author

    kulikjak mannequin commented Sep 7, 2020

    I just realized that the recently merged PR has broken error handling, so I opened another one with a followup fix.

    @miss-islington
    Copy link
    Contributor

    New changeset fa8c9e7 by Jakub Kulík in branch 'master':
    bpo-41687: Fix error handling in Solaris sendfile implementation (GH-22128)
    fa8c9e7

    @ambv
    Copy link
    Contributor

    ambv commented Sep 16, 2020

    New changeset 7e356f1 by Łukasz Langa in branch '3.9':
    [3.9] bpo-41687: Fix sendfile implementation to work with Solaris (GH-22040) (GH-22273)
    7e356f1

    @miss-islington
    Copy link
    Contributor

    New changeset 6a39888 by Miss Islington (bot) in branch '3.9':
    bpo-41687: Fix error handling in Solaris sendfile implementation (GH-22128)
    6a39888

    @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
    3.8 only security fixes 3.9 only security fixes 3.10 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants