Commit Graph

31327 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
47ba9fae77 worker: ignore meaningless exit status indication returned by os.waitpid()
Before this patch, worker implementation assumes that os.waitpid()
with os.WNOHANG returns '(0, 0)' for still running child process. This
is explicitly specified as below in Python API document.

    os.WNOHANG
        The option for waitpid() to return immediately if no child
        process status is available immediately. The function returns
        (0, 0) in this case.

On the other hand, POSIX specification doesn't define the "stat_loc"
value returned by waitpid() with WNOHANG for such child process.

    http://pubs.opengroup.org/onlinepubs/9699919799/functions/waitpid.html

CPython implementation for os.waitpid() on POSIX doesn't take any care
of this gap, and this may cause unexpected "exit status indication"
even on POSIX conformance platform.

For example, os.waitpid() with os.WNOHANG returns non-zero "exit
status indication" on FreeBSD. This implies os.kill() with own pid or
sys.exit() with non-zero exit code, even if no child process fails.

To ignore meaningless exit status indication returned by os.waitpid(),
this patch skips subsequent steps forcibly, if os.waitpid() returns 0
as pid.

This patch also arranges examination of 'p' value for readability.

FYI, there are some issues below about this behavior reported for
CPython.

    https://bugs.python.org/issue21791
    https://bugs.python.org/issue27808
2017-02-25 01:07:52 +09:00
Siddharth Agarwal
7d1a6f9777 bundle2: fix assertion that 'compression' hasn't been set
`n.lower()` will return `compression`, not `Compression`.
2017-02-13 11:43:12 -08:00
Pierre-Yves David
43b1ef004c wireproto: properly report server Abort during 'getbundle'
Previously Abort raised during 'getbundle' call poorly reported (HTTP-500 for
http, some scary messages for ssh). Abort error have been properly reported for
"push" for a long time, there is not reason to be different for 'getbundle'. We
properly catch such error and report them back the best way available. For
bundle, we issue a valid bundle2 reply (as expected by the client) with an
'error:abort' part. With bundle1 we do as best as we can depending of http or
ssh.
2017-02-10 18:20:58 +01:00
Pierre-Yves David
695fa85daa getbundle: cleanly handle remote abort during getbundle
bundle2 allow the server to report error explicitly. This was initially
implemented for push but there is not reason to not use it for pull too. This
changeset add logic similar to the one in 'unbundle' to the
client side of 'getbundle'. That logic make sure the error is properly reported
as "remote". This will allow the server side of getbundle to send clean "Abort"
message in the next changeset.
2017-02-10 18:17:20 +01:00
Pierre-Yves David
d00dbd00d9 bundle1: fix bundle1-denied reporting for pull over ssh
Changeset a0966f529e1b introduced a config option to have the server deny pull
using bundle1. The original protocol has not really been design to allow that
kind of error reporting so some hack was used. It turned the hack only works on
HTTP and that ssh server hangs forever when this is used. After further
digging, there is no way to report the error in a unified way. Using `ooberror`
freeze ssh and raising 'Abort' makes HTTP return a HTTP-500 without further
details. So with sadness we implement a version that dispatch according to the
protocol used.

Now the error is properly reported, but we still have ungraceful abort after
that. The protocol do not allow anything better to happen using bundle1.
2017-02-10 18:06:08 +01:00
Pierre-Yves David
92aa2c1992 bundle-tests: operate from outside a repository
We are about to add a test for ssh pull/cloning being denied because of bundle1
usage. For this, it is cleaner to not operate from the clone using http. So we
update the test beforehand for clarity. This is more churns that what I'm happy
to see on stable, but the rests of the series is worth it in my opinion.
2017-02-10 18:06:12 +01:00
Pierre-Yves David
5b07cfa3b3 bundle1: display server abort hint during unbundle
The code was printing the abort message but not the hint. This is now fixed.
2017-02-10 17:56:52 +01:00
Pierre-Yves David
64f57e513b bundle1: fix bundle1-denied reporting for push over ssh
Changeset a0966f529e1b introduced a config option to have the server deny push
using bundle1. The original protocol has not really be design to allow such kind
of error reporting so some hack was used. It turned the hack only works on HTTP
and that ssh wire peer hangs forever when the same hack is used. After further
digging, there is no way to report the error in a unified way. Using 'ooberror'
freeze ssh and raising 'Abort' makes HTTP return a HTTP500 without further
details. So with sadness we implement a version that dispatch according to the
protocol used.

