[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-06-03 Thread Dominik Richter

Dominik Richter added the comment:

Thank you all for your help, works great!
@Victor: fully agree on the ascii hostname ;)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-06-03 Thread STINNER Victor

STINNER Victor added the comment:

Oh, by the way, I also changed socket.gethostname().

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-06-03 Thread STINNER Victor

STINNER Victor added the comment:

test_logging is failing with a non-ASCII hostname because of the following 
error:

error: uncaptured python exception, closing channel 
 
(:'ascii' codec can't encode character '\xe9' in 
position 6: ordinal not in range(128) 
[/home/haypo/prog/python/default/Lib/asyncore.py|read|83] 
[/home/haypo/prog/python/default/Lib/asyncore.py|handle_read_event|436] 
[/home/haypo/prog/python/default/Lib/asyncore.py|handle_accept|513] 
[/home/haypo/prog/python/default/Lib/test/test_logging.py|handle_accepted|746] 
[/home/haypo/prog/python/default/Lib/test/test_logging.py|__init__|692] 
[/home/haypo/prog/python/default/Lib/smtpd.py|push|276])

SMTPChannel.push() uses explicitly the ASCII encoding, whereas test_logging 
pass the FQDN to push().

I'm not interested to work on this issue. Please open a new issue if you 
consider important enough.

--

More tests are also failing with *undecodable* hostnames (ex: "aé€\udcff" with 
UTF-8 locale encoding): test_socket test_urllib test_urllib2 test_logging 
test_pydoc test_smtplib.

I fixed and closed the issue, even I still think that you should only use ASCII 
for your hostname ;-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-06-03 Thread STINNER Victor

STINNER Victor added the comment:

issue18109.patch is not correct: it uses the locale encoding in strict mode, 
the surrogateescape error handler should be used instead. I rewrote the patch. 
I removed the unit test because changing a hostname is really unexpected and 
may break (crash?) running desktop applications. The hostname is something too 
critical IMO. I ran the test manually on my Linux box at least ;-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-06-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ffdee6b36305 by Victor Stinner in branch '3.3':
Close #18109: os.uname() now decodes fields from the locale encoding, and
http://hg.python.org/cpython/rev/ffdee6b36305

New changeset 2472603af83e by Victor Stinner in branch 'default':
(Merge 3.3) Close #18109: os.uname() now decodes fields from the locale
http://hg.python.org/cpython/rev/2472603af83e

--
nosy: +python-dev
resolution: invalid -> fixed
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-06-03 Thread Dmi Baranov

Dmi Baranov added the comment:

There is patch. Test is non-LGTM, because having a side effect for hostname and 
requires root's permissions for manipulations with hostname[*]. Someone having 
ideas how I can "mock" system `uname` call?

[*] But this way is OK for Lib/test/test_sockets.py. I'm overheading here? (-:

--
keywords: +patch
Added file: http://bugs.python.org/file30454/issue18109.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-06-02 Thread Dmi Baranov

Dmi Baranov added the comment:

Thanks Charles - I'm reproduced Dominik's issue at default branch:

$ python -c 'import os, sys;print(sys.version);print(os.uname())' 
3.4.0a0 (default:adfec512fb32, Jun  3 2013, 08:09:43) 
[GCC 4.6.3]
Traceback (most recent call last):
  File "", line 1, in 
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal 
not in range(128)

Lastest branches affected only, so - this a bug.

