Mercurial > hg-stable
changeset 46385:0d055849d5f9 stable
enclink: check contents of symlinks not just size in case of fcrypt
Check content of symlinks because st_size may indicate the size of encrypted
data which does not match actual link value.
Differential Revision: https://phab.mercurial-scm.org/D10146
author | Corey Schuhen <cschuhen@topcon.com> |
---|---|
date | Wed, 10 Mar 2021 15:24:52 +1000 |
parents | ed3fb1ae5ab1 |
children | d6fa9fbd375d |
files | mercurial/context.py mercurial/dirstate.py |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/context.py Tue Mar 09 11:19:11 2021 +0530 +++ b/mercurial/context.py Wed Mar 10 15:24:52 2021 +1000 @@ -993,8 +993,10 @@ # if file data starts with '\1\n', empty metadata block is # prepended, which adds 4 bytes to filelog.size(). return self._filelog.cmp(self._filenode, fctx.data()) - if self.size() == fctx.size(): + if self.size() == fctx.size() or self.flags() == b'l': # size() matches: need to compare content + # issue6456: Always compare symlinks because size can represent + # encrypted string for EXT-4 encryption(fscrypt). return self._filelog.cmp(self._filenode, fctx.data()) # size() differs
--- a/mercurial/dirstate.py Tue Mar 09 11:19:11 2021 +0530 +++ b/mercurial/dirstate.py Wed Mar 10 15:24:52 2021 +1000 @@ -1279,7 +1279,12 @@ or size == -2 # other parent or fn in copymap ): - madd(fn) + if (stat.S_ISLNK(st.st_mode) and size != st.st_size): + # issue6456: Size returned may be longer due to + # encryption on EXT-4 fscrypt, undecided. + ladd(fn) + else: + madd(fn) elif ( time != st[stat.ST_MTIME] and time != st[stat.ST_MTIME] & _rangemask