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

Fix uninitialized variable in os_dup2_impl #76862

matrixise opened this issue Jan 26, 2018 · 4 comments

Fix uninitialized variable in os_dup2_impl #76862

matrixise opened this issue Jan 26, 2018 · 4 comments
3.7 (EOL) end of life


Copy link

BPO 32681
Nosy @gpshead, @vstinner, @matrixise
  • bpo-32681: Fix an uninitialized variable in the C imp of os.dup2 #5346
  • 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 2018-01-30.06:05:06.614>
    created_at = <Date 2018-01-26.15:34:17.608>
    labels = ['3.7']
    title = 'Fix uninitialized variable in os_dup2_impl'
    updated_at = <Date 2018-01-30.06:05:06.613>
    user = '' fields:

    activity = <Date 2018-01-30.06:05:06.613>
    actor = 'gregory.p.smith'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-01-30.06:05:06.614>
    closer = 'gregory.p.smith'
    components = []
    creation = <Date 2018-01-26.15:34:17.608>
    creator = 'matrixise'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32681
    keywords = ['patch']
    message_count = 4.0
    messages = ['310767', '310768', '310772', '311238']
    nosy_count = 3.0
    nosy_names = ['gregory.p.smith', 'vstinner', 'matrixise']
    pr_nums = ['5346']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = ''
    versions = ['Python 3.7']

    Copy link
    Member Author

    With the last revision, I get this warning from the compiler.

    gcc -pthread -Wno-unused-result -Wsign-compare -g -Og -Wall -Wstrict-prototypes    -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration   -I. -I./Include    -DPy_BUILD_CORE  -c ./Modules/_collectionsmodule.c -o Modules/_collectionsmodule.o
    ./Modules/posixmodule.c: In functionos_dup2_impl’:
    ./Modules/posixmodule.c:7785:9: warning: ‘resmay be used uninitialized in this function [-Wmaybe-uninitialized]
         int res;

    Copy link

    I already reported the issue at:

    I suggest to close this issue as a duplicate.

    Copy link
    Member Author

    Yes, you can close it, but I don't understand why there is no fix for
    this warning. my issue has a small PR, but the other issue on b.p.o, I
    am not really sure about my fix... I just set the 'res' variable to 0
    and avoid this kind of message. Is there an other way if I want to fix
    it ?

    @matrixise matrixise added the 3.7 (EOL) end of life label Jan 26, 2018
    Copy link

    gpshead commented Jan 30, 2018

    New changeset 3d86e48 by Gregory P. Smith (Stéphane Wirtel) in branch 'master':
    bpo-32681: Fix an uninitialized variable in the C implementation of os.dup2 (GH-5346)

    @gpshead gpshead closed this as completed Jan 30, 2018
    @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
    3.7 (EOL) end of life
    None yet

    No branches or pull requests

    3 participants