Gregory Szorc <gregory.szorc@gmail.com> [Wed, 30 Jan 2019 09:52:16 -0800] rev 41463
tests: add b'' prefixes to badserverext.py
This avoids a handful of failures due to missing str and bytes.
# skip-blame: just a bunch of b'' prefixes
Differential Revision: https://phab.mercurial-scm.org/D5750
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 30 Jan 2019 11:44:34 -0800] rev 41462
hgweb: log error before attempting I/O
Previously, an uncaught exception during HTTP request serving would
attempt to send an error response then log the exception.
If an exception occurred during I/O, this exception would be
raised and the original exception wouldn't be logged.
This commit changes behavior so the original exception is logged
first, before we attempt to do anything else. This ensures the
exception is logged.
This change resulted in new tracebacks appearing in various tests.
Because tracebacks can vary between Python versions, we added a
simple script to filter the stack part of traceback lines. This
makes testing much simpler, as we don't need to glob over lines
and make lines conditional.
Differential Revision: https://phab.mercurial-scm.org/D5749
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 29 Jan 2019 11:51:19 -0800] rev 41461
tests: write commit message using file I/O
Python 2.7 will print() \x94\x5c\x0a whereas Python 3 will
print() \xc2\x94\x5c\x0a. Why, I'm not sure. It probably has to
do with print() being Unicode aware on Python 3 and Python
attempting some kind of encoding before emitting the output.
This difference results in a different bytes making it to the
commit message and the JSON output varying. We work around
this by writing bytes to a commit message file.
Differential Revision: https://phab.mercurial-scm.org/D5741
Augie Fackler <raf@durin42.com> [Fri, 01 Feb 2019 13:44:09 -0500] rev 41460
Added signature for changeset
83377b4b4ae0
Augie Fackler <raf@durin42.com> [Fri, 01 Feb 2019 13:44:07 -0500] rev 41459
Added tag 4.9 for changeset
83377b4b4ae0
Yuya Nishihara <yuya@tcha.org> [Tue, 08 Jan 2019 22:19:36 +0900] rev 41458
subrepo: reject potentially unsafe subrepo paths (BC) (SEC)
In addition to the previous patch, this prohibits '~', '$nonexistent', etc.
for any subrepo types. I think this is safer, and real-world subrepos wouldn't
use such (local) paths.
Yuya Nishihara <yuya@tcha.org> [Tue, 08 Jan 2019 22:07:45 +0900] rev 41457
subrepo: prohibit variable expansion on creation of hg subrepo (SEC)
It's probably wrong to expand path at localrepo.*repository() layer, but
fixing the layering issue would require careful inspection of call paths.
So, this patch adds add a validation to the subrepo constructor.
os.path.realpath(util.expandpath(root)) is what vfsmod.vfs() would do.
Yuya Nishihara <yuya@tcha.org> [Tue, 08 Jan 2019 21:51:54 +0900] rev 41456
subrepo: extend path auditing test to include more weird patterns (SEC)
While reviewing patches for the issue 5739, "$foo in repository path
expanded", I realized that subrepo paths can also be cheated. This patch
includes various subrepo paths which are potentially unsafe.
Since an expanded subrepo path isn't audited, this bug allows symlink check
bypass. As a result, a malicious subrepository could be checked out to a
sub tree of e.g. $HOME directory. The good news is that the destination
directory must be empty or nonexistent, so the existing ~/.bashrc wouldn't
be overwritten. See the last part of the tests for details.
Anton Shestakov <av6@dwimlabs.net> [Thu, 31 Jan 2019 13:32:21 +0800] rev 41455
copyright: update to 2019
Differential Revision: https://phab.mercurial-scm.org/D5779
Kyle Lippincott <spectral@google.com> [Mon, 28 Jan 2019 18:00:14 -0800] rev 41454
patch: handle 0 context lines (diff.unified=0) when parsing patches
Previously, if there were no context lines, we would just keep updating the
ranges and the hunk, but not actually storing the hunk (just overwriting it each
time). Thus a diff like this:
$ hg diff --config diff.unified=0
diff --git a/bar b/bar
--- a/bar
+++ b/bar
@@ -1,0 +2,1 @@ 1
+change1
@@ -3,0 +5,1 @@ 3
+change2
would come out of the parser like this (change1 is lost):
bar:
@@ -3,0 +5,1 @@ 3
+change2
This had some really weird side effects for things like commit --interactive,
split, etc.
Differential Revision: https://phab.mercurial-scm.org/D5743
Pulkit Goyal <pulkit@yandex-team.ru> [Wed, 30 Jan 2019 03:56:35 +0530] rev 41453
py3: pass str into RuntimeError() to prevent b'' in output
# skip-blame as just r'' prefixes
Differential Revision: https://phab.mercurial-scm.org/D5740
Pulkit Goyal <pulkit@yandex-team.ru> [Wed, 30 Jan 2019 03:49:56 +0530] rev 41452
py3: use '%d' instead of '%s' for integers
Differential Revision: https://phab.mercurial-scm.org/D5738
Augie Fackler <augie@google.com> [Tue, 29 Jan 2019 13:26:18 -0500] rev 41451
tests: port test-hgweb-auth.py to Python 3
Differential Revision: https://phab.mercurial-scm.org/D5736
Augie Fackler <augie@google.com> [Tue, 29 Jan 2019 13:25:21 -0500] rev 41450
url: convert some variables back to bytes
Differential Revision: https://phab.mercurial-scm.org/D5735
Augie Fackler <augie@google.com> [Tue, 29 Jan 2019 13:24:20 -0500] rev 41449
url: add some defensive asserts on expected incoming types
Our type handling is a nightmare here, and we're loading passwords to
do network IO, so we can afford to be potentially-slow but pedantic
here.
Differential Revision: https://phab.mercurial-scm.org/D5734
Pulkit Goyal <pulkit@yandex-team.ru> [Tue, 29 Jan 2019 16:03:52 +0300] rev 41448
changegroup: don't try to build changelog chunks if not required
When we extend a narrow clone without ellipsis, we don't download changelog
information because that's already present with the client. However we still try
to build that chunk stream. Building that chunk stream involves calling a lookup
function and store.emitrevisions() API. The lookup function is called len(cl)
number of times.
On large repositories, where len(cl) is in millions, calling that lookup
function is not a good idea. Also it's not required to use the
store.emitrevisons() API because we already have nodes present which we can use.
This patch short-circuits state building logic if we are processing a
non-ellipsis case and changelog is not required.
This saves up ~20 seconds on our internal repo for a single extend call.
Differential Revision: https://phab.mercurial-scm.org/D5733
Boris Feld <boris.feld@octobus.net> [Thu, 24 Jan 2019 18:22:47 -0500] rev 41447
revlog: make sure we never use sparserevlog without general delta (
issue6056)
We are getting user report where the delta code tries to use `sparse-revlog`
logic on repository where `generaldelta` is disabled. This can't work so we
ensure the two booleans have a consistent value.
Creating this kind of repository is not expected to be possible the current bug
report point at a clonebundle related bug that is still to be properly isolated
(Yuya Nishihara seems to a have done it).
Corrupting a repository to reproduce the issue is possible. A test using this
method is included in this fix.
Boris Feld <boris.feld@octobus.net> [Wed, 30 Jan 2019 18:15:38 +0100] rev 41446
sparserevlog: document the config option
This was overlooked when this graduated from experimental.
Pulkit Goyal <pulkit@yandex-team.ru> [Tue, 29 Jan 2019 15:43:02 +0300] rev 41445
changegroup: initialize the state variable a bit earlier
This will make the next patch much easier.
Differential Revision: https://phab.mercurial-scm.org/D5732
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 26 Jan 2019 11:23:31 -0800] rev 41444
tests: conditionalize test output on Python 3.7
Python 3.7 changed behavior of urllib.parse.quote() from RFC 2396
to RFC 3986 and ~ is now in the set of reserved characters and
isn't escaped.
We conditioanlize test output accordingly.
Differential Revision: https://phab.mercurial-scm.org/D5717
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 13 Oct 2018 16:53:43 +0200] rev 41443
hghave: add pyXY features for Python version numbers
This will allow us to sniff for Python >= versions in tests.
Differential Revision: https://phab.mercurial-scm.org/D5088
Pulkit Goyal <pulkit@yandex-team.ru> [Tue, 29 Jan 2019 14:30:10 +0300] rev 41442
py3: whitelist couple more passing tests found by buildbot
Differential Revision: https://phab.mercurial-scm.org/D5731
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 26 Jan 2019 13:52:39 -0800] rev 41441
keepalive: implement _close_conn() so closes are known
Keepalives were not working on Python 3 because
http.client.HTTPResponse was refactored to call _close_conn()
instead of close(). Our custom close() is what returns inactive
connections to the available state.
We better support Python 3 by implementing a _close_conn().
Differential Revision: https://phab.mercurial-scm.org/D5720
Matt Harbison <matt_harbison@yahoo.com> [Mon, 28 Jan 2019 21:35:06 -0500] rev 41440
lfs: explicitly add the Content-Length header when uploading blobs, for py3
This was the reason for test-lfs-test-server.t#git-server complaining about an
"invalid byte in chunk length". For some reason if this isn't explicitly added,
py3.7.1 is adding `transfer-encoding: chunked` as well as `Content-length: x`.
Wireshark flagged this as malformed. However, if this is set, it doesn't bother
with `transfer-encoding`.
Before this patch with py3:
PUT /objects/
31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b HTTP/1.1
Accept-Encoding: identity
Content-length: 12
accept: application/vnd.git-lfs
content-type: application/octet-stream
host: localhost:20062
transfer-encoding: chunked
user-agent: git-lfs/2.3.4 (Mercurial 4.9rc0+149-
7eb7637e34bf)
Before this patch with py27:
PUT /objects/
31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b HTTP/1.1
Accept-Encoding: identity
accept: application/vnd.git-lfs
content-type: application/octet-stream
content-length: 12
host: localhost:20062
user-agent: git-lfs/2.3.4 (Mercurial 4.9rc0+149-
7eb7637e34bf+
20190128)
With this patch and py3, the content is the same as the py27 example. RFC2616
says to ignore `Content-Length` if `Transfer-Encoding` is present, so maybe
there's nothing to do in the hg-server side (though I'm not sure which it is
using if presented both).
Maybe chunked encoding is better to do? If someone knows how to suppress the
`Content-Length`, we can try that instead.