Patchwork D7944: localrepo: handle ValueError during repository opening

login
register
mail settings
Submitter phabricator
Date Jan. 18, 2020, 9:18 p.m.
Message ID <differential-rev-PHID-DREV-xbpzixrbzyyqzds66knr-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44523/
State Superseded
Headers show

Comments

phabricator - Jan. 18, 2020, 9:18 p.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Python 3.8 can raise ValueError on attempt of an I/O operation
  against an illegal path. This was causing test-remotefilelog-gc.t
  to fail on Python 3.8.
  
  This commit teaches repository opening to handle ValueError
  and re-raise an Abort on failure.
  
  An arguably better solution would be to implement this logic
  in the vfs layer. But that seems like a bag of worms and I don't
  want to go down that rabbit hole. Until users report uncaught
  ValueError exceptions in the wild, I think it is fine to patch
  this at the only occurrence our test harness is finding it.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel
phabricator - Feb. 5, 2020, 11:10 p.m.
marmoute added a comment.
marmoute accepted this revision.


  urg…

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7944/new/

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

To: indygreg, #hg-reviewers, marmoute
Cc: marmoute, mercurial-devel
phabricator - June 8, 2020, 5:35 p.m.
Herald added a subscriber: mercurial-patches.
This revision now requires changes to proceed.
baymax added a comment.
baymax requested changes to this revision.


  There seems to have been no activities on this Diff for the past 3 Months.
  
  By policy, we are automatically moving it out of the `need-review` state.
  
  Please, move it back to `need-review` without hesitation if this diff should still be discussed.
  
  :baymax:need-review-idle:

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7944/new/

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

To: indygreg, #hg-reviewers, marmoute, baymax
Cc: mercurial-patches, marmoute, mercurial-devel
phabricator - June 9, 2020, 11:15 a.m.
marmoute added a comment.


  This patch is still correct, not sure why it is not it yet.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7944/new/

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

To: indygreg, #hg-reviewers, marmoute, baymax
Cc: mercurial-patches, marmoute, mercurial-devel

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -504,6 +504,11 @@ 
         except OSError as e:
             if e.errno != errno.ENOENT:
                 raise
+        except ValueError as e:
+            # Can be raised on Python 3.8 when path is invalid.
+            raise error.Abort(
+                _(b'invalid path %s: %s') % (path, pycompat.bytestr(e))
+            )
 
         raise error.RepoError(_(b'repository %s not found') % path)