[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. -- ___

[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 ___

[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 _

[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

[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 on

[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 entr

[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 _

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

2010-03-22 Thread R. David Murray
R. David Murray 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

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

2010-03-22 Thread STINNER Victor
Changes by STINNER Victor : -- resolution: fixed -> wont fix ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

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

2010-03-22 Thread STINNER Victor
STINNER Victor 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: -> fixe

[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

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

2008-11-05 Thread Peter Åstrand
New submission from Peter Åstrand <[EMAIL PROTECTED]>: The getpwnam function in the pwd module does not correctly distinguish between the case when the user does not exist and error conditions. getpwnam() returns NULL in both cases, the the calling code needs to check errno to determine if an err