D9309: errors: set detailed exit code to 100 for some remote errors
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Thu Nov 12 16:40:46 UTC 2020
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
This is per https://www.mercurial-scm.org/wiki/ErrorCategoriesPlan.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D9309
AFFECTED FILES
mercurial/scmutil.py
tests/test-bad-pull.t
tests/test-bundle2-exchange.t
tests/test-clone.t
tests/test-extdata.t
tests/test-http-bad-server.t
tests/test-http-bundle1.t
tests/test-http-permissions.t
tests/test-http-proxy.t
tests/test-http.t
tests/test-https.t
tests/test-largefiles-wireproto.t
tests/test-patchbomb-tls.t
tests/test-push-http.t
tests/test-serve.t
tests/test-static-http.t
tests/test-subrepo-deep-nested-change.t
tests/test-subrepo-relative-path.t
CHANGE DETAILS
diff --git a/tests/test-subrepo-relative-path.t b/tests/test-subrepo-relative-path.t
--- a/tests/test-subrepo-relative-path.t
+++ b/tests/test-subrepo-relative-path.t
@@ -85,7 +85,7 @@
searching for changes
no changes found
abort: HTTP Error 403: ssl required
- [255]
+ [100]
Checking cloned repo ids
diff --git a/tests/test-subrepo-deep-nested-change.t b/tests/test-subrepo-deep-nested-change.t
--- a/tests/test-subrepo-deep-nested-change.t
+++ b/tests/test-subrepo-deep-nested-change.t
@@ -110,7 +110,7 @@
updating to branch default
cloning subrepo sub1 from http://localhost:$HGPORT/../sub1
abort: HTTP Error 404: Not Found
- [255]
+ [100]
$ cat access.log
* "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
diff --git a/tests/test-static-http.t b/tests/test-static-http.t
--- a/tests/test-static-http.t
+++ b/tests/test-static-http.t
@@ -2,7 +2,7 @@
$ hg clone http://localhost:$HGPORT/ copy
abort: * (glob)
- [255]
+ [100]
$ test -d copy
[1]
diff --git a/tests/test-serve.t b/tests/test-serve.t
--- a/tests/test-serve.t
+++ b/tests/test-serve.t
@@ -90,10 +90,10 @@
$ hg id http://localhost:$HGPORT/some/dir7
abort: HTTP Error 404: Not Found
- [255]
+ [100]
$ hg id http://localhost:$HGPORT/some
abort: HTTP Error 404: Not Found
- [255]
+ [100]
$ cat access.log errors.log
$LOCALIP - - [$LOGDATE$] "GET /some/dir7?cmd=capabilities HTTP/1.1" 404 - (glob)
diff --git a/tests/test-push-http.t b/tests/test-push-http.t
--- a/tests/test-push-http.t
+++ b/tests/test-push-http.t
@@ -41,7 +41,7 @@
searching for changes
abort: HTTP Error 403: ssl required
% serve errors
- [255]
+ [100]
expect authorization error
diff --git a/tests/test-patchbomb-tls.t b/tests/test-patchbomb-tls.t
--- a/tests/test-patchbomb-tls.t
+++ b/tests/test-patchbomb-tls.t
@@ -56,7 +56,7 @@
(the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
(?i)abort: .*?certificate.verify.failed.* (re)
- [255]
+ [100]
#endif
@@ -94,6 +94,6 @@
(the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
(?i)abort: .*?certificate.verify.failed.* (re)
- [255]
+ [100]
$ cd ..
diff --git a/tests/test-largefiles-wireproto.t b/tests/test-largefiles-wireproto.t
--- a/tests/test-largefiles-wireproto.t
+++ b/tests/test-largefiles-wireproto.t
@@ -117,7 +117,7 @@
This repository uses the largefiles extension.
Please enable it in your Mercurial config file.
- [255]
+ [100]
used all HGPORTs, kill all daemons
$ killdaemons.py
@@ -133,7 +133,7 @@
remote: -
abort: remote error
(check previous remote output)
- [255]
+ [100]
#if serve
diff --git a/tests/test-https.t b/tests/test-https.t
--- a/tests/test-https.t
+++ b/tests/test-https.t
@@ -59,7 +59,7 @@
$ hg clone https://localhost:$HGPORT/ copy-pull
(the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
abort: error: *certificate verify failed* (glob)
- [255]
+ [100]
#endif
Specifying a per-host certificate file that doesn't exist will abort. The full
@@ -84,7 +84,7 @@
(an attempt was made to load CA certificates but none were loaded; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error)
(the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
abort: error: *certificate verify failed* (glob)
- [255]
+ [100]
A per-host certificate matching the server's cert will be accepted
@@ -238,7 +238,7 @@
pulling from https://localhost:$HGPORT/
(the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
abort: error: *certificate verify failed* (glob)
- [255]
+ [100]
$ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub-other.pem" \
> --insecure
pulling from https://localhost:$HGPORT/
@@ -255,7 +255,7 @@
pulling from https://localhost:$HGPORT1/
(the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
abort: error: *certificate verify failed* (glob)
- [255]
+ [100]
Test server cert which no longer is valid
@@ -266,7 +266,7 @@
pulling from https://localhost:$HGPORT2/
(the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
abort: error: *certificate verify failed* (glob)
- [255]
+ [100]
Setting ciphers to an invalid value aborts
$ P="$CERTSDIR" hg --config hostsecurity.ciphers=invalid -R copy-pull id https://localhost:$HGPORT/
@@ -375,26 +375,26 @@
(consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
(see https://mercurial-scm.org/wiki/SecureConnections for more info)
abort: error: .*(unsupported protocol|wrong ssl version).* (re)
- [255]
+ [100]
$ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.1 id https://localhost:$HGPORT/
(could not negotiate a common security protocol (tls1.1+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
(consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
(see https://mercurial-scm.org/wiki/SecureConnections for more info)
abort: error: .*(unsupported protocol|wrong ssl version).* (re)
- [255]
+ [100]
$ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.2 id https://localhost:$HGPORT/
(could not negotiate a common security protocol (tls1.2+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
(consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
(see https://mercurial-scm.org/wiki/SecureConnections for more info)
abort: error: .*(unsupported protocol|wrong ssl version).* (re)
- [255]
+ [100]
$ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.2 id https://localhost:$HGPORT1/
(could not negotiate a common security protocol (tls1.2+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
(consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
(see https://mercurial-scm.org/wiki/SecureConnections for more info)
abort: error: .*(unsupported protocol|wrong ssl version).* (re)
- [255]
+ [100]
--insecure will allow TLS 1.0 connections and override configs
@@ -417,7 +417,7 @@
(consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
(see https://mercurial-scm.org/wiki/SecureConnections for more info)
abort: error: .*(unsupported protocol|wrong ssl version).* (re)
- [255]
+ [100]
.hg/hgrc file [hostsecurity] settings are applied to remote ui instances (issue5305)
@@ -430,7 +430,7 @@
(consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
(see https://mercurial-scm.org/wiki/SecureConnections for more info)
abort: error: .*(unsupported protocol|wrong ssl version).* (re)
- [255]
+ [100]
$ killdaemons.py hg0.pid
$ killdaemons.py hg1.pid
@@ -482,13 +482,13 @@
pulling from https://localhost:$HGPORT/
(the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
abort: error: *certificate verify failed* (glob)
- [255]
+ [100]
$ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull \
> --config web.cacerts="$CERTSDIR/pub-expired.pem" https://localhost:$HGPORT2/
pulling from https://localhost:$HGPORT2/
(the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
abort: error: *certificate verify failed* (glob)
- [255]
+ [100]
$ killdaemons.py hg0.pid
@@ -518,7 +518,7 @@
$ P="$CERTSDIR" hg id https://localhost:$HGPORT/
abort: error: .*(\$ECONNRESET\$|certificate required|handshake failure).* (re)
- [255]
+ [100]
with client certificate:
@@ -539,7 +539,7 @@
$ env P="$CERTSDIR" hg id https://localhost:$HGPORT/
abort: error: * (glob)
- [255]
+ [100]
Missing certficate and key files result in error
diff --git a/tests/test-http.t b/tests/test-http.t
--- a/tests/test-http.t
+++ b/tests/test-http.t
@@ -167,7 +167,7 @@
$ hg clone http://localhost:$HGPORT/bad
abort: HTTP Error 404: Not Found
- [255]
+ [100]
test http authentication
+ use the same server to test server side streaming preference
@@ -283,7 +283,7 @@
[255]
$ hg id http://user:pass2@localhost:$HGPORT2/
abort: HTTP Error 403: no
- [255]
+ [100]
$ hg -R dest-pull tag -r tip top
$ hg -R dest-pull push http://user:pass@localhost:$HGPORT2/
@@ -475,7 +475,7 @@
updating to branch default
cloning subrepo sub from http://localhost:$HGPORT/sub
abort: HTTP Error 404: Not Found
- [255]
+ [100]
$ hg clone http://localhost:$HGPORT/ slash-clone
requesting all changes
adding changesets
@@ -486,7 +486,7 @@
updating to branch default
cloning subrepo sub from http://localhost:$HGPORT/sub
abort: HTTP Error 404: Not Found
- [255]
+ [100]
check error log
@@ -588,7 +588,7 @@
$ hg id http://localhost:$HGPORT
abort: HTTP Error 500: no-cookie
- [255]
+ [100]
Populate a cookies file
@@ -602,7 +602,7 @@
$ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/
abort: HTTP Error 500: no-cookie
- [255]
+ [100]
Add a cookie entry for our test server and verify it is sent
@@ -612,4 +612,4 @@
$ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/
abort: HTTP Error 500: Cookie: hgkey=localhostvalue
- [255]
+ [100]
diff --git a/tests/test-http-proxy.t b/tests/test-http-proxy.t
--- a/tests/test-http-proxy.t
+++ b/tests/test-http-proxy.t
@@ -91,7 +91,7 @@
$ http_proxy=localhost:$HGPORT2 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ f
abort: error: (Connection refused|Protocol not supported|.* actively refused it|\$EADDRNOTAVAIL\$|No route to host) (re)
- [255]
+ [100]
do not use the proxy if it is in the no list
diff --git a/tests/test-http-permissions.t b/tests/test-http-permissions.t
--- a/tests/test-http-permissions.t
+++ b/tests/test-http-permissions.t
@@ -874,13 +874,13 @@
searching for changes
no changes found
abort: HTTP Error 403: ssl required
- [255]
+ [100]
$ hg --cwd ../test2 push http://localhost:$HGPORT/
pushing to http://localhost:$HGPORT/
searching for changes
abort: HTTP Error 403: ssl required
- [255]
+ [100]
$ killdaemons.py
diff --git a/tests/test-http-bundle1.t b/tests/test-http-bundle1.t
--- a/tests/test-http-bundle1.t
+++ b/tests/test-http-bundle1.t
@@ -178,7 +178,7 @@
$ hg clone http://localhost:$HGPORT/bad
abort: HTTP Error 404: Not Found
- [255]
+ [100]
test http authentication
+ use the same server to test server side streaming preference
@@ -250,7 +250,7 @@
[255]
$ hg id http://user:pass2@localhost:$HGPORT2/
abort: HTTP Error 403: no
- [255]
+ [100]
$ hg -R dest-pull tag -r tip top
$ hg -R dest-pull push http://user:pass@localhost:$HGPORT2/
@@ -338,7 +338,7 @@
updating to branch default
cloning subrepo sub from http://localhost:$HGPORT/sub
abort: HTTP Error 404: Not Found
- [255]
+ [100]
$ hg clone http://localhost:$HGPORT/ slash-clone
requesting all changes
adding changesets
@@ -349,7 +349,7 @@
updating to branch default
cloning subrepo sub from http://localhost:$HGPORT/sub
abort: HTTP Error 404: Not Found
- [255]
+ [100]
check error log
@@ -364,7 +364,7 @@
requesting all changes
abort: remote error:
this is an exercise
- [255]
+ [100]
$ cat error.log
disable pull-based clones
@@ -375,7 +375,7 @@
requesting all changes
abort: remote error:
server has pull-based clones disabled
- [255]
+ [100]
#if no-reposimplestore
... but keep stream clones working
diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t
--- a/tests/test-http-bad-server.t
+++ b/tests/test-http-bad-server.t
@@ -41,7 +41,7 @@
$ hg clone http://localhost:$HGPORT/ clone
abort: error: (\$ECONNRESET\$|\$EADDRNOTAVAIL\$) (re)
- [255]
+ [100]
(The server exits on its own, but there is a race between that and starting a new server.
So ensure the process is dead.)
@@ -63,7 +63,7 @@
--runs-per-test=20 on macOS 10.12 during the freeze for 4.2.
$ hg clone http://localhost:$HGPORT/ clone
abort: error: * (glob)
- [255]
+ [100]
$ killdaemons.py $DAEMON_PIDS
@@ -74,7 +74,7 @@
$ hg clone http://localhost:$HGPORT/ clone
abort: error: bad HTTP status line: * (glob)
- [255]
+ [100]
$ killdaemons.py $DAEMON_PIDS
@@ -90,7 +90,7 @@
$ cat hg.pid > $DAEMON_PIDS
$ hg clone http://localhost:$HGPORT/ clone
abort: error: bad HTTP status line: * (glob)
- [255]
+ [100]
$ killdaemons.py $DAEMON_PIDS
@@ -107,7 +107,7 @@
$ cat hg.pid > $DAEMON_PIDS
$ hg clone http://localhost:$HGPORT/ clone
abort: error: bad HTTP status line: * (glob)
- [255]
+ [100]
$ killdaemons.py $DAEMON_PIDS
@@ -150,7 +150,7 @@
$ hg clone http://localhost:$HGPORT/ clone
requesting all changes
abort: error: bad HTTP status line: * (glob)
- [255]
+ [100]
$ killdaemons.py $DAEMON_PIDS
@@ -217,7 +217,7 @@
$ hg clone http://localhost:$HGPORT/ clone
abort: error: bad HTTP status line: * (glob)
- [255]
+ [100]
$ killdaemons.py $DAEMON_PIDS
@@ -277,7 +277,7 @@
$ hg clone http://localhost:$HGPORT/ clone
abort: error: bad HTTP status line: H
- [255]
+ [100]
$ killdaemons.py $DAEMON_PIDS
diff --git a/tests/test-extdata.t b/tests/test-extdata.t
--- a/tests/test-extdata.t
+++ b/tests/test-extdata.t
@@ -113,7 +113,7 @@
$ cd sub
$ hg log -qr "extdata(filedata)"
abort: error: $ENOENT$
- [255]
+ [100]
$ hg log -qr "extdata(shelldata)"
2:f6ed99a58333
diff --git a/tests/test-clone.t b/tests/test-clone.t
--- a/tests/test-clone.t
+++ b/tests/test-clone.t
@@ -618,7 +618,7 @@
$ hg clone http://invalid:url/a b
abort: error: nonnumeric port: 'url'
- [255]
+ [100]
No remote source
@@ -629,7 +629,7 @@
#else
$ hg clone http://$LOCALIP:3121/a b
abort: error: *refused* (glob)
- [255]
+ [100]
#endif
$ rm -rf b # work around bug with http clone
diff --git a/tests/test-bundle2-exchange.t b/tests/test-bundle2-exchange.t
--- a/tests/test-bundle2-exchange.t
+++ b/tests/test-bundle2-exchange.t
@@ -987,7 +987,7 @@
abort: remote error:
incompatible Mercurial client; bundle2 required
(see https://www.mercurial-scm.org/wiki/IncompatibleClient)
- [255]
+ [100]
$ killdaemons.py
$ cd ..
@@ -1032,7 +1032,7 @@
abort: remote error:
incompatible Mercurial client; bundle2 required
(see https://www.mercurial-scm.org/wiki/IncompatibleClient)
- [255]
+ [100]
$ killdaemons.py
@@ -1050,7 +1050,7 @@
abort: remote error:
incompatible Mercurial client; bundle2 required
(see https://www.mercurial-scm.org/wiki/IncompatibleClient)
- [255]
+ [100]
$ killdaemons.py
$ hg --config devel.legacy.exchange=bundle1 clone ssh://user@dummy/bundle2onlyserver not-bundle2-ssh
@@ -1075,7 +1075,7 @@
abort: remote error:
incompatible Mercurial client; bundle2 required
(see https://www.mercurial-scm.org/wiki/IncompatibleClient)
- [255]
+ [100]
$ killdaemons.py
@@ -1132,7 +1132,7 @@
abort: remote error:
incompatible Mercurial client; bundle2 required
(see https://www.mercurial-scm.org/wiki/IncompatibleClient)
- [255]
+ [100]
(also check with ssh)
diff --git a/tests/test-bad-pull.t b/tests/test-bad-pull.t
--- a/tests/test-bad-pull.t
+++ b/tests/test-bad-pull.t
@@ -2,7 +2,7 @@
$ hg clone http://localhost:$HGPORT/ copy
abort: * (glob)
- [255]
+ [100]
$ test -d copy
[1]
@@ -11,5 +11,5 @@
$ cat dumb.pid >> $DAEMON_PIDS
$ hg clone http://localhost:$HGPORT/foo copy2
abort: HTTP Error 404: * (glob)
- [255]
+ [100]
$ killdaemons.py
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -182,6 +182,7 @@
)
)
except error.OutOfBandError as inst:
+ detailed_exit_code = 100
if inst.args:
msg = _(b"abort: remote error:\n")
else:
@@ -238,8 +239,10 @@
ui.error(_(b"(is your Python install correct?)\n"))
except (IOError, OSError) as inst:
if util.safehasattr(inst, b"code"): # HTTPError
+ detailed_exit_code = 100
ui.error(_(b"abort: %s\n") % stringutil.forcebytestr(inst))
elif util.safehasattr(inst, b"reason"): # URLError or SSLError
+ detailed_exit_code = 100
try: # usually it is in the form (errno, strerror)
reason = inst.reason.args[1]
except (AttributeError, IndexError):
To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list