test_posix fails for me in current CVS: ERROR: testNoArgFunctions (__main__.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_posix.py", line 46, in testNoArgFunctions posix_func() OSError: [Errno 2] No such file or directory ---------------------------------------------------------------------- Ran 18 tests in 0.038s narrowed down to posix.getlogin(). FTR I'm on RH7.3. Here's the fun part <wink>: this succeeds if running in an xterm, but fails if running in a XEmacs 21.4.11 shell buffer. I tried it with Emacs 21.2 as well and it also fails there. A little C program calling getlogin() gives the same results. It also fails in a XEmacs compilation buffer. So the os.isatty() test isn't enough. This returns True in all three shells but getlogin() still fails. The weird thing is that I've never seen failures here before and I do this type of testing all the time. Does anybody else see this? Maybe we should just remove getlogin() from NO_ARG_FUNCTIONS? -Barry
On Mon, Mar 17, 2003 at 02:39:43PM -0500, Barry A. Warsaw wrote:
test_posix fails for me in current CVS:
narrowed down to posix.getlogin(). FTR I'm on RH7.3.
Here's the fun part <wink>: this succeeds if running in an xterm, but fails if running in a XEmacs 21.4.11 shell buffer. I tried it with Emacs 21.2 as well and it also fails there. A little C program calling getlogin() gives the same results. It also fails in a XEmacs compilation buffer.
So the os.isatty() test isn't enough. This returns True in all three shells but getlogin() still fails. The weird thing is that I've never seen failures here before and I do this type of testing all the time.
Getlogin isn't guaranteed to work even when running in a terminal. Using the excellent 'screen' tool, you can 'log out' your session (on a per-shell basis.) Being 'logged in' just means there is an entry for your terminal in /var/run/utmp (although the location of the 'utmp' file is system-dependent.) Observe:
os.getlogin() 'thomas' ^AL This window is no longer logged in. os.getlogin() Traceback (most recent call last): File "<stdin>", line 1, in ? OSError: [Errno 2] No such file or directory
Inbetween the two 'getlogin' calls, I hit '^A', 'L', and screen told me
"This window is no longer logged in." And look, ma, no login. Note that
there isn't really a portable way to write utmp (screen jumps through hoops,
and disables the ability if it can't figure out how to do it) and it might
need special privileges, so we can't just add a utmp entry to check against.
I'm guessing you updated your (X)Emacs, your libc or something else on your
platform that causes this problem for you, Barry. Perhaps the 'getlogin'
test needs a 'utmp' resource ? :-)
--
Thomas Wouters
"TW" == Thomas Wouters
writes:
TW> I'm guessing you updated your (X)Emacs, your libc or something TW> else on your platform that causes this problem for you, TW> Barry. Who knows? :) TW> Perhaps the 'getlogin' test needs a 'utmp' resource ? TW> :-) Maybe we should just ditch the test. It's only there to make sure that getlogin() takes no arguments. -Barry
On Mon, Mar 17, 2003 at 03:06:32PM -0500, Barry A. Warsaw wrote:
"TW" == Thomas Wouters
writes: TW> I'm guessing you updated your (X)Emacs, your libc or something TW> else on your platform that causes this problem for you, TW> Barry.
Who knows? :)
TW> Perhaps the 'getlogin' test needs a 'utmp' resource ? TW> :-)
Maybe we should just ditch the test. It's only there to make sure that getlogin() takes no arguments.
I think the test should be removed. I'm the one who added it, but there have been too many problems with it to make it useful. I will remove it later, unless someone beats me to it. Neal
participants (3)
-
barry@python.org
-
Neal Norwitz
-
Thomas Wouters