Issue 32681: Fix uninitialized variable in os_dup2_impl (original) (raw)

Issue32681

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/76862

classification

Title: Fix uninitialized variable in os_dup2_impl
Type: Stage: resolved
Components: Versions: Python 3.7

process

Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: gregory.p.smith, matrixise, vstinner
Priority: normal Keywords: patch

Created on 2018-01-26 15:34 by matrixise, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 5346 merged matrixise,2018-01-26 15:38
Messages (4)
msg310767 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2018-01-26 15:34
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 function ‘os_dup2_impl’: ./Modules/posixmodule.c:7785:9: warning: ‘res’ may be used uninitialized in this function [-Wmaybe-uninitialized] int res; ^~~
msg310768 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-01-26 15:35
I already reported the issue at: https://bugs.python.org/issue32441#msg310752 I suggest to close this issue as a duplicate.
msg310772 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2018-01-26 15:51
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 ?
msg311238 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2018-01-30 06:04
New changeset 3d86e484de6334fe16cbab512744597bd0de4e80 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) https://github.com/python/cpython/commit/3d86e484de6334fe16cbab512744597bd0de4e80
History
Date User Action Args
2022-04-11 14:58:57 admin set github: 76862
2018-01-30 06:05:06 gregory.p.smith set status: open -> closedresolution: fixedstage: patch review -> resolved
2018-01-30 06:04:38 gregory.p.smith set nosy: + gregory.p.smithmessages: +
2018-01-26 16:08:52 matrixise set versions: + Python 3.7
2018-01-26 15:51:01 matrixise set messages: +
2018-01-26 15:38:21 matrixise set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest5194>
2018-01-26 15:35:08 vstinner set nosy: + vstinnermessages: +
2018-01-26 15:34:17 matrixise create