Issue1679

Title hgweb and notify conflicts on web.baseurl config usage
Priority bug Status resolved
Superseder Nosy List abuehl, benallard, bos, djc, mpm, piranha
Assigned To Topics hgweb, regression

Created on 2009-05-27.08:12:38 by benallard, last changed 2009-07-22.22:25:20 by bos.

Messages
msg10165 (view) Author: bos Date: 2009-07-22.22:25:20
Fixed in f6eb03027411 with a new test to ensure it stays fixed.
msg10072 (view) Author: bos Date: 2009-07-16.21:57:25
This bug was introduced by piranha in dcebff8a25dd, which was supposed to
fix issue1586.

What actually happens is that the hgwebdir code mangles the web.baseurl data.

This is easy to replicate with the following two commands:

cd .../my-hg-repo/tests

perl -pi -e 's,hg serve -p \$HGPORT2,hg serve --config
web.baseurl=http://hg.example.com/ -p \$HGPORT2,' test-hgwebdir
./run-tests.py test-hgwebdir

Try it, and you'll see the following URLs in the error spat out by run-tests.py:

http:/hg.example.com//a/

Hey look, the path got mangled!
msg9889 (view) Author: benallard Date: 2009-07-03.12:20:46
Oh, and by the way, this configuration field was actually used by the notify
extension, which doesn't display clickable links anymore without that.
msg9888 (view) Author: benallard Date: 2009-07-03.12:09:47
Ok, I also found the reason of that one:

the changeset in question does what it says it does: hgwebdir now takes the
whole config files into consideration.
I had lying in my /etc/mercurial/hgrc (thanks to the new configparser with its
--debug option)

[web]
baseurl = http://hg/hg/

Was not used before, never realized it, it was working fine.

hgrc(5) says:

baseurl
    Base URL to use when publishing URLs in other locations, so
    third-party tools like email notification hooks can construct
    URLs. Example: "http://hgserver/repos/"

I guess the actual trouble is lying there as it's obviously (1) not the main
usage of baseurl, and (2) the right format for this entry.
msg9869 (view) Author: djc Date: 2009-07-02.12:02:52
That's because I'm talking about mercurial.selenic.com/hg/, not whatever's on
www.selenic.com. The former runs on mod_wsgi, the latter runs on CGI.
msg9868 (view) Author: benallard Date: 2009-07-02.11:19:48
Well, actually, it's not what I'm getting when I visit
http://www.selenic.com/repo ......

I guess you found the live server where I can demonstrate the bug live ...
msg9867 (view) Author: djc Date: 2009-07-02.10:57:19
Well, it seems to work fine on mercurial.selenic.com/hg/ (which now runs 1.3).
It has just

WSGIScriptAlias /hg /home/hg/wsgi/hgwebdir.wsgi

    <Directory /home/hg/wsgi>
        Order deny,allow
        Allow from all
    </Directory>

in the Apache config,

from mercurial.hgweb import hgwebdir
application = hgwebdir('/home/hg/webdir.config')

in the .wsgi, and

