Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29988127 authored by Tao Bao's avatar Tao Bao Committed by Android (Google) Code Review
Browse files

Merge "Skip checking files that have less blocks in block map." into oc-dr1-dev

parents f84b592e d8617140
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -71,8 +71,20 @@ def ValidateFileConsistency(input_zip, input_tmp):
      file_size = len(file_data)
      file_size_rounded_up = RoundUpTo4K(file_size)
      file_data += '\0' * (file_size_rounded_up - file_size)
      file_sha1 = common.File(entry, file_data).sha1
      unpacked_file = common.File(entry, file_data)
      file_size = unpacked_file.size

      # block.map may contain less blocks, because mke2fs may skip allocating
      # blocks if they contain all zeros. We can't reconstruct such a file from
      # its block list. (Bug: 65213616)
      if file_size > ranges.size() * 4096:
        logging.warning(
            'Skipping %s that has less blocks: file size %d-byte,'
            ' ranges %s (%d-byte)', entry, file_size, ranges,
            ranges.size() * 4096)
        continue

      file_sha1 = unpacked_file.sha1
      assert blocks_sha1 == file_sha1, \
          'file: %s, range: %s, blocks_sha1: %s, file_sha1: %s' % (
              entry, ranges, blocks_sha1, file_sha1)