$ python -c 'import os, sys;print(sys.version);print(os.uname())'
2.7.5+ (2.7:e9d0fb934b46, Jun  3 2013, 08:05:55) 
[GCC 4.6.3]
('Linux', 'h\xc3\xa2t', '3.2.0-32-generic', '#51-Ubuntu SMP Wed Sep 26 21:32:50 
UTC 2012', 'i686')

$ python -c 'import os, sys;print(sys.version);print(os.uname())'
3.2.5 (3.2:b9b521efeba3, Jun  3 2013, 08:24:06) 
[GCC 4.6.3]
('Linux', 'hât', '3.2.0-32-generic', '#51-Ubuntu SMP Wed Sep 26 21:32:50 UTC 
2012', 'i686')

Env:
$ hostname
hât
$ locale
LANG=en_US.UTF-8
...

BTW, that issue do not allow to compile from sources on hosts with similar 
names, I've created separate issue #18124 (possible a duplicate, but another 
behavior)

--
components: +Library (Lib)
type: crash -> behavior
versions: +Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-06-01 Thread Dominik Richter

Dominik Richter added the comment:

/off: nevermind, wasn't directed at me

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-06-01 Thread Dominik Richter

Dominik Richter added the comment:

@neologix: (with current hostname showing at the left of my prompt)

none:~ #> echo hât > /proc/sys/kernel/hostname
hât:~ #> hostname
hât

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-06-01 Thread Charles-François Natali

Charles-François Natali added the comment:

To reproduce the issue, try this:
# echo  > /proc/sys/kernel/hostname

> the locale encoding + surrogateescape error handler

Sounds reasonable.

--
nosy: +neologix

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-05-31 Thread R. David Murray

R. David Murray added the comment:

Issue 10097 may also have some relevant discussion, even though that issue 
originates from Windows.

--
nosy: +r.david.murray

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-05-31 Thread Dominik Richter

Dominik Richter added the comment:

@haypo: You're right, RFC1178 is only a recommendation. RFC952 however is 
mandatory, although it doesn't seem to define  explicitly (or at 
least i wasn't able to find it; thus referencing POSIX).

Regarding Arch Linux's hostname: It is part of the package inetutils v1.9.1-5 
[1], which is GNU inetutils packaged [2]. Unfortunately I don't know which 
encoding it uses. I agree with you: It would be great if python supported it.

fyi: I opened a bug on Arch Linux [3] (thank you Dmi for the suggestion)

[1] https://www.archlinux.org/packages/core/i686/inetutils/
[2] http://www.gnu.org/software/inetutils/
[3] https://bugs.archlinux.org/task/35580

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-05-31 Thread STINNER Victor

STINNER Victor added the comment:

"""
http://tools.ietf.org/html/rfc1178
  Don't use non-alphanumeric characters in a name.
"""

This is a recommendation, it does not mean that it is forbidden. But on Fedora, 
I'm unable to set a non-ASCII hostname. Arch Linux may be different.

Python should not fail with non-ASCII hostname, but I don't know which encoding 
should be used: ascii/surrogateescape (PEP 383)? the locale encoding + 
surrogateescape error handler?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-05-31 Thread Dominik Richter

Dominik Richter added the comment:

@dmi.baranov: You're right, according to:
http://tools.ietf.org/html/rfc952
   ::= *["."]
::= [*[]]
http://tools.ietf.org/html/rfc1178
  Don't use non-alphanumeric characters in a name.
If you use posix definition of alphanumeric, that fits. What a shame ;)

--
resolution:  -> invalid
type: behavior -> crash

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-05-31 Thread Dmi Baranov

Dmi Baranov added the comment:

/offtop Dumn, sorry for duplication here, Victor. We not having websockets 
here, my page not refreshed.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-05-31 Thread Dmi Baranov

Dmi Baranov added the comment:

I just checked RFC952 [1] and RFC1123 [2], that host name is incorrect.
I think, you need report to Arch Linux bug-tracker.

$ sudo hostname hât
hostname: the specified hostname is invalid
$ uname -a
Linux d9frog9n-desktop 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26

[1] http://tools.ietf.org/html/rfc952
[2] http://tools.ietf.org/html/rfc1123

--
nosy: +dmi.baranov

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-05-31 Thread STINNER Victor

STINNER Victor added the comment:

See also issue #9377 (similar issue with the socket module).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-05-31 Thread STINNER Victor

STINNER Victor added the comment:

I'm unable to set an non-ASCII hostname on Fedora 18 (Linux kernel 3.9.2):

$ sudo hostname hât
hostname: the specified hostname is invalid

--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-05-31 Thread Charles-François Natali

Changes by Charles-François Natali :


--
type: crash -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18109] os.uname() crashes if hostname contains non-ascii characters

2013-05-31 Thread Dominik Richter

New submission from Dominik Richter:

To reproduce (tested on Arch Linux, python 3.3.2):

  sudo hostname hât
  python -c "import os; os.uname()"

produces:

  Traceback (most recent call last):
File "", line 1, in 
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: 
ordinal not in range(128)

--
components: Unicode
messages: 190413
nosy: Dominik.Richter, ezio.melotti
priority: normal
severity: normal
status: open
title: os.uname() crashes if hostname contains non-ascii characters
type: crash
versions: Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com