[paths]
/ = /home/hg/repos/*

in the webdir.config. So it seems like the exact same setup, but works fine.
msg9865 (view) Author: benallard Date: 2009-07-02.10:18:34
Sorry, I should have made clear that hg-stable is just an example, every
repositories listed by this hgwebdir suffer from the same syndrome.
msg9864 (view) Author: djc Date: 2009-07-02.10:16:16
Can you try calling it something-hg-stable instead of hg-stable?
msg9863 (view) Author: benallard Date: 2009-07-02.10:14:34
Yes, it still fails.

No, I can't demonstrate it live.

My hgwebdir resides at http://hg/hg

I have a repository called hg-stable listed by hgwebdir. The listing goes right
("hg-stable" is displayed on the web page), When I click on it, the link,
instead of being "http://hg/hg/hg-stable", is "http://hg/hg/hg//hg-stable",
which obviously does not link to the intended hgweb page.
msg9859 (view) Author: djc Date: 2009-07-02.09:05:27
So you're saying it still fails? Can you show some example URLs/the host on
which it's happening?
msg9858 (view) Author: benallard Date: 2009-07-02.09:00:20
No idea why I was not using this one ... probably my old CGI config was with a
ScriptAliasMatch (don't ask), upgrading to wsgi I just added the WSGI in front
of the line ...

Does not modify anything by the way.
msg9857 (view) Author: djc Date: 2009-07-02.08:45:48
Why aren't you using this?

WSGIScriptAlias /hg /var/hg/hgwebdir.wsgi
msg9856 (view) Author: benallard Date: 2009-07-02.08:43:43
Ok, I see, my one is now the same as the one in contrib (beside the config file
path which has to be absolute)

And I still get the same behavior.
msg9855 (view) Author: djc Date: 2009-07-02.08:26:49
Please just get rid of wsgiapplication(). It's for VERY old versions of hg.
msg9853 (view) Author: benallard Date: 2009-07-02.08:03:44
This changeset (dcebff8a25dd) now moved to -stable, and still cause the same
problem there.

My apache conf says:

WSGIScriptAliasMatch  ^/hg(.*)  /var/hg/hgwebdir.wsgi$1

and my wsgi script beside loading the good modules just set `application` to
wsgiapplication(hgwebdir("my/config/file"))

I don't really have time to investigate that, but let me know if you need more
informations.
msg9433 (view) Author: benallard Date: 2009-05-27.16:57:13
Woah, that's another illustration of issue1322 ...

My local -stable repository is pointing to http://www.selenic.com/hg/hg-stable
which obviously is not -stable ... No idea where did I get this URL from ...
Note that this wrong URL has another style than the *right* one, which is also
confusing.

(For the completeness, the right one is http://www.selenic.com/repo/hg-stable)
msg9432 (view) Author: mpm Date: 2009-05-27.16:26:05
Recommend you downgrade to -actual- stable for now, which only has 7898
changesets at present. Degrading to bug.
msg9428 (view) Author: djc Date: 2009-05-27.08:30:26
I don't think we're actually changing the paths section to hgweb-paths, we're 
just re-mapping it internally to prevent conflicts with the normal hgrc paths 
section. We really need to get a good fix on all the stupid URL issues...
msg9427 (view) Author: benallard Date: 2009-05-27.08:12:37
My mercurial server resides at http://server/hg/. So I usually access my
repositories at http://server/hg/repoX/

I tried to update my mercurial version on my server this morning to -stable.

The URL in my index page are not properly formed any more, but look like:
http://server/hg/hg//repoX/

The first mis-behaving revision is 8345:dcebff8a25dd (hgwebdir: read
--webdir-conf as actual configuration to ui (issue1586))

FYI, my hgweb.config file has just two lines being:

[paths]
/ = /path/to/repositories/**

Furthermore, I just noticed that this same revision switch from [paths] to
[hgweb-paths]. Backward compatibility is assured, but no documentation is updated.
History
Date User Action Args
2009-07-22 22:25:20bossetstatus: chatting -> resolved
nosy: mpm, bos, djc, abuehl, benallard, piranha
messages: + msg10165
2009-07-16 21:57:25bossetnosy: + bos
messages: + msg10072
2009-07-03 12:20:46benallardsetnosy: mpm, djc, abuehl, benallard, piranha
messages: + msg9889
title: hgwebdir index produce wrong URLs -> hgweb and notify conflicts on web.baseurl config usage
2009-07-03 12:09:47benallardsetnosy: mpm, djc, abuehl, benallard, piranha
messages: + msg9888
2009-07-03 08:58:30abuehlsetnosy: + abuehl
2009-07-02 12:02:52djcsetnosy: mpm, djc, benallard, piranha
messages: + msg9869
2009-07-02 11:19:48benallardsetnosy: mpm, djc, benallard, piranha
messages: + msg9868
2009-07-02 10:57:19djcsetnosy: mpm, djc, benallard, piranha
messages: + msg9867
2009-07-02 10:18:34benallardsetnosy: mpm, djc, benallard, piranha
messages: + msg9865
2009-07-02 10:16:16djcsetnosy: mpm, djc, benallard, piranha
messages: + msg9864
2009-07-02 10:14:34benallardsetnosy: mpm, djc, benallard, piranha
messages: + msg9863
2009-07-02 09:05:27djcsetnosy: mpm, djc, benallard, piranha
messages: + msg9859
2009-07-02 09:00:20benallardsetnosy: mpm, djc, benallard, piranha
messages: + msg9858
2009-07-02 08:45:48djcsetnosy: mpm, djc, benallard, piranha
messages: + msg9857
2009-07-02 08:43:43benallardsetnosy: mpm, djc, benallard, piranha
messages: + msg9856
2009-07-02 08:26:49djcsetnosy: mpm, djc, benallard, piranha
messages: + msg9855
2009-07-02 08:03:44benallardsetnosy: mpm, djc, benallard, piranha
messages: + msg9853
2009-05-27 16:57:13benallardsetnosy: mpm, djc, benallard, piranha
messages: + msg9433
2009-05-27 16:26:05mpmsetpriority: urgent -> bug
nosy: + mpm
messages: + msg9432
2009-05-27 08:30:26djcsetstatus: unread -> chatting
nosy: + djc
messages: + msg9428
2009-05-27 08:12:38benallardcreate