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.

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:57adminsetgithub: 76862
2018-01-30 06:05:06gregory.p.smithsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-01-30 06:04:38gregory.p.smithsetnosy: + gregory.p.smith
messages: + msg311238
2018-01-26 16:08:52matrixisesetversions: + Python 3.7
2018-01-26 15:51:01matrixisesetmessages: + msg310772
2018-01-26 15:38:21matrixisesetkeywords: + patch
stage: patch review
pull_requests: + pull_request5194
2018-01-26 15:35:08vstinnersetnosy: + vstinner
messages: + msg310768
2018-01-26 15:34:17matrixisecreate