We also add a test for pushing over ssh to make sure we won't regress in the
future. That test show that the hint is missing, this is another bug fixed in
the next changeset.
2017-02-10 17:56:59 +01:00
Pierre-Yves David
e8a7ecc281 bundle2: keep hint close to the primary message when remote abort
The remote hint message was ignored when reporting the remote error and
passed to the local generic abort error. I think I might initially have
tried to avoid reimplementing logic controlling the hint display depending of
the verbosity level. However, first, there does not seems to have such verbosity
related logic and second the resulting was wrong as the primary error and the
hint were split apart. We now properly print the hint as remote output.
2017-02-10 17:56:47 +01:00
FUJIWARA Katsunori
2afd920706 misc: update year in copyright lines
This patch also makes some expected output lines in tests glob-ed for
persistence of them.

BTW, files below aren't yet changed in 2017, but this patch also
updates copyright of them, because:

    - mercurial/help/hg.1.txt

      almost all of "man hg" output comes from online help of hg
      command, and is already changed in 2017

    - mercurial/help/hgignore.5.txt
    - mercurial/help/hgrc.5

      "copyright 2005-201X Matt Mackall" in them mentions about
      copyright of Mercurial itself
2017-02-12 02:23:33 +09:00
FUJIWARA Katsunori
f778068b44 misc: replace domain of mercurial-devel ML address by mercurial-scm.org
This patch also adds new check-code.py pattern to detect invalid usage
of "mercurial-devel@selenic.com".
2017-02-11 00:23:55 +09:00
FUJIWARA Katsunori
4f46584dea i18n: update Report-Msgid-Bugs-To property of *.po files
This patch replaces domain of mercurial-devel ML address by
mercurial-scm.org for "Report-Msgid-Bugs-To" property of each *.po
files.

This avoids releasing 4.1.1 with invalid "Report-Msgid-Bugs-To"
in *.mo file, if corresponded *.po file isn't msgmerge-ed with recent
hg.pot by translator.

These *.po files aren't covered by check-code.py pattern newly added
in subsequent patch, because it ignores them.
2017-02-11 00:23:55 +09:00
FUJIWARA Katsunori
e6f91a13e7 misc: replace domain of mercurial ML address by mercurial-scm.org
This patch also adds new check-code.py pattern to detect invalid usage
of "mercurial@selenic.com".

Change for test-convert-tla.t is tested, but similar change for almost
same test-convert-baz.t isn't yet tested actually, because I couldn't
find out the way to get "GNU Arch baz client".

AFAIK, buildbot skips test-convert-baz.t, too. Does anybody have
appropriate environment for testing?
2017-02-11 00:23:53 +09:00
Anton Shestakov
d3b5c285e9 debian: update copyright years 2017-02-04 20:29:34 +08:00
Anton Shestakov
dcf9dc5b3d debian: update mailing list address 2017-02-04 20:29:13 +08:00
Kevin Bullock
6e8b8470cf Added signature for changeset 54d689c5e2bd 2017-02-01 10:19:49 -06:00
Kevin Bullock
6e8af72bda merge with i18n 2017-02-01 10:15:10 -06:00
Wagner Bruna
7bddc427a8 i18n-pt_BR: synchronized with 9495fca182d9 2017-02-01 08:47:11 -02:00
Mads Kiilerich
6945cf0f5b merge: more safe detection of criss cross merge conflict between dm and r
0b5f1f2efc77 introduced handling of a crash in this case. A review comment
suggested that it was not entirely obvious that a 'dm' always would have a 'r'
for the source file.

To mitigate that risk, make the code more conservative and make less
assumptions.
2017-02-01 02:10:30 +01:00
Augie Fackler
4b376468c2 tests: correct (I think) command in test-largefiles-update
When this test was introduced, it used the short-form of all the flags
on this update invocation. I suspect, based on the "start with clean
dirstates" comment and the fact that the no-exec branch of the #if
guard leaves dirstate clean, that this should have been 'update -qCr'
instead of 'update -qcr', but that a bug in largefiles --check
handling left this problem unnoticed.

I'll leave a breadcrumb further up about the current failure mode in
the hopes that we can fix this some day.

This was previously discussed in [0] but the trail in that thread goes
cold after a few replies. Given that this is still a flaky test, that
appears to only be passing by bad fortune, I think it's worth
correcting the code of the test to make a correct assertion, and to
keep track of the suspected bug with some other mechanism than an
invalid test (if we had support for "expected failure" blocks this
might be a worthwhile use of them?).

0: https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-October/089501.html
2017-01-30 18:03:17 -05:00
Augie Fackler
a2d475a89c tests: expand flags to long form in test-largefiles-update.t
I spent some time confused by this test. I'm pretty sure that this
line intends to be cleaning the dirstate, not checking that it's clean
before updating: the preceding #if block leaves the dirstate clean in
the noexec case, and dirty in the exec case, so we can't expect
consistent behavior across that platform variation. A subsequent patch
will modify this command to use --clean instead of --check.

