Mercurial > p > roundup > code
comparison roundup/scripts/roundup_server.py @ 6743:d659cfa8439c
Make roundup-server EACCES errors clearer
If roundup-server is run on a priv port without privs (i.e. non root)
it just returns:
[Errno 13] Permission denied
make this case clearer by reporting:
Unable to bind to port 70, access not allowed, errno: 13 Permission denied
so it points to the port bind operation as failing.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 30 Jun 2022 16:26:53 -0400 |
| parents | 06d750efbc50 |
| children | 5129fc03dc1f |
comparison
equal
deleted
inserted
replaced
| 6742:dcf34cc31438 | 6743:d659cfa8439c |
|---|---|
| 790 httpd = server_class(*args, **kwargs) | 790 httpd = server_class(*args, **kwargs) |
| 791 except socket.error as e: | 791 except socket.error as e: |
| 792 if e.args[0] == errno.EADDRINUSE: | 792 if e.args[0] == errno.EADDRINUSE: |
| 793 raise socket.error(_("Unable to bind to port %s, " | 793 raise socket.error(_("Unable to bind to port %s, " |
| 794 "port already in use.") % self["PORT"]) | 794 "port already in use.") % self["PORT"]) |
| 795 if e.args[0] == errno.EACCES: | |
| 796 raise socket.error(_("Unable to bind to port %(port)s, " | |
| 797 "access not allowed, " | |
| 798 "errno: %(errno)s %(msg)s" % { | |
| 799 "port": self["PORT"], | |
| 800 "errno": e.args[0], | |
| 801 "msg": e.args[1] } | |
| 802 )) | |
| 803 | |
| 795 raise | 804 raise |
| 796 # change user and/or group | 805 # change user and/or group |
| 797 setgid(self["GROUP"]) | 806 setgid(self["GROUP"]) |
| 798 setuid(self["USER"]) | 807 setuid(self["USER"]) |
| 799 # return the server | 808 # return the server |
