[Python-Dev] [Python-checkins] python/dist/src/Lib/test regrtest.py, 1.171, 1.172 test_ioctl.py, 1.2, 1.3

Guido van Rossum guido at python.org
Thu Sep 15 01:53:59 CEST 2005


On 9/14/05, Neal Norwitz <nnorwitz at gmail.com> wrote:
> > Index: test_ioctl.py
> > ===================================================================
> > RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ioctl.py,v
> > retrieving revision 1.2
> > retrieving revision 1.3
> > diff -u -d -r1.2 -r1.3
> > --- test_ioctl.py       20 Mar 2003 04:33:16 -0000      1.2
> > +++ test_ioctl.py       14 Sep 2005 18:09:41 -0000      1.3
> > @@ -16,19 +16,23 @@
> >
> >  class IoctlTests(unittest.TestCase):
> >      def test_ioctl(self):
> > -        pgrp = os.getpgrp()
> > +        # If this process has been put into the background, TIOCGPGRP returns
> > +        # the session ID instead of the process group id.
> > +        ids = (os.getpgrp(), os.getsid(0))
> >          tty = open("/dev/tty", "r")
> >          r = fcntl.ioctl(tty, termios.TIOCGPGRP, "    ")
> > -        self.assertEquals(pgrp, struct.unpack("i", r)[0])
> > +        rpgrp = struct.unpack("i", r)[0]
> > +        self.assert_(rpgrp in ids, "%s not in %s" % (rpgrp, ids))
> 
> With the change to use unsigned ints in pwd and grp modules, should
> the struct.unpack() use "I" (capital i) instead of "i"?

I asked the author of the patch (Monte Davidoff, who occasionally
comes to baypiggies meetings :-) and his response is:

"""
No.  The change to the pwd and grp modules and the change to test_ioctl
are unrelated.  Unfortunately, the term "group" is overloaded, which
leads to confusion.

The pwd and grp modules read the password database and the group
database, which are attributes of a UNIX user.

The test_ioctl test case is calling the TIOCGPGRP ioctl, which returns
the process group id, which is an attribute of the process.  This has
type pid_t, which is signed.

I hope this clarifies the situation.  I am glad to hear that it is
checked in!

Monte
"""

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list