I'll elaborate in that patch about the hypothetical bug here.
2017-01-30 17:57:21 -05:00
Mads Kiilerich
120b66d101 merge: fix crash on criss cross merge with dir move and delete (issue5020)
Work around that 'dm' in the data model only can have one operation for the
target file, but still can have multiple and conflicting operations on the
source file where the other operation is a 'rm'. The move would thus fail with
'abort: No such file or directory'.

In this case it is "obvious" that the file should be removed, either before or
after moving it. We thus keep the 'rm' of the source file but drop the 'dm'.

This is not a pretty fix but quite "obviously" safe (famous last words...) as
it only touches a rare code path that used to crash. It is possible that it
would be better to swap the files for 'dm' as suggested on
https://bz.mercurial-scm.org/show_bug.cgi?id=5020#c13 but it is not entirely
obvious that it not just would create conflicts on the other file. That can be
revisited later.
2017-01-31 03:25:59 +01:00
Mads Kiilerich
c69f200750 tests: use 'f' in test-merge-criss-cross.t to prepare for recursive dumping
Prepare for adding a test case with files in a directory.
2017-01-31 03:20:07 +01:00
Martin von Zweigbergk
06f115a93e util: make sortdict.keys() return a copy
dict.keys() is documented to return a copy, so it's surprising that
sortdict.keys() did not. I noticed this because we have an extension
that calls readlocaltags(). That method tries to remove any tags that
point to non-existent revisions (most likely stripped). However, since
it's unintentionally working on the instance it's modifying, it
sometimes fails to remove tags when there are multiple bad tags in a
row. This was not caught because localrepo.tags() does an additional
layer of filtering.

sortdict is also used in other places, but I have not checked whether
its keys() and/or __delitem__() methods are used there.
2017-01-30 22:58:56 -08:00
Yuya Nishihara
8d8a7da758 test-highlight: add normalization rule for Pygments 2.2
The test failed on Debian sid because of new class="vm".
2017-01-30 22:50:20 +09:00
Danek Duvall
058972ca52 tests: account for different newline behavior between Solaris and GNU grep
GNU grep, when emitting a matching line that doesn't have a terminating
newline, will add an extra newline.  Solaris grep passes the original line
through without the newline.  This causes differences in test output when
looking at the last line of the output of get-with-headers.py, which
doesn't usually emit (and certainly doesn't guarantee) a terminating
newline.

Both grep implementations succeed in matching the requested pattern,
though, so rely on specifying the full pattern on grep's commandline
instead of expecting it in the output, and send the output to /dev/null.
2017-01-29 12:40:56 -08:00
Augie Fackler
bd1329004e tests: also allow "Protocol not supported" in test-http-proxy error
I've seen this in a (misconfigured) FreeBSD jail which has ::1 as an
entry for localhost, but IPv6 support is disabled in the jail. It took
me months to figure out what was going on (and I only figured it out
when tinyproxy.py got confused by similar IPv4-level misconfiguration
of the localhost domain in /etc/hosts.)

I don't feel strongly about this patch: on the one hand, it's papering
over a host-level misconfiguration, but on the other it avoids some
weird and hard to diagnose problems that can occur in weirdly
restricted environments.
2017-01-20 10:17:34 -05:00
Yuya Nishihara
74023f2b13 revset: prevent using outgoing() and remote() in hgweb session (BC)
outgoing() and remote() may stall for long due to network I/O, which seems
unsafe per definition, "whether a predicate is safe for DoS attack." But I'm
not 100% sure about this. If our concern isn't elapsed time but CPU resource,
these predicates are considered safe. Perhaps that would be up to the
web/application server configuration?

Anyway, outgoing() and remote() wouldn't be useful in hgweb, so I think
it's okay to ban them.
2017-01-20 21:33:18 +09:00
Augie Fackler
e144629692 tests: use an absolute path to get around '..' being invalid on a dead CWD
Only FreeBSD seems to be this picky. Note that this explicit
absolute-path `cd` exposes a defect in the test, in that we end up
still inside the cwd-vanish repository, but that's not a regression in
this change. Since we're in a code freeze, I'm doing the smallest
thing possible to try and fix bugs on FreeBSD, rather than cleaning up
the entire problem. I'll follow up with a more complete fix after the
freeze.
2017-01-19 16:23:49 -05:00
Sean Farley
e145fc2df7 ui: rename tmpdir parameter to more specific repopath
This was requested by Augie and I agree that repopath is more
descriptive.
2017-01-18 18:25:51 -08:00
Yuya Nishihara
9979640f1d pager: wrap _runcommand() no matter if stdout is redirected
We've made chg utilize the common code path implemented in pager.py (by
e8fb65f5e551 and e97133c7a9dc), but the chg server does not always start
with a tty. Because of this, uisetup() of the pager extension could be
skipped on the chg server.

