[PATCH 3 of 3] hook: report untrusted hooks as failure (issue5110) (BC)
Matt Mackall
mpm at selenic.com
Sat Apr 16 13:16:49 EDT 2016
On Fri, 2016-04-15 at 15:26 -0400, timeless wrote:
> Pierre-Yves David wrote:
> >
> > timeless wrote:
> > >
> > > can i convince you to replace "denied" with "skipped"?
> >
> > Skipped seemed a bit too light for the abort case:
> >
> > Abort: pretxnopen.foo hook skipped (from unstrusted source)
> >
> > (it is not really "skipped" as it aborted the whole operation).
> >
> > What do you think?
> I'm thinking "Can I get it in a sentence?"
> But in practical terms, can you add tests w/ this commit showing
> pretxnopen/pretxnclose (passing, failing)?
>
> "forbidden" is probably the right word in the pretxnopen case (instead
> of denied).
No, "forbidden" is not right either. This is instead something we're doing out
of an abundance of caution for the user's benefit. I've tweaked the landed
output thusly:
--- /home/mpm/hg/tests/test-hook.t
+++ /home/mpm/hg/tests/test-hook.t.err
@@ -845,7 +845,7 @@
> txnclose.testing=echo txnclose hook called
> EOF
$ touch a && hg commit -Aqm a
- warning: txnclose hook forbidden (from untrusted config)
+ warning: untrusted hook txnclose not executed
$ hg log
changeset: 0:3903775176ed
tag: tip
@@ -864,7 +864,8 @@
$ touch b && hg commit -Aqm a
transaction abort!
rollback completed
- abort: pretxnclose hook forbidden (from untrusted config)
+ abort: untrusted hook pretxnclose not executed
+ (see 'hg help config.trusted')
[255]
$ hg log
changeset: 0:3903775176ed
Note the change of the pseudo-hint to a real abort hint.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list