Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/context.py @ 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 | 89a2afe31e82 |
children | e2f7b2695ba1 |
comparison
equal
deleted
inserted
replaced
46384:ed3fb1ae5ab1 | 46385:0d055849d5f9 |
---|---|
991 if self.size() - 4 == fctx.size(): | 991 if self.size() - 4 == fctx.size(): |
992 # size() can match: | 992 # size() can match: |
993 # if file data starts with '\1\n', empty metadata block is | 993 # if file data starts with '\1\n', empty metadata block is |
994 # prepended, which adds 4 bytes to filelog.size(). | 994 # prepended, which adds 4 bytes to filelog.size(). |
995 return self._filelog.cmp(self._filenode, fctx.data()) | 995 return self._filelog.cmp(self._filenode, fctx.data()) |
996 if self.size() == fctx.size(): | 996 if self.size() == fctx.size() or self.flags() == b'l': |
997 # size() matches: need to compare content | 997 # size() matches: need to compare content |
998 # issue6456: Always compare symlinks because size can represent | |
999 # encrypted string for EXT-4 encryption(fscrypt). | |
998 return self._filelog.cmp(self._filenode, fctx.data()) | 1000 return self._filelog.cmp(self._filenode, fctx.data()) |
999 | 1001 |
1000 # size() differs | 1002 # size() differs |
1001 return True | 1003 return True |
1002 | 1004 |