History log of /external/bsdiff/bspatch.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
1106bf7d9cfaff6adfb04c15d274c909d8ea7a1d 16-Nov-2017 Amin Hassani <ahassani@google.com> bsdiff: Change all stderr and perror to LOG(ERROR)

We need to be able to turn off the logging at runtime. When performing fuzz
testing, the input data is mostly invalid. But the invalid input data causes all
the error logs in the output which is noisy, inefficient, and not
necessary. More information can be found in:
https://chromium.googlesource.com/chromium/src/+/master/testing/libfuzzer/getting_started.md#disable-noisy-error-message-logging

One option to turn off the logging at runtime is:

std::cerr.setstate(std::ios_base::failbit);

which works but not when we are doing fprintf to stderr. Another option
is in the lines of the following:

freopen("/dev/null", "w", stderr);

But, this seem to disable everything even useful needed logs.

This patch, changes all codes (except in bsdiff_main.cc) that logs using
fprintf() and perror() to the new uniform form of logging (defined in
logging.h). This new logging alternative allows universal manipulation of the
logging if necessary.

Bug: none
Test: unittests pass

Change-Id: I42bb3e5856c5c215dd82925ccdca44556124655d
/external/bsdiff/bspatch.cc
ea72d9f624570128a861491d7b1caf6a043729c5 26-Oct-2017 Alex Deymo <deymo@google.com> Add/remove includes to match used types.

uint64_t and similar types are defined in stdint.h, and size_t is
defined in stddef.h. While these headers are included virtually
everywhere anyways we should include what we use, specially in public
headers.

Bug: None
Test: still compiles.

Change-Id: I26846be960bf9c989372a05e9c4369caf02888cd
/external/bsdiff/bspatch.cc
6528812247bf9be1b9ccf4560b798d3e12fd36ba 14-Oct-2017 Tianjie Xu <xunchang@google.com> Add an interface for bspatch reader

Add a wrapper class to separate the patch read from data stream
decompression. Therefore, bspatch will be able to process the patch
that is compressed with various tools.

Test: unittest pass
Change-Id: I5214e0451bde80366e8a70b960703afb2b2a7d97
/external/bsdiff/bspatch.cc
dcd423bf892bc607cbccb292b042c1a9a191ba94 13-Sep-2017 Alex Deymo <deymo@google.com> Add the "bsdiff/" prefix to all include paths.

This prevents accidentally including a header file from another project
that happens to have the same name.

Test: `make checkbuild`; emerge-${BOARD} bsdiff
Bug: None

Change-Id: I8af132ed388738c30a8e3d7434de70b1e9d2f924
/external/bsdiff/bspatch.cc
ddf9db52938e67d4dcbf7c4f159b094eaddbabeb 03-Mar-2017 Alex Deymo <deymo@google.com> Update Makefile to build shared libraries.

The Makefile didn't build libbspatch and libbsdiff. This patch includes
those libraries in the Makefile and moves the header files exposed by
those to an include/bsdiff subdirectory following the Android
convention so calling program can include "bsdiff/bspatch.h" avoiding
any collision with other libraries.

The Android.mk is updated to export the new include path while keeping
the old style until calling programs are updated.

The new Makefile allows Chromium OS to build the new libraries.

Bug: None
Test: FEATURES=test emerge-link bsdiff; sudo emerge bsdiff
Test: mmma external/bsdiff

Change-Id: I2ea9251eb224e9418fe236e4c4c9c5621853f590
/external/bsdiff/bspatch.cc
62d5e48122519abcc89837d99fc60a09fc8ba405 25-Jan-2017 Sen Jiang <senj@google.com> Add another overload of bspatch().

It accepts old and new filenames with extents and patch data and size.

Bug: 26982501
Test: mma
Change-Id: I812fe7441fe2ae768bbfc48c65c097af991c105b
/external/bsdiff/bspatch.cc
b552c79a0d681f17ba19ff55e2062c483c236cc4 20-Jan-2017 Sen Jiang <senj@google.com> bspatch: convert all err() and errx() calls to returns.

bspatch is used as a library now, it can't just exit on errors.

