I moved to a new server and am trying to use mercurial's hgweb server. As always it works fine on the old server....
Ubuntu 22, python 3.10, mercurial 6.1
I get this error when hitting the web address https://url/hg, I can't find any reference to "Mercurial only supports encoded strings"?
[Sun Mar 24 16:48:30.464715 2024] [cgi:error] [pid 41415] [client 172.0.6.80:56644] AH01215: Traceback (most recent call last):: /var/www/cgi-hg/hgweb.cgi
[Sun Mar 24 16:48:30.464776 2024] [cgi:error] [pid 41415] [client 172.0.6.80:56644] AH01215: File "/var/www/cgi-hg/hgweb.cgi", line 21, in <module>: /var/www/cgi-hg/hgweb.cgi
[Sun Mar 24 16:48:30.464798 2024] [cgi:error] [pid 41415] [client 172.0.6.80:56644] AH01215: application = hgweb("hgweb.config"): /var/www/cgi-hg/hgweb.cgi
[Sun Mar 24 16:48:30.464864 2024] [cgi:error] [pid 41415] [client 172.0.6.80:56644] AH01215: File "/usr/lib/python3/dist-packages/mercurial/hgweb/__init__.py", line 41, in hgweb: /var/www/cgi-hg/hgweb.cgi
[Sun Mar 24 16:48:30.464894 2024] [cgi:error] [pid 41415] [client 172.0.6.80:56644] AH01215: raise error.ProgrammingError(: /var/www/cgi-hg/hgweb.cgi
[Sun Mar 24 16:48:30.464945 2024] [cgi:error] [pid 41415] [client 172.0.6.80:56644] AH01215: mercurial.error.ProgrammingError: Mercurial only supports encoded strings: 'hgweb.config': /var/www/cgi-hg/hgweb.cgi
[Sun Mar 24 16:48:30.473397 2024] [cgi:error] [pid 41415] [client 172.0.6.80:56644] End of script output before headers: hgweb.cgi
the script hgweb.cgi
#!/usr/bin/env python3
#
# An example hgweb CGI script, edit as necessary
# See also https://mercurial-scm.org/wiki/PublishingRepositories
# Path to repo or hgweb config to serve (see 'hg help hgweb')
config = "/var/www/cgi-hg/hbweb.config"
# Uncomment and adjust if Mercurial is not installed system-wide
# (consult "installed modules" path from 'hg debuginstall'):
#import sys; sys.path.insert(0, "/path/to/python/lib")
# Uncomment to send python tracebacks to the browser if an error occurs:
#import cgitb; cgitb.enable()
from mercurial import demandimport
demandimport.enable()
from mercurial.hgweb import hgweb, wsgicgi
application = hgweb("hgweb.config")
wsgicgi.launch(application)
here is hgweb.config
[paths]
#VIRTUAL_PATH = /REAL/PATH
#mbel = /home/repos/mbel
admin = /home/repos/admin
mbepp = /home/repos/mbepp
mbepEditor = /home/repos/mbepEditor
monitor= /home/repos/monitor
solrproxy= /home/repos/solrproxy
mbep-data= /home/repos/mbep-data
mbep-util= /home/repos/mbep-util
mbep-editor= /home/repos/mbep-editor
installer=/home/repos/installer
updater=/home/repos/updater
[web]
style = gitweb
# descend = true
here is the apache conf file hg.conf
ScriptAliasMatch ^/hg(.*) /var/www/cgi-hg/hgweb.cgi/$1
<Directory /var/www/cgi-hg/>
Options ExecCGI FollowSymLinks Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory /home/repos/>
Options FollowSymLinks
AllowOverride None
Allow from all
</Directory>
<Location /hg>
Options FollowSymLinks
# AllowOverride None
Allow from all
# AuthType Basic
# AuthName "Mercurial repositories"
# AuthUserFile /home/repos/repospassword
# Require valid-user
</Location>
I'm not a python programmer and am stumped...
thanks, Scott
programming error of course.
two lines
changed to
the b somehow indicates an encoding?
becomes
the hgweb() call expects a variable set above as config?
Here is the fixed hgweb.cgi file