On Mon, Apr 13, 2015 at 6:07 PM, Julian Foad <julianfoad_at_gmail.com> wrote:
> r1654932 introduced into svn_fs_fs__file_length():
>
> if data_rep->expanded_size is 0:
> /* ... A plain representation may specify its EXPANDED LENGTH as "0"
> in which case, the SIZE value is what we want.
>
> Because EXPANDED_LENGTH will also be 0 for empty files, while
> SIZE is non-null, we need to check wether the content is
> actually empty. ... */
> if data_rep->md5 == empty_md5:
>
if (memcmp(digest,empty_digest))
... which is the opposite condition.
*length = data_rep->size
> else:
> *length = 0
>
> But how could SIZE be non-zero for an empty file? (If we were allowed
> to store the rep as a delta from <non-empty> to <empty>, that would
> have SIZE != 0, but a delta rep is not allowed when the (true)
> expanded size is zero, according to the 'structure' document.)
>
> This code is only in svn_fs_fs__file_length(). It seems to me that
> other places where the ->expanded_size field is used, such as
> svn_fs_fs__file_text_rep_equal(), are also affected by the problem.
> This would falsely return "they're equal" if one or both reps have
> ->expanded_size==0 for a non-empty file.
>
-- Stefan^2.
Received on 2015-04-13 19:00:43 CEST