Kudos given to Sean Farley for dogfooding new chg and spotting this problem.
2017-01-19 23:01:32 +09:00
Kostia Balytskyi
bc104f588e shelve: make unshelve not crash when there are missing files (issue4176)
This patch makes it possible to unshelve while having missing files
in your repo as long as shelved changes don't touch those missing files.
It also makes error message better otherwise.
2017-01-19 09:48:40 -08:00
Gregory Szorc
9c03a7696d statprof: require input file
statprof has a __main__ handler that allows viewing of previously
written data files. As Yuya pointed out during review, 82ee01726a77
broke this. This patch fixes that.
2017-01-18 22:45:07 -08:00
Augie Fackler
a0c4b1e6da tests: work around FreeBSD's unzip having slightly different output
According to man 1 unzip, this unzip appeared in FreeBSD 8.0. It's
what comes as /usr/bin/unzip, so we may as well cater to it since it's
easy.
2017-01-18 23:43:41 -05:00
Augie Fackler
cde5195cd5 contrib: fix check-commit to not reject commits from hg sign and hg tag
I'm tired of having a spurious red build every time we do a
release. Fix it once and for all.
2017-01-18 23:34:35 -05:00
Augie Fackler
f5af5e9bba Added signature for changeset c00c73271d0f 2017-01-18 20:03:00 -05:00
Augie Fackler
899d0275a8 tests: fix up some http tests for no-zstd case 2017-01-18 11:54:51 -05:00
Sean Farley
934f476aec patchbomb: add tmpdir parameter to ui.edit call 2017-01-16 21:17:39 -08:00
Sean Farley
df48d2115f histedit: add tmpdir parameter to ui.edit call 2017-01-16 21:15:57 -08:00
Sean Farley
a405503f7a cmdutil: add tmpdir parament to ui.edit calls 2017-01-16 21:15:21 -08:00
Sean Farley
9280f19af2 ui: add a parameter to set the temporary directory for edit
Until callsites are updated, this will have no effect. Once callsites
are updated, specifying experimental.editortmpinhg will create editor
temporary files in a subdirectory of .hg, which will make it easier
for tool integrations to determine what repository is in play when
they're asked to edit an hg-related file.
2017-01-16 21:05:22 -08:00
Pulkit Goyal
f38d10e539 help: update help for hg update which was misleading (issue5427) 2017-01-18 03:44:19 +05:30
Matt Harbison
511b164fad templater: add '{envvars}' to access environment variables
Since the option for ui.exportableenviron is experimental, so is this template
until the underlying API is sorted out.
2017-01-17 23:12:54 -05:00
Matt Harbison
5a63dbb230 ui: introduce an experimental dict of exportable environment variables
Care needs to be taken to prevent leaking potentially sensitive environment
variables through hgweb, if template support for environment variables is to be
introduced.  There are a few ideas about the API for preventing accidental
leaking [1].  Option 3 seems best from the POV of not needing to configure
anything in the normal case.  I couldn't figure out how to do that, so guard it
with an experimental option for now.

[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-January/092383.html
2017-01-17 23:05:12 -05:00
Anton Shestakov
10cc5b4f2f tests: test experimental.spacemovesdown config for commit -i
The feature is still very experimental, but at least its behavior is captured
in the test.
2017-01-17 13:44:53 +08:00
Gregory Szorc
4225a4e399 zstd: prevent potential free() of uninitialized memory
This is a cherry pick of an upstream fix. The free() of uninitialed
memory could likely only occur if a malloc() inside zstd fails.

The patched functions aren't currently used by Mercurial. But I don't
like leaving footguns sitting around.
2017-01-17 10:17:13 -08:00
Martin von Zweigbergk
ad5f4ef8a6 revlog: give EXTSTORED flag value to narrowhg
Narrowhg has been using "1 << 14" as its revlog flag value for a long
time. We (Google) have many repos with that value in production
already. When the same value was reserved for EXTSTORED, it made those
repos invalid. Upgrading them will be a little painful. We should
clearly have reserved the value for narrowhg a long time ago. Since
the EXTSTORED flag is not yet in any release and Facebook also says
they have not started using it in production, so it should be okay to
change it. This patch gives the current value (1 << 14) back to
narrowhg and gives a new value (1 << 13) to EXTSTORED.
2017-01-17 11:25:02 -08:00
Martin von Zweigbergk
a445384510 help: don't let tools reflow revlog flags list
Before this change, the text about revlog flags was reflowed into a
single paragraph, which made it a bit hard to read. I don't even know
the rules around this, but adding a blank line before each flag seems
to prevent the reflowing.
2017-01-17 11:45:10 -08:00
Martin von Zweigbergk
0ecfe18db3 help: format revlog.txt more closely to result
The rendered text has spaces before each item in the list
2017-01-17 11:29:06 -08:00
Denis Laxalde
86ca3ec602 hgweb: simplify calculation of first revision in filelog command 2017-01-17 09:19:24 +01:00