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

platform.libc_ver() doesn't consider in case of executable is empty string #86423

Closed
kurochan mannequin opened this issue Nov 4, 2020 · 9 comments
Closed

platform.libc_ver() doesn't consider in case of executable is empty string #86423

kurochan mannequin opened this issue Nov 4, 2020 · 9 comments
Labels
3.8 (EOL) end of life 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

@kurochan
Copy link
Mannequin

kurochan mannequin commented Nov 4, 2020

BPO 42257
Nosy @malemburg, @vstinner, @kurochan
PRs
  • bpo-42257: handle empty string in variable executable in platform.libc_ver() #23140
  • 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-01-02.16:08:47.379>
    created_at = <Date 2020-11-04.06:01:55.532>
    labels = ['3.8', 'type-bug', 'library', '3.9', '3.10']
    title = "platform.libc_ver() doesn't consider in case of executable is empty string"
    updated_at = <Date 2021-01-02.16:10:14.085>
    user = 'https://github.com/kurochan'

    bugs.python.org fields:

    activity = <Date 2021-01-02.16:10:14.085>
    actor = 'lemburg'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-01-02.16:08:47.379>
    closer = 'lemburg'
    components = ['Library (Lib)']
    creation = <Date 2020-11-04.06:01:55.532>
    creator = 'kurochan'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 42257
    keywords = ['patch']
    message_count = 9.0
    messages = ['380311', '383523', '383891', '383892', '384118', '384120', '384121', '384225', '384226']
    nosy_count = 3.0
    nosy_names = ['lemburg', 'vstinner', 'kurochan']
    pr_nums = ['23140']
    priority = 'normal'
    resolution = None
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue42257'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    @kurochan
    Copy link
    Mannequin Author

    kurochan mannequin commented Nov 4, 2020

    Currently, platform.libc_ver() doesn't consider in case of executable variable is an empty string.
    However, with Python 3.8, the following code could pass an empty string executable to the platform.libc_ver() function.

    libcname, libcversion = libc_ver(sys.executable)

    https://docs.python.org/3/library/sys.html#sys.executable

    Because the sys.executable could return an empty string, so I would like to add the empty string handler.

    if executable is None:

    Or please also merge the following PR to Python 3.8.
    #14418

    @kurochan kurochan mannequin added 3.8 (EOL) end of life 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 labels Nov 4, 2020
    @kurochan
    Copy link
    Mannequin Author

    kurochan mannequin commented Dec 21, 2020

    Can anyone review this PR?

    @malemburg
    Copy link
    Member

    Reviewed. Please check on the PR for comments.

    @vstinner
    Copy link
    Member

    Currently, platform.libc_ver() doesn't consider in case of executable variable is an empty string.

    I'm curious. In which case sys.executable is an empty string? Do you embed Python in an application. If Python is embedded, would it be possible to share the code used to configure Python initialization?

    @kurochan
    Copy link
    Mannequin Author

    kurochan mannequin commented Dec 31, 2020

    If Python is embedded

    Yes. It's embedded Python.
    This issue caused in datadog-agent with embedded Python.
    https://github.com/DataDog/datadog-agent/

    would it be possible to share the code used to configure Python initialization?
    I'm not sure where the Python installation code is. Maybe it's around here.
    https://github.com/DataDog/datadog-agent/blob/master/docs/dev/agent_omnibus.md

    https://github.com/DataDog/datadog-agent/blob/master/omnibus/config/software/python3.rb

    datadog-agent's official install script is here.
    https://s3.amazonaws.com/dd-agent/scripts/install_script.sh

    @kurochan
    Copy link
    Mannequin Author

    kurochan mannequin commented Dec 31, 2020

    Also, PR comment processed.

    @malemburg
    Copy link
    Member

    Thanks for the patch.

    Merging is currently prevented by an unrelated test for nntplib failing. See e.g. https://github.com/python/cpython/pull/23140/checks?check_run_id=1630509357. This is being tracked in https://bugs.python.org/issue42794

    @malemburg
    Copy link
    Member

    #23140 merged. Thanks for the patch, Kurochan.

    @malemburg
    Copy link
    Member

    Note: I did not request a backport, since this really is a new feature.

    @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 (EOL) end of life 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

    2 participants