changeset 19317:66da6e9feacd stable

pathencode: fix hashmangle short dir limit (issue3958) The Python version of this (see mercurial/store.py:_hashencode) copies path components up to a limit of maxshortdirslen bytes. The Python version does not consider the initial "dh/" to be part of the this, though, while the C version currently does. Adding len("dh/") == 3 to the limit for the C version brings it in line with the Python version. This was not caught by the randomized testing scheme in test-pathencode.py because of a couple of flaws with the test. Upcoming patches will fix those problems.
author Siddharth Agarwal <sid0@fb.com>
date Wed, 19 Jun 2013 22:34:34 -0700
parents 6f3428c528b4
children 9778c77f05d6
files mercurial/pathencode.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/pathencode.c	Thu Jun 20 14:06:11 2013 -0500
+++ b/mercurial/pathencode.c	Wed Jun 19 22:34:34 2013 -0700
@@ -585,7 +585,8 @@
 			   in a space or dot, which are unportable. */
 			if (d == '.' || d == ' ')
 				dest[destlen - 1] = '_';
-			if (destlen > maxshortdirslen)
+			/* The + 3 is to account for "dh/" in the beginning */
+			if (destlen > maxshortdirslen + 3)
 				break;
 			charcopy(dest, &destlen, destsize, src[i]);
 			p = -1;