Patchwork D6148: store: error out if fncache does not ends with a newline

login
register
mail settings
Submitter phabricator
Date March 18, 2019, 1:57 p.m.
Message ID <differential-rev-PHID-DREV-cdx6v6vpl3qllwcfcex5-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/39318/
State Superseded
Headers show

Comments

phabricator - March 18, 2019, 1:57 p.m.
pulkit created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  If fncache does not ends with a newline, chunk will not be fully consumed. It
  should be a bug somewhere or the fncache is corrupted if that happens. Let's
  error out in such cases.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6148

AFFECTED FILES
  mercurial/store.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mjpieters, mercurial-devel
phabricator - March 18, 2019, 11:20 p.m.
martinvonz added inline comments.

INLINE COMMENTS

> store.py:485
> +        if chunk:
> +            raise error.Abort(_("fncache does not ends with a newline"))
>          self._checkentries(fp)

I'll s/ends/end/ in flight

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6148

To: pulkit, #hg-reviewers
Cc: martinvonz, mjpieters, mercurial-devel
phabricator - March 19, 2019, 1:40 a.m.
mharbison72 added a comment.


  Is there something that can be done to repair this, that should be suggested in the hint?  I've seen fncache errors in the context of a corrupt repo, but I'm not sure what an end user would do with this message.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6148

To: pulkit, #hg-reviewers
Cc: mharbison72, martinvonz, mjpieters, mercurial-devel
via Mercurial-devel - March 19, 2019, 2:44 a.m.
Good point. Isn't there a debug command for rebuilding it? We can add a
hint about that.

On Mon, Mar 18, 2019, 18:42 mharbison72 (Matt Harbison) <
phabricator@mercurial-scm.org> wrote:

> mharbison72 added a comment.
>
>
>   Is there something that can be done to repair this, that should be
> suggested in the hint?  I've seen fncache errors in the context of a
> corrupt repo, but I'm not sure what an end user would do with this message.
>
> REPOSITORY
>   rHG Mercurial
>
> REVISION DETAIL
>   https://phab.mercurial-scm.org/D6148
>
> To: pulkit, #hg-reviewers
> Cc: mharbison72, martinvonz, mjpieters, mercurial-devel
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -481,6 +481,8 @@ 
                 # chunksize, so let's keep iterating
                 pass
 
+        if chunk:
+            raise error.Abort(_("fncache does not ends with a newline"))
         self._checkentries(fp)
         fp.close()