bugSystem V style init programs - Bugs: bug #33709, sulogin TTY argument is ignored in...

 
 

bug #33709: sulogin TTY argument is ignored in certain cirumstances

Submitted by:  Paul Parsons <lostdistance>
Submitted on:  Mon 04 Jul 2011 03:01:38 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Dr. Werner Fink <wfink>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 26 Jul 2011 03:06:27 PM UTC, comment #3:

Thank you for testing

Dr. Werner Fink <wfink>
Project AdministratorIn charge of this item.
Tue 26 Jul 2011 02:57:43 PM UTC, comment #2:

Yes, it works for me; the use of the TTY argument is no longer conditional on the pgrp values.

Thank you.

Paul Parsons <lostdistance>
Tue 26 Jul 2011 08:52:37 AM UTC, comment #1:

Thanks for spotting.

Please could you give the current SVN version a try as this
one should work. Be aware that if you specify /dev/console
or nothing than this sulogin will connect to all devices
used/connected to /dev/console as this version uses /proc/console
or /sys/class/tty/ or as fallback the kernels command line
to determine the console devices.

Dr. Werner Fink <wfink>
Project AdministratorIn charge of this item.
Mon 04 Jul 2011 03:01:38 PM UTC, original submission:

sulogin can be given an optional TTY argument on the command line. According to the manual page:

"sulogin will be connected to the current terminal, or to the optional device that can be specified on the command line (typically /dev/console)."

However the TTY argument only replaces file descriptors 0, 1 and 2 if certain conditions are met:

534 pid = getpid();
535 pgrp = getpgid(0);
536 ppgrp = getpgid(getppid());
537 ttypgrp = tcgetpgrp(fd);
538
539 if (pgrp != ttypgrp && ppgrp != ttypgrp) {
...
// Replace fd 0, 1, 2
...
566 } ...

If (pgrp != ttypgrp && ppgrp != ttypgrp) evaluates to FALSE then the TTY argument will not replace file descriptors 0, 1 and 2.

That is exactly what happens on my system, where pgrp=673, ppgrp=0, and ttypgrp=673. Consequently file descriptors 0, 1 and 2 remain connected to /dev/null instead of being replaced by the TTY argument (/dev/tty1 in my case), and sulogin quietly fails.

Surely if an optional TTY argument is provided then it should replace file descriptors 0, 1 and 2 unconditionally.

Paul Parsons <lostdistance>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by lostdistance (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 19 Mar 2012 12:53:56 PM UTCwfinkOpen/ClosedOpen=>Closed
    Tue 26 Jul 2011 03:06:27 PM UTCwfinkStatusNone=>Fixed
    Tue 26 Jul 2011 08:52:37 AM UTCwfinkAssigned toNone=>wfink

    Back to the top


    Powered by Savane 3.1-cleanup1