[issue4261] The pwd module doesn't distinguish between errors and no user

2014-03-23 Thread STINNER Victor

STINNER Victor added the comment:

According to the manual page, there is no guarantee that missing user and error 
give a different result. Extracts of the manual page.


Return Value

The getpwnam() and getpwuid() functions return a pointer to a passwd structure, 
or NULL if the matching entry is not found or an error occurs. If an error 
occurs, errno is set appropriately. If one wants to check errno after the call, 
it should be set to zero before the call.

(...)

Errors

0 or ENOENT or ESRCH or EBADF or EPERM or ...

The given name or uid was not found. 


errno=0 is not always the case for mising user.

--

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



[issue4261] The pwd module doesn't distinguish between errors and no user

2014-03-23 Thread R. David Murray

R. David Murray added the comment:

I read that first paragraph as the controlling one, and that says that errno 
will be zero if the problem was that the entry could not be found, and non-zero 
if some other error occurred.

Raising an error would be a backward incompatible change, so it could only be 
done in 3.5.

--
versions:  -Python 2.7

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



[issue4261] The pwd module doesn't distinguish between errors and no user

2014-03-23 Thread STINNER Victor

STINNER Victor added the comment:

The current code doesn't check errno, but if the result is NULL. NULL is
returned if the user doesn't exist, or if an error occurred. But it looks
like errno is not always 0 when the user doesn't exist.

--

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



[issue4261] The pwd module doesn't distinguish between errors and no user

2014-03-23 Thread R. David Murray

R. David Murray added the comment:

Can you think of any circumstance in which getpwnam would be able to read the 
file to look for the user, and yet errno is non-zero?

--

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



[issue4261] The pwd module doesn't distinguish between errors and no user

2014-03-23 Thread STINNER Victor

STINNER Victor added the comment:

Getpwnam() can use a lot of various auth method. For example, an external
LDAP server.

--

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



[issue4261] The pwd module doesn't distinguish between errors and no user

2014-03-23 Thread R. David Murray

R. David Murray added the comment:

I don't think that changes the picture.  If the error code is non-zero, that 
means that one of the access methods failed, which means getpwnam can't report 
reliably whether or not that user exists according to the system configuration.

--

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



[issue4261] The pwd module doesn't distinguish between errors and no user

2014-03-22 Thread Mark Lawrence

Mark Lawrence added the comment:

I'm assuming that 2.7 and 3.5 would need patches.

--
nosy: +BreamoreBoy
versions: +Python 3.5 -Python 2.6, Python 3.1, Python 3.2

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



[issue4261] The pwd module doesn't distinguish between errors and no user

2010-03-22 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

This issue is open since 2 years without any patch. It looks like the feature 
request is not really important, and I consider that we can close it. Reopen 
the issue (with a patch!) if you consider that this ticket is important.

--
resolution:  - fixed
status: open - closed

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



[issue4261] The pwd module doesn't distinguish between errors and no user

2010-03-22 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
resolution: fixed - wont fix

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



[issue4261] The pwd module doesn't distinguish between errors and no user

2010-03-22 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Victor, since this is a real,fixable bug but nobody has stepped forward with a 
patch, I think it is better make its status 'languishing' with the reason 'no 
one has stepped forward with a patch'.  This kind of thing is exactly what we 
introduced languishing for.  And two years is nothing ;)

--
components: +Extension Modules -Library (Lib)
keywords: +easy
nosy: +r.david.murray
priority:  - normal
resolution: wont fix - accepted
stage:  - test needed
status: closed - languishing
versions: +Python 2.6, Python 2.7, Python 3.1, Python 3.2 -Python 2.4

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



[issue4261] The pwd module doesn't distinguish between errors and no user

2008-11-05 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

You're right. getpwnam() and getpwuid() have to check errno. A 
different error should be raised, something like:
   RuntimeError(getpwnam(%s) failure: %s % (name, strerror(errno)))

The grp should also be affected.

--
nosy: +haypo

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4261
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com