Skip to content

crypt.h should be in _cryptmodule.c, not in public header #88914

Closed

Description

@geofft
mannequin
BPO 44751
Nosy @vstinner, @miss-islington, @geofft, @thesamesam
PRs
  • closes bpo-44751: Move crypt.h include from public header to _cryptmodule #27394
  • [3.10] closes bpo-44751: Move crypt.h include from public header to _cryptmodule (GH-27394) #28636
  • [3.9] closes bpo-44751: Move crypt.h include from public header to _cryptmodule (GH-27394) #28638
  • 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 2021-07-27.22:58:40.724>
    created_at = <Date 2021-07-27.21:23:37.808>
    labels = ['3.8', '3.9', '3.10', '3.11', 'expert-C-API', '3.7']
    title = 'crypt.h should be in _cryptmodule.c, not in public header'
    updated_at = <Date 2021-09-30.21:54:16.845>
    user = 'https://github.com/geofft'

    bugs.python.org fields:

    activity = <Date 2021-09-30.21:54:16.845>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-07-27.22:58:40.724>
    closer = 'miss-islington'
    components = ['C API']
    creation = <Date 2021-07-27.21:23:37.808>
    creator = 'geofft'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44751
    keywords = ['patch']
    message_count = 8.0
    messages = ['398321', '398328', '402894', '402909', '402919', '402920', '402986', '402990']
    nosy_count = 5.0
    nosy_names = ['vstinner', 'Arfrever', 'miss-islington', 'geofft', 'thesamesam']
    pr_nums = ['27394', '28636', '28638']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue44751'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9', 'Python 3.10', 'Python 3.11']

    Activity

    1. geofft commented on Jul 27, 2021

      geofftmannequin
      MannequinAuthor

      In bpo-32635, it was discovered that _cryptmodule.c was missing a dependency on crypt.h, which caused it to segfault when it was missing the proper prototype for crypt. This was fixed by adding an #include <crypt.h> to Python.h.

      This include doesn't need to be in the public header; it only needs to be in _cryptmodule.c. Removing it from the public header is helpful for packagers, because it means that the libpython-dev (or whatever) package doesn't need a dependency on libcrypt-dev, only on the libcrypt runtime library.

    2. miss-islington commented on Jul 27, 2021

      @miss-islington
      Contributor

      New changeset 196998e by Geoffrey Thomas in branch 'main':
      closes bpo-44751: Move crypt.h include from public header to _cryptmodule (GH-27394)
      196998e

    3. Arfrever commented on Sep 29, 2021

      Arfrevermannequin
      Mannequin

      Could you backport this fix to at least 3.9 and 3.10 branches?
      This is fix for regression which was previously backported to 2.7 and 3.6 branches.

    4. miss-islington commented on Sep 29, 2021

      @miss-islington
      Contributor

      New changeset 9626ac8 by Miss Islington (bot) in branch '3.9':
      closes bpo-44751: Move crypt.h include from public header to _cryptmodule (GH-27394)
      9626ac8

    5. vstinner commented on Sep 29, 2021

      @vstinner
      Member

      New changeset 80285ec by Miss Islington (bot) in branch '3.10':
      closes bpo-44751: Move crypt.h include from public header to _cryptmodule (GH-27394) (GH-28636)
      80285ec

    6. vstinner commented on Sep 29, 2021

      @vstinner
      Member

      Could you backport this fix to at least 3.9 and 3.10 branches?

      Done.

      This is fix for regression which was previously backported to 2.7 and 3.6 branches.

      I'm not sure what you mean.

      In Python 2.7 and Python 3.6, <crypt.h> was already included by Include/Python.h:

      #ifdef HAVE_CRYPT_H
      #include <crypt.h>
      #endif
    7. Arfrever commented on Sep 30, 2021

      Arfrevermannequin
      Mannequin

      > This is fix for regression which was previously backported to 2.7 and 3.6 branches.

      I'm not sure what you mean.

      In Python 2.7 and Python 3.6, <crypt.h> was already included by Include/Python.h:

      See issue bpo-32635, where Victor Stinner backported some commit (with problematic location of '#include <crypt.h>') to 2.7 and 3.6 branches (which was released in >=2.7.15 and >=3.6).

    8. vstinner commented on Sep 30, 2021

      @vstinner
      Member

      See issue bpo-32635, where Victor Stinner backported some commit (with problematic location of '#include <crypt.h>') to 2.7 and 3.6 branches (which was released in >=2.7.15 and >=3.6).

      crypt.h was added to Python.h by: https://github.com/python/cpython/pull/5284/files

      And this change was then backported to 2.7 and 3.6. Ok, now I understand.

      Well, it's now fixed in all branches accepting bugfixes.

    9. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions