New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os.getlogin() - Inappropriate ioctl for device (mod_wsgi) #39

Closed
gvalkov opened this Issue Nov 30, 2011 · 2 comments

Comments

Projects
None yet
2 participants
@gvalkov

gvalkov commented Nov 30, 2011

Using gitpython from within a mod_wsgi web app results in the following exception when trying to commit:

  File "...GitPython-0.3.2.RC1-py2.6.egg/git/index/base.py", line 887, in commit 
    return Commit.create_from_tree(self.repo, tree, message, parent_commits, head) 
  File "...GitPython-0.3.2.RC1-py2.6.egg/git/objects/commit.py", line 302, in create_from_tree 
    committer = Actor.committer(cr) 
  File "...GitPython-0.3.2.RC1-py2.6.egg/git/util.py", line 354, in committer 
    return cls._main_actor(cls.env_committer_name, cls.env_committer_email, config_reader) 
  File "...GitPython-0.3.2.RC1-py2.6.egg/git/util.py", line 327, in _main_actor 
    default_email = get_user_id() 
  File "...GitPython-0.3.2.RC1-py2.6.egg/git/util.py", line 120, in get_user_id 
    username = os.getlogin() 
OSError: [Errno 25] Inappropriate ioctl for device 

A possible explanation might be that since apache/mod_wsgi are not started by a login shell, no call to setlogin() has been made (in order for getlogin() to succeed a previous call to setlogin() must have been made). Perhaps the problem is in mod_wsgi running in daemon mode. Either way, a more robust get_user_id() function would be nice.

A non-portable solution:

120: username = pwd.getpwuid(os.getuid()).pw_name

These could also be helpful:
http://defect.opensolaris.org/bz/show_bug.cgi?id=3595
http://www.agmweb.ca/blog/andy/2172/ (comment by Graham Dumpleton)

@Byron

This comment has been minimized.

Show comment
Hide comment
@Byron

Byron Dec 1, 2011

Member

Hi Georgi,

Thank you very much for your detailed report ! Your amendments and comments will be of great help when fixing this !
However, I will not be able to get back to GitPython before January next year, and until then all issues have to wait.

In the meanwhile, If you find the time to provide a fix, I will be glad to merge it into 0.3x before that date.
Cheers,
Sebastian

Member

Byron commented Dec 1, 2011

Hi Georgi,

Thank you very much for your detailed report ! Your amendments and comments will be of great help when fixing this !
However, I will not be able to get back to GitPython before January next year, and until then all issues have to wait.

In the meanwhile, If you find the time to provide a fix, I will be glad to merge it into 0.3x before that date.
Cheers,
Sebastian

@Byron

This comment has been minimized.

Show comment
Hide comment
@Byron

Byron Jun 7, 2012

Member

I think this is fixed with #43.

Member

Byron commented Jun 7, 2012

I think this is fixed with #43.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment