Created attachment 701011 [details] Patch to exit immediately after the error Description of problem: $ chkconfig --list Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overridden by native systemd configuration. ceph 0:off 1:off 2:off 3:off 4:off 5:off 6:off ebtables 0:off 1:off 2:off 3:off 4:off 5:off 6:off iscsi 0:off 1:off 2:off 3:on 4:on 5:on 6:off iscsid 0:off 1:off 2:off 3:on 4:on 5:on 6:off netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off network 0:off 1:off 2:off 3:off 4:off 5:off 6:off pmcd 0:off 1:off 2:off 3:off 4:off 5:off 6:off pmie 0:off 1:off 2:off 3:off 4:off 5:off 6:off pmlogger 0:off 1:off 2:off 3:off 4:off 5:off 6:off pmproxy 0:off 1:off 2:off 3:off 4:off 5:off 6:off $ sudo chmod 750 /etc/init.d $ chkconfig --list Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overridden by native systemd configuration. failed to open /etc/init.d: Permission denied Segmentation fault (core dumped) Version-Release number of selected component (if applicable): chkconfig-1.3.59-2.fc18.x86_64 How reproducible: 100% Steps to Reproduce: 1. See above. 2. 3. Actual results: segfault Expected results: Issue error message and exit with non zero value. Additional info: Core was generated by `chkconfig --list'. Program terminated with signal 11, Segmentation fault. #0 0x0000000000403201 in listService (item=item@entry=0x0, type=type@entry=3) at chkconfig.c:481 481 if (systemd && isOverriddenBySystemd(services[i].name)) (gdb) bt #0 0x0000000000403201 in listService (item=item@entry=0x0, type=type@entry=3) at chkconfig.c:481 #1 0x0000000000402099 in main (argc=<optimized out>, argv=0x7fff367df738) at chkconfig.c:753 (gdb) l 476 numServices = readServices(&services); 477 478 qsort(services, numServices, sizeof(*services), serviceNameCmp); 479 480 for (i = 0; i < numServices ; i++) { 481 if (systemd && isOverriddenBySystemd(services[i].name)) 482 continue; 483 if (showServiceInfo(services[i], 1)) { 484 return 1; 485 } (gdb) l readServices 249 free(buf); 250 free(filename); 251 return -1; 252 } 253 254 int readServices(struct service **services) { 255 DIR * dir; 256 struct dirent * ent; 257 struct stat sb; 258 struct service *servs = NULL; (gdb) 259 int numservs = 0; 260 char fn[1024]; 261 262 if (!(dir = opendir(RUNLEVELS "/init.d"))) { 263 fprintf(stderr, _("failed to open %s/init.d: %s\n"), RUNLEVELS, 264 strerror(errno)); 265 return 1; <------ HERE 266 } 267 268 while ((ent = readdir(dir))) { So readServices returns 1 when the call to opendir fails and the code in listService does not take this into account. Attaching two possible patches.
Created attachment 701013 [details] Patch to correct readServices return code and check Patch by Martin Poole
Thanks for the report and patch. Code of chkconfig is not in very good shape so I will try to go through it and fix similar things.
This message is a reminder that Fedora 18 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 18. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '18'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 18's end of life. Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 18 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior to Fedora 18's end of life. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Fedora 18 changed to end-of-life (EOL) status on 2014-01-14. Fedora 18 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed.