[Python-bugs-list] [ python-Bugs-775985 ] Solaris error doing a print

SourceForge.net noreply@sourceforge.net
Mon, 28 Jul 2003 22:07:08 -0700


Bugs item #775985, was opened at 2003-07-23 10:18
Message generated for change (Comment added) made by anthonybaxter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=775985&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
>Priority: 6
Submitted By: Mark Hammond (mhammond)
Assigned to: Nobody/Anonymous (nobody)
Summary: Solaris error doing a print

Initial Comment:
As seen on Jeff Hobb's box.

print "Registering '%s' (%s)" % (reg_contractid, fname)
  File
"/usr/local/python-2.3/lib/python2.3/encodings/__init__.py",
line 84, in search_function
    globals(), locals(), _import_tail)
ValueError: Empty module name

It seems that this shell has an empty "LANG" var setup
- deleting this var seems to solve the problem.

Looking in sysmodule.c, I see:

	if(codeset && isatty(fileno(stdin))){
(and a similar one for stdout).  Should this be:
	if(codeset && *codeset && isatty(fileno(stdin))){

to prevent an empty name?  Or better, should we check
the encoding is actually installed?

I will mail Jeff and ask him to attach comments on the
version or anything else.

----------------------------------------------------------------------

>Comment By: Anthony Baxter (anthonybaxter)
Date: 2003-07-29 15:07

Message:
Logged In: YES 
user_id=29957

woops. I accidently reset the priority (overlapping commit)

----------------------------------------------------------------------

Comment By: Anthony Baxter (anthonybaxter)
Date: 2003-07-29 14:49

Message:
Logged In: YES 
user_id=29957

I can't reproduce this on Solaris 2.6 (x86 version).

<anthony@star>$ env LANG="" ./python
Python 2.3 (#1, Jul 29 2003, 04:41:38) 
[GCC egcs-2.91.57 19980901 (egcs-1.1 release)] on sunos5
Type "help", "copyright", "credits" or "license" for more
information.
>>> print "hello world"
hello world
>>> ^D
<anthony@star>$ uname -a
SunOS star 5.6 Generic_105182-05 i86pc i386 i86pc

I also tried unsetting LANG, setting it to the empty string,
to a single space, and was unable to get any problems to
show. It also doesn't show on Solaris 2.7 (sparc) - I no
longer have any sparcs running 2.6.

I'd say it's safe to lower the priority and miss this one
for 2.3.



----------------------------------------------------------------------

Comment By: Barry A. Warsaw (bwarsaw)
Date: 2003-07-29 14:42

Message:
Logged In: YES 
user_id=12800

I'm taking this to mean <wink> that there's nothing
showstopping for Python 2.3 final here.  If we want to
implement the workaround for the Solaris bug in 2.3.1, then
we can do that when we have some breathing room.  Lowering
the priority.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2003-07-29 14:35

Message:
Logged In: YES 
user_id=21627

This is not reproducable on Linux. nl_langinfo(CODESET) will
always give a non-empty string. If LANG is not set, the user
thereby requests the "POSIX" locale, and its codeset is
ANSI_X3.4-1968.

So it *is* a bug in that Solaris version that it returns an
empty string; the empty string is a valid return value only
if the argument to nl_langinfo was invalid. Since the system
does support querying the CODESET in principle, it should
not be possible to ever get an empty string.

----------------------------------------------------------------------

Comment By: Jeffrey Hobbs (hobbs)
Date: 2003-07-29 14:08

Message:
Logged In: YES 
user_id=72656

I think you have to unset LANG rather than set to "", but I'm 
not really understanding this one, so I defer to Mark.

----------------------------------------------------------------------

Comment By: Barry A. Warsaw (bwarsaw)
Date: 2003-07-29 13:15

Message:
Logged In: YES 
user_id=12800

Before I can comment on this for 2.3 (and time is very
quickly running out), can you provide:

1. a recipe to reproduce this on RH9 or other Linux?  I
tried in bash:

% export LANG=""
% ./python
>>> print "foo"
foo
>>>

i.e. nothing happened, so I'm sure I'm not doing this right.
 Also, any possibility of a test case?


----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2003-07-23 15:16

Message:
Logged In: YES 
user_id=21627

I'm tempted to declare this a platform bug: Both Linux and
later Solaris versions set the CODEPAGE to ASCII for an
empty LANG (i.e. assume this is the "C" locale).

Still, checking whether the encoding is present is probably
a good idea. Unfortunately, it cannot be done right there,
since loading of codecs does not work yet inside _PySys_Init.

So as a work-around for 2.3, we should check for non-empty
strings, and leave checking for supported encodings for 2.3.1.
Patch attached.

----------------------------------------------------------------------

Comment By: Jeffrey Hobbs (hobbs)
Date: 2003-07-23 10:26

Message:
Logged In: YES 
user_id=72656

python 2.3rc1, build --enable-shared.

Solaris uname -a:
SunOS knife 5.6 Generic_105181-05 sun4u sparc SUNW,Ultra-
250

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=775985&group_id=5470