[PATCH] fsmonitor: be robust in the face of bad state

Yuya Nishihara yuya at tcha.org
Sun Nov 27 04:35:04 EST 2016


On Fri, 25 Nov 2016 07:30:53 -0800, Simon Farnsworth wrote:
> # HG changeset patch
> # User Simon Farnsworth <simonfar at fb.com>
> # Date 1480087846 28800
> #      Fri Nov 25 07:30:46 2016 -0800
> # Node ID 0ca34f1b83da754246ee33e01c4f7d6652061f5d
> # Parent  a3163433647108b7bec8fc45896db1c20b18ab21
> fsmonitor: be robust in the face of bad state

Queued per reviews, thanks.

> --- a/hgext/fsmonitor/state.py
> +++ b/hgext/fsmonitor/state.py
> @@ -59,6 +59,12 @@
>              state = file.read().split('\0')
>              # state = hostname\0clock\0ignorehash\0 + list of files, each
>              # followed by a \0
> +            if len(state) < 3:
> +                self._ui.log(
> +                    'fsmonitor', 'fsmonitor: state file truncated (expected '
> +                    '3 chunks, found %d), nuking state\n' % len(state))

ui.log() takes (event, fmtstr, fmtargs...), updated in flight.


More information about the Mercurial-devel mailing list