[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2013-12-22 Thread Antoine Pitrou

Antoine Pitrou added the comment:

2.6 and 3.1 don't receive bug fixes anymore, closing.

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2013-01-24 Thread Richard Wall

Richard Wall added the comment:

This bug also causes problems when you try to install Python in a Linux  chroot 
environment or systemd-nspawn - before mounting devtmpfs.

For example, this Redhat bug yum traceback with python-2.6.6-29.el6_2.2 and 
higher + missing /dev/urandom
 * https://bugzilla.redhat.com/show_bug.cgi?id=893034

--
nosy: +richardw

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2012-09-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6a782496f90a by Antoine Pitrou in branch 'default':
Issue #15340: Fix importing the random module when /dev/urandom cannot be 
opened.
http://hg.python.org/cpython/rev/6a782496f90a

--

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2012-09-08 Thread Martin v . Löwis

Martin v. Löwis added the comment:

It's actually up to Barry (and Benjamin) to decide whether to apply this to 2.6 
(and 3.1).

--

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2012-09-07 Thread Martin v . Löwis

Martin v. Löwis added the comment:

I disagree that the regression is critical. IIUC, it fails on systems without 
urandom, such as Tru64 and HPUX. However, failure to support such systems is 
*not* critical, IMO; I think that OS-specific failures should be considered 
critical only if they occur on Linux, Windows, or OSX.

So I suggest that the priority of this issue is reduced.

More relevant than breaking HPUX is, IMO, that urandom is actually documented 
to raise NotImplementedError, so the patch looks good. For best compatibility, 
the actual spelling of the error message from 2.6 should be restored.

I'm puzzled by 

https://h20392.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=KRNG11I

which claims that HPUX 11.11 (at least) *does* have /dev/urandom. Maybe your 
installation doesn't have KRNG11i in /etc/loadmods?

Also, the claim that it breaks Tru64 contradicts with

http://en.wikipedia.org/wiki//dev/random

which claims that Tru64 5.1B (at least) does have /dev/urandom.

--
nosy: +loewis

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2012-09-07 Thread Martin v . Löwis

Martin v. Löwis added the comment:

An interesting question is whether the patch should be applied to 2.6 and 3.1. 
It is not a security fix in itself, which suggests that it shouldn't apply. 
OTOH, it's a follow-up to an earlier security fix.

--

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2012-09-07 Thread Ian Wienand

Ian Wienand added the comment:

I'm not sure what systems are defined as critical or not.

Although python is not really installable/configurable by end-users on ESXi, I 
noticed during development because we use python very early in the boot, before 
/dev/urandom appears for us (it comes from a kernel module loaded later).

--

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2012-09-07 Thread The Written Word

The Written Word added the comment:

We're running Tru64 UNIX 5.1A, not 5.1B which definitely doesn't have 
/dev/urandom.

--

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2012-09-07 Thread The Written Word

The Written Word added the comment:

We do not have KRNG11i installed. It did not ship with the original 
installation of HP-UX 11.11. It needs to be loaded after-the-fact and we cannot 
be ensured that our customers will have this module installed nor do we wish to 
make it a requirement.

--

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2012-09-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2e8b01583839 by Antoine Pitrou in branch '3.2':
Issue #15340: Fix importing the random module when /dev/urandom cannot be 
opened.
http://hg.python.org/cpython/rev/2e8b01583839

New changeset a53fc9982e2a by Antoine Pitrou in branch 'default':
Issue #15340: Fix importing the random module when /dev/urandom cannot be 
opened.
http://hg.python.org/cpython/rev/a53fc9982e2a

--
nosy: +python-dev

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2012-09-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset edbf37ace03c by Antoine Pitrou in branch '2.7':
Issue #15340: Fix importing the random module when /dev/urandom cannot be 
opened.
http://hg.python.org/cpython/rev/edbf37ace03c

--

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2012-09-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, this is now fixed in 3.2/3.3/2.7. I'll leave it to Martin and Benjamin 
whether this should be backported to 2.6 and 3.1.
(Georg, this changeset should probably be ported to 3.3.0 too)

--
priority: release blocker - high
versions:  -Python 2.7, Python 3.2, Python 3.3

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2012-09-07 Thread Georg Brandl

Georg Brandl added the comment:

Now picked into the 3.3.0 release clone as 6a782496f90a.

--

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2012-09-04 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2012-09-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

As for the patch: looks good on the principle. However, 
PyExc_NotImplementedError has no errno or filename, attribute, so you 
shouldn't use PyErr_SetFromErrnoWithFilename. Instead, simply call 
PyErr_SetString.

--

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2012-09-03 Thread The Written Word

The Written Word added the comment:

Hi Antoine,

Thanks for the heads up.

I've attached a revised patch that doesn't misuse 
PyErr_SetFromErrnoWithFilename.

--
Added file: 
http://bugs.python.org/file27113/hash-randomization-not-implemented.patch

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2012-08-31 Thread The Written Word

The Written Word added the comment:

Actually, this regression appeared after the Hash Randomization patches prior 
to 2.6.8, 2.7.3, 3.1.4 and 3.2.3.

Also, it not only breaks `from os import urandom`, but also prevents 
installation of many third-party packages that use setuptools or distribute, 
where the interpreter bails out with: OSError: No such file or directory 
/dev/urandom inside setup.py on all Tru64 machines, and HPUX 11.00 and 11.11 
(at least).

As best I can tell it's failing either because dev_urandom_noraise aborts the 
interpreter if /dev/urandom is missing, or later an uncaught PyExc_OSError in 
dev_urandom_python triggers for the same reason.  In either case there's no 
NotImplemented exception raised for the fallback code be used :(

--
nosy: +bugs-pyt...@vendor.thewrittenword.com
versions: +Python 2.6, Python 3.1, Python 3.2

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2012-08-31 Thread The Written Word

The Written Word added the comment:

The root of the problem preventing me from running some 3rd party setup.py 
scripts correctly is the mismatch between (recently) raising an OSError in 
Python/random.c, but catching only NotImplementedError in Lib/random.py.

For backwards compatibility (previous releases all raised and caught 
NotImplementedError), here is a patch that stops Python bailing out with 
OSError: No such file or directory /dev/urandom for me.  Tested with 
Python-2.6.8, Python-2.7.3 and Python-3.2.3, on HPUX 11.00, HPUX 11.11 and Tru 
64 5.1.

Arguably, as long as 3rd party code doesn't rely on the NotImplementedError 
exception, changing random.py to catch OSErrors would work equally well.

This patch does not stop dev_urandom_noraise() from halting the interpreter on 
machines with no /dev/urandom, but that seems intentional to me so I didn't try 
to fix it.

--
components: +Interpreter Core -Library (Lib)
keywords: +patch
Added file: 
http://bugs.python.org/file27070/hash-randomization-not-implemented.patch

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2012-08-31 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Looks like a critical regression to me.

--
nosy: +barry, benjamin.peterson, georg.brandl, pitrou
priority: normal - release blocker
versions: +Python 3.3

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



[issue15340] OSError with import random when /dev/urandom doesn't exist (regression from 2.6)

2012-07-12 Thread Ian Wienand

New submission from Ian Wienand i...@wienand.org:

Hi,

Lib/random.py has a fallback if os.urandom() returns NotImplementedError

---
from os import urandom as _urandom
...
   def seed(self, a=None):
if a is None:
try:
a = long(_hexlify(_urandom(16)), 16)
except NotImplementedError:
import time
a = long(time.time() * 256) # use fractional seconds
---

In 2.6, this is indeed what happens in Lib/os.py where import urandom from os 
gets [2]:

---
if not _exists(urandom):
def urandom(n):
...
  try:
_urandomfd = open(/dev/urandom, O_RDONLY)
except (OSError, IOError):
raise NotImplementedError(/dev/urandom (or equivalent) not found)
---

however, in 2.7, things have shuffled around as a result of issue Issue #13703 
and now _PyOS_URandom will return an OSError if it can't find /dev/urandom [3].

This means if you import random without /dev/urandom available it crashes 
trying to seed

I'm not sure if this is intentional?  One easy solution would be to catch 
OSError in random.py and fall back then too

[1] http://hg.python.org/cpython/file/70274d53c1dd/Python/random.c#l227
[2] http://hg.python.org/cpython/file/9f8771e09052/Lib/os.py#l746
[3] http://hg.python.org/cpython/file/70274d53c1dd/Lib/random.py#l111

--
components: Library (Lib)
messages: 165340
nosy: iwienand
priority: normal
severity: normal
status: open
title: OSError with import random when /dev/urandom doesn't exist (regression 
from 2.6)
versions: Python 2.7

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