Bug 88061 - Serial TTYs in /etc/inittab confuse rc.sysinit
Summary: Serial TTYs in /etc/inittab confuse rc.sysinit
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts
Version: 9
Hardware: i386
OS: Linux
medium
low
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks: 88540
TreeView+ depends on / blocked
 
Reported: 2003-04-05 02:10 UTC by Pete Toscano
Modified: 2014-03-17 02:35 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2003-06-17 23:03:50 UTC
Embargoed:


Attachments (Terms of Use)
Patch to fix the regex on line 38 of /etc/rc.d/rc.sysinit (435 bytes, patch)
2003-04-05 02:27 UTC, Pete Toscano
no flags Details | Diff

Description Pete Toscano 2003-04-05 02:10:55 UTC
Description of problem:
I tried adding a serial console to my RH9 box.  Part of this involved adding the
following line to /etc/inittab:

S0:12345:respawn:/sbin/mingetty ttyS0

The for loop on line 38 of /etc/rc.d/rc.sysinit is driven by a grep piped to a sed:

grep '^[0-9]*.*respawn:/sbin/mingetty' /etc/inittab | sed 's/^.* \
tty\([0-9][0-9]*\).*/\1/g'

It looks like the grep part is trying to pull out all the respawning mingetty
lines dealing with standard (non-serial) TTYs.  Unfortunately, the regex given
to grep doesn't quite work this way.  The above grep pulls out the S0 line too
and the piped-to sed starts outputs the following for the for-loop to iterate over:

1
2
3
4
5
6
S0:12345:respawn:/sbin/mingetty ttyS0

The pattern "^[0-9]*.*respawn:/sbin/mingetty" is as good as
"respawn:/sbin/mingetty" since the first "*" means there can be zero or more
digits at the beginning of the line.  I believe that intended pattern should be:

"^[0-9]\+.*respawn:/sbin/mingetty"

This will pull out ensure that all lines extracted will begin with at lest one
digit.

Version-Release number of selected component (if applicable):
initscripts-7.14-1

How reproducible:
Consistent

Steps to Reproduce:
1. Add "S0:12345:respawn:/sbin/mingetty ttyS0" to /etc/inittab
2. Reboot
    
Actual results:
Errors similar to this...
/etc/rc.d/rc.sysinit: line 39: /dev/ttyS0:12345:respawn:/sbin/mingetty: No such
file or directory
/etc/rc.d/rc.sysinit: line 42: [: ttyS0: integer expression expected


Expected results:
No errors.

Additional info:

Comment 1 Pete Toscano 2003-04-05 02:27:29 UTC
Created attachment 90919 [details]
Patch to fix the regex on line 38 of /etc/rc.d/rc.sysinit

Works for me.

Comment 2 Bill Nottingham 2003-04-07 21:12:53 UTC
Hm, yeah, actually, we don't set up serial consoles with mingetty here (we use
agetty), so we didn't see this.

Comment 3 Bill Nottingham 2003-06-17 23:03:50 UTC
This is changed differently in current code.

Comment 4 Bill Nottingham 2003-06-17 23:06:47 UTC
Will be in 7.25-1.


Note You need to log in before you can comment on or make changes to this bug.