Bug 174071 - x11-apps/xinit initscript reads nox falsely
Bug#: 174071 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: x11@gentoo.org Reported By: brigad@rpi.edu
Component: Ebuilds
URL: 
Summary: x11-apps/xinit initscript reads nox falsely
Keywords:  Inclusion
Status Whiteboard: 
Opened: 2007-04-10 19:09 0000
Description:   Opened: 2007-04-10 19:09 0000
If I boot my computer, the xdm init script acts as though it saw "nox" on the
kernel boot command line.  The cmdline_opt function doesn't return 1 if it
doesn't find the nox option, so the script thinks it's there even though it
isn't.  The simple fix is to add a return 1 at the end of the cmdline_opt
script for the case where it doesn't find the parameter.

------- Comment #1 From David Brigada 2007-04-10 19:10:08 0000 -------
Created an attachment (id=115923) [details]
Patch to fix cmdline_opt function

This fixes the issue

------- Comment #2 From Donnie Berkholz 2007-04-10 20:16:18 0000 -------
I suppose that means the previous command returned some wonky value, so that's
what the function ends up returning.

------- Comment #3 From David Brigada 2007-04-10 23:46:41 0000 -------
(In reply to comment #2)
> I suppose that means the previous command returned some wonky value, so that's
> what the function ends up returning.
> 

Well, if you have no arguments for the for command, then the for command
succeeds, and the function implicitly returns 0 (true).  If you have arguments,
but they don't match, the function implicitly returns 1 (false).  If you have
arguments that do match, the function explicitly runs the return 0.

I guess it's just kind of a particular of how shell scripting works.  I think
the cmdline_opt function works properly as long as the user has at least one
boot option, but fails if he doesn't.  This patch should fix the behavior for
all.

------- Comment #4 From Jakub Moc (RETIRED) 2007-04-11 07:05:29 0000 -------
(In reply to comment #3)

> the cmdline_opt function works properly as long as the user has at least one
> boot option, but fails if he doesn't.  This patch should fix the behavior for
> all.

Well no, it doesn't work at all currently, xdm is never started.

$ cat /proc/cmdline 
root=/dev/hda9 root=/dev/ram0 init=/linuxrc real_root=/dev/hda9
video=vesafb:ywrap,mtrr,1024x768-24@100 splash=silent,theme:livecd-2006.1
CONSOLE=/dev/tty1 quiet fbcon=scrollback:128K hde=noprobe hdf=noprobe
hdg=noprobe hdh=noprobe elevator=cfq

------- Comment #5 From Jakub Moc (RETIRED) 2007-04-12 20:46:55 0000 -------
*** Bug 174271 has been marked as a duplicate of this bug. ***

------- Comment #6 From Roy Marples (RETIRED) 2007-04-13 08:23:10 0000 -------
Fixed in -r3, sorry about that.