Bug: 29058789
Test: mma
Change-Id: I226574a534027d9dc8e5801bc71104dc6d1a410c
/external/bsdiff/bspatch.cc
716d569273ef2aeacfe7555f60f7784b2366225d 10-May-2016 Sen Jiang <senj@google.com> Provide interface for in memory bspatch.

Renamed existing MemoryFile to BufferFile, and added a read only
MemoryFile to provide file interface to read file data already in
memory without extra copy (extra memory usage).

Added write only SinkFile to provide sink function support used in
applypatch. It will enable imgpatch the ability to stream output.

Test: mma
Bug: 26982501

Change-Id: I025ce4064c9f46623dd73f24d30e21e88f08a292
/external/bsdiff/bspatch.cc
b14bb55294132466913a07e2c0a54b8765c9240b 12-Apr-2016 Sen Jiang <senj@google.com> Fix infinite loop when using extents.

Clearing |buffer_| still actually makes sense because MemoryFile::Close()
is called twice: once explicitly from bspatch to check if Close()
succeeded, once from destructor to ensure that everything is closed. And
if we don't clear |buffer_|, on the second Close(), it will try to write
|buffer_| to |file_| again, and if |file_| is an ExtentsFile, it will
simply return true and set |bytes_written| to 0 on Write() because all
the extents are already written, now WriteAll() became an infinite
loop.
Although returning false if written is 0 in WriteAll() will fix this, but
I think we should not write the same buffer again in the first place.

Test: call bspatch with extents
Bug: 25773600

Change-Id: If3bddcc6e8ca6751c422c066e5b8b02f91086ed5
/external/bsdiff/bspatch.cc
5b372b684ac4f9585fb2a00098d77f959bec0074 29-Mar-2016 Sen Jiang <senj@google.com> Stream the output to disk.

Now that update_engine no longer uses minor version 1, old file and
new file are always different in the device, so we can write the
output to disk right away to save memory.
The old behavior is still kept if the new file is overlapping with the
old file for paycheck.py usage.

Test: bsdiff_unittest
Test: apply a 3M patch overwriting old file, uses 25M memory.
Test: apply a 3M patch not overwriting old file, uses 9M memory.
Bug: 25773600

Change-Id: Ic289c9bcc6f1810d0f222a9a4241c05756084b1c
/external/bsdiff/bspatch.cc
d87c83566c8411c16098dcc09ac56cce6007f9c6 21-Nov-2015 Sen Jiang <senj@google.com> Various fixes in bspatch and File class.

bspatch should add diff block and old file.

Fix crash on free(new_buf).

open() in bionic needs mode to be set if O_CREAT.

Fix typo in Seek().

Wrong GetSize() for regular file.

Bug: 24478450
Test: Delta update passes filesystem verification on target partition.

Change-Id: Ie53b7cf2b7467fb2cf78762d41e7f65674afa969
/external/bsdiff/bspatch.cc
437b7afd23768d737055fa70b79f5f2f714583a5 15-Oct-2015 Alex Deymo <deymo@google.com> bspatch: Re-enable extents support.

With the implementation of the ExtentsFile, we can now use the
FileInterface from bspatch to read and write files. This patch
re-enables the extent argument support and adds unittests for the
argument parsing.

Bug: 24478450
Test: make all test && ./unittest

Change-Id: If6837f250df10c24d3ff96f7ad8f0e0d98126788
/external/bsdiff/bspatch.cc
b870eb5805202d3464e36f18060bdd4bcd367b30 15-Oct-2015 Alex Deymo <deymo@google.com> bspatch: Ran clang-format on bspatch.cc.

This patch attempts to uniform the format on bspatch before we land
further changes there.

Bug: 24478450
Test: make all test && ./unittest

Change-Id: I45ec3d45ab4b081bddef1ac7f5df35ac7e6e554c
/external/bsdiff/bspatch.cc
20891f9c246ec36e6c148579522ac00051b64457 13-Oct-2015 Alex Deymo <deymo@google.com> Convert C sources to C++.

To help refactoring the FILE* access behind an interface and better
integrate with unittest code, this patch moves the C sources to C++.
Minor changes to make this conform to C++ were included.

Bug: 24478450
Test: `make all test && ./unittests`; mm

Change-Id: I27d7fb0660efc18ea0cb84ff544c9dd9c4803050
/external/bsdiff/bspatch.cc