Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 558700 - rc-status seg faults if you have a bad recursive symlink in runlevels
Summary: rc-status seg faults if you have a bad recursive symlink in runlevels
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: AMD64 Linux
: Normal minor (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2015-08-25 11:36 UTC by Peter
Modified: 2016-12-20 00:31 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter 2015-08-25 11:36:35 UTC
rc-status seg faults if you   ln -s ../default /etc/runlevels/default/
user error of course, but should handle it more gracefully I think :)

if you reboot while this is like this, it just hangs instead of shutting down, and if you hard reset it, it will boot up, but not all services start. In my case, the network and sshd were not up.


and some background... I was not doing something so simple and obvious, but I was manually reorganizing my runlevels, and I accidentally had something equivalent but not as obvious. It was very easy to notice when looking for it, but not as obvious when I created it. :)

Reproducible: Always

Steps to Reproduce:
1. sudo ln -s ../default /etc/runlevels/default/
2. rc-status
3.
Actual Results:  
displays partial result and seg faults:

$ rc-status
Runlevel: default
 netmount                          [  started  ]
 local                             [  started  ]
Segmentation fault

$

Expected Results:  
display what it can, and just ignore and complain about a nonsense stacked runlevel. and on boot, you'd hope it just skips the problem services/stacked runlevel and continues.

it should probably detect infinite recursion; probably either:
- keep track of which runlevels were used, and don't rerun them
- a crude stack overflow sort of error, just countin how many levels deep we are, and on overflow, skip a portion of it (last link only?) and continue with the next.
Comment 1 dwfreed 2016-12-19 14:13:14 UTC
The segfault is triggered due to running out of stack in an infinite recursion.  I've fixed this in a somewhat rudimentary way here:

https://github.com/OpenRC/openrc/pull/109

Feel free to test it with various nasty stacked runlevel loops.  rc-status will bail out, printing the details of the loop.
Comment 2 William Hubbs gentoo-dev 2016-12-20 00:31:53 UTC
https://github.com/openrc/openrc/commit/45aa36c

This will be included in OpenRC 0.23.