From ac71c3be638e990dabe8f61797bf5a0d2f0d74ed Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Sat, 20 Feb 2016 03:36:37 -0800 Subject: [PATCH] 4.0.2rc1 - release notes, add missing file caught by Travis --- .gitignore | 1 + RELEASE_NOTES.rst | 21 ++++++++++++++ tests/spoof/tesseract_crash.py | 50 ++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100755 tests/spoof/tesseract_crash.py diff --git a/.gitignore b/.gitignore index dfdf371d..b8648bef 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ pyvenv.cfg .eggs/ build/ dist/ +wheelhouse/ # Automatically generated files ocrmypdf/lib/_*.py diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index 74618de9..622d5a9e 100644 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -6,6 +6,27 @@ Please always read this file before installing the package Download software here: https://github.com/jbarlow83/OCRmyPDF/tags +v4.0.2: +======= + +Fixes +----- + +- Fixed compatibility with Tesseract 3.04.01 release, particularly its different way of outputting + orientation information +- Improved handling of Tesseract errors and crashes +- Fixed use of chmod on Docker that broke most test cases + + +v4.0.1: +======= + +Fixes +----- + +- Fixed a KeyError if tesseract fails to find page orientation information + + v4.0: ===== diff --git a/tests/spoof/tesseract_crash.py b/tests/spoof/tesseract_crash.py new file mode 100755 index 00000000..f5470766 --- /dev/null +++ b/tests/spoof/tesseract_crash.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +import sys +import os +import signal + + +VERSION_STRING = '''tesseract 3.04.00 + leptonica-1.72 + libjpeg 8d : libpng 1.6.19 : libtiff 4.0.6 : zlib 1.2.5 +SPOOFED: CRASH ON OCR or -psm 0 +''' + +"""Simulates a Tesseract crash + +It isn't strictly necessary to crash the process and that has unwanted +side effects like triggering core dumps or error reporting, logging and such. +It's enough to dump some text to stderr and return an error code. + +Follows the POSIX? convention of returning 128 + signal number. + +""" + + +def main(): + if sys.argv[1] == '--version': + print(VERSION_STRING, file=sys.stderr) + sys.exit(0) + elif sys.argv[1] == '--list-langs': + print('List of available languages (1):\neng', file=sys.stderr) + sys.exit(0) + elif sys.argv[-1] == 'hocr': + print("KABOOM! Tesseract failed for some reason", file=sys.stderr) + sys.exit(128 + signal.SIGSEGV) + elif sys.argv[-1] == 'pdf': + print("KABOOM! Tesseract failed for some reason", file=sys.stderr) + sys.exit(128 + signal.SIGSEGV) + elif sys.argv[-1] == 'stdout': + print("libc++abi.dylib: terminating with uncaught exception of type " + "std::bad_alloc: std::bad_alloc", file=sys.stderr) + sys.exit(128 + signal.SIGABRT) + else: + print("Spoof doesn't understand arguments", file=sys.stderr) + print(sys.argv, file=sys.stderr) + sys.exit(1) + + sys.exit(0) + + +if __name__ == '__main__': + main()