Mercurial > hg
view tests/test-url-download.t @ 46415:8deab876fb59 stable
wix: tell ComponentSearch that it is finding a directory (not a file)
This is to fix an issue we've noticed where fresh installations start at
`C:\Program Files\Mercurial`, and then upgrades "walk up" the tree and end up in
`C:\Program Files` and finally `C:\` (where they stay).
ComponentSearch defaults to finding files, which I think means "it produces a
string like `C:\Program Files\Mercurial`", whereas with the type being
explicitly a directory, it would return `C:\Program Files\Mercurial\` (note the
final trailing backslash). Presumably, a latter step then tries to turn that
file name into a proper directory, by removing everything after the last `\`.
This could likely also be fixed by actually searching for the component for
hg.exe itself. That seemed a lot more complicated, as the GUID for hg.exe isn't
known in this file (it's one of the "auto-derived" ones). We could also consider
adding a Condition that I think could check the Property and ensure it's either
empty or ends in a trailing slash, but that would be an installer runtime check
and I'm not convinced it'd actually be useful.
This will *not* cause existing installations that are in one of the bad
directories to fix themselves. Doing that would require a fair amount more
understanding of wix and windows installer than I have, and it *probably*
wouldn't be possible to be 100% correct about it either (there's nothing
preventing a user from intentionally installing it in C:\, though I don't know
why they would do so).
If someone wants to tackle fixing existing installations, I think that the first
installation is actually the only one that shows up in "Add or Remove Programs",
and that its registry keys still exist. You might be able to find something
under HKEY_USERS that lists both the "good" and the "bad" InstallDirs. Mine was
under `HKEY_USERS\S-1-5-18\Software\Mercurial\InstallDir` (C:\), and
`HKEY_USERS\S-1-5-21-..numbers..\Software\Mercurial\InstallDir` (C:\Program
Files\Mercurial). If you find exactly two, with one being the default path, and
the other being a prefix of it, the user almost certainly hit this bug :D
We had originally thought that this bug might be due to unattended
installations/upgrades, but I no longer think that's the case. We were able to
reproduce the issue by uninstalling all copies of Mercurial I could find,
installing one version (it chose the correct location), and then starting the
installer for a different version (higher or lower didn't matter). I did not
need to deal with an unattended or headless installation/upgrade to trigger the
issue, but it's possible that my system was "primed" for this bug to happen
because of a previous unattended installation/upgrade.
Differential Revision: https://phab.mercurial-scm.org/D9891
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Wed, 27 Jan 2021 10:29:21 -0800 |
parents | 05d415790761 |
children | 8214c71589f6 |
line wrap: on
line source
#require serve $ hg init server $ hg serve -R server -p $HGPORT -d --pid-file=hg1.pid -E ../error.log $ cat hg1.pid >> $DAEMON_PIDS Check basic fetching $ hg debugdownload "http://localhost:$HGPORT/?cmd=lookup&key=tip" 1 0000000000000000000000000000000000000000 $ hg debugdownload -o null.txt "http://localhost:$HGPORT/?cmd=lookup&key=null" $ cat null.txt 1 0000000000000000000000000000000000000000 Check the request is made from the usual Mercurial logic (rev details, give different content if the request has a Mercurial user agent) $ get-with-headers.py --headeronly "localhost:$HGPORT" "rev/tip" content-type 200 Script output follows content-type: text/html; charset=ascii $ hg debugdownload "http://localhost:$HGPORT/rev/tip" # HG changeset patch # User # Date 0 0 # Node ID 0000000000000000000000000000000000000000 Check other kind of compatible url $ hg debugdownload ./null.txt 1 0000000000000000000000000000000000000000 Test largefile URL ------------------ $ cat << EOF >> $HGRCPATH > [extensions] > largefiles= > EOF $ killdaemons.py $ rm -f error.log hg1.pid $ hg serve -R server -p $HGPORT -d --pid-file=hg1.pid -E error.log $ cat hg1.pid >> $DAEMON_PIDS $ hg -R server debuglfput null.txt a57b57b39ee4dc3da1e03526596007f480ecdbe8 $ hg --traceback debugdownload "largefile://a57b57b39ee4dc3da1e03526596007f480ecdbe8" --config paths.default=http://localhost:$HGPORT/ 1 0000000000000000000000000000000000000000 from within a repository $ hg clone http://localhost:$HGPORT/ client no changes found updating to branch default 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd client $ hg path default = http://localhost:$HGPORT/ $ hg debugdownload "largefile://a57b57b39ee4dc3da1e03526596007f480ecdbe8" 1 0000000000000000000000000000000000000000 $ cd ..