Bug 327382 - 3D Accelerator always shown as "unknown"
Summary: 3D Accelerator always shown as "unknown"
Status: RESOLVED FIXED
Alias: None
Product: kinfocenter
Classification: Applications
Component: OpenGL (show other bugs)
Version: 4.11.3
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: David Hubner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-09 22:07 UTC by Wolfgang Bauer
Modified: 2013-11-14 16:56 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 4.11.4


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Bauer 2013-11-09 22:07:13 UTC
On openSUSE, 3D Accelerator is always shown as "unknown".
The reason for this is that KInfocenter runs "lspci" to find out the accelerator, but this is located in /sbin/ which is not in the user's path.

KInfocenter would try to call "/sbin/lspci" as well (and other locations) if "lspci" fails, but this doesn't work because ReadPipe() doesn't return 0 in that case, but the length of sh's output which is "command not found" in this case. (popen() does not fail if the command is not found, because it _can_ run "sh")
To fix this, ReadPipe() should check the return code of the call to pclose() (see "man pclose"), and return 0 if this is not equal to 0.
Comment 1 Wolfgang Bauer 2013-11-10 00:28:56 UTC
Proposed fix:
https://git.reviewboard.kde.org/r/113779/
Comment 2 Wolfgang Bauer 2013-11-11 11:31:51 UTC
Git commit 9f70241d57f3ba1013b9f28650478c8bbb1233e0 by Wolfgang Bauer.
Committed on 11/11/2013 at 11:02.
Pushed by wbauer into branch 'master'.

KInfocenter/OpenGL: fix ReadPipe() to return 0 in the case that the command cannot be run

ReadPipe() doesn't return 0 as expected in the case that the command is not found. but the
length of sh's output which is "command not found" in this case. This is because popen()
does not fail if the command is not found, because it _can_ run "sh". (according to the
man page, popen calls "/bin/sh -c command")
To fix this, ReadPipe() should check the return code of the call to pclose()
(see "man pclose"), and return 0 if this is not equal to 0.
REVIEW: 113779

M  +4    -1    kinfocenter/Modules/opengl/opengl.cpp

http://commits.kde.org/kde-workspace/9f70241d57f3ba1013b9f28650478c8bbb1233e0
Comment 3 Wolfgang Bauer 2013-11-14 16:50:12 UTC
Git commit ef2cef07b298fa38181cf7b060e2554386e9c2be by Wolfgang Bauer.
Committed on 14/11/2013 at 16:43.
Pushed by wbauer into branch 'master'.

KInfocenter/OpenGL: fix ReadPipe() to return 0 in the case that the
command cannot be run

ReadPipe() doesn't return 0 as expected in the case that the command is
not found. but the length of sh's output which is "command not found"
in this case. This is because popen() does not fail if the command is
not found, because it _can_ run "sh". (according to the man page, popen
calls "/bin/sh -c command")
To fix this, ReadPipe() should check the return code of the call to
pclose() (see "man pclose"), and return 0 if this is not equal to 0.
REVIEW: 113779

M  +4    -1    kinfocenter/Modules/opengl/opengl.cpp

http://commits.kde.org/kde-workspace/ef2cef07b298fa38181cf7b060e2554386e9c2be
Comment 4 Wolfgang Bauer 2013-11-14 16:56:12 UTC
Git commit 77f7ade9cecd0e6d929d50e008749dbee651cebe by Wolfgang Bauer.
Committed on 14/11/2013 at 16:53.
Pushed by wbauer into branch 'KDE/4.11'.

KInfocenter/OpenGL: fix ReadPipe() to return 0 in the case that the
command cannot be run

ReadPipe() doesn't return 0 as expected in the case that the command is
not found. but the length of sh's output which is "command not found"
in this case. This is because popen() does not fail if the command is
not found, because it _can_ run "sh". (according to the man page, popen
calls "/bin/sh -c command")
To fix this, ReadPipe() should check the return code of the call to
pclose() (see "man pclose"), and return 0 if this is not equal to 0.
FIXED-IN: 4.11.4
REVIEW: 113779

M  +4    -1    kinfocenter/Modules/opengl/opengl.cpp

http://commits.kde.org/kde-workspace/77f7ade9cecd0e6d929d50e008749dbee651cebe