jwilk-archive / python-djvulibre

Python interface to DjVuLibre
GNU General Public License v2.0
25 stars 11 forks source link

test_export_ps failed: CalledProcessError: Command 'ps2ascii' returned non-zero exit status 139 #6

Open LazyKent opened 6 years ago

LazyKent commented 6 years ago

One of tests failed.

ERROR: test_decode.test_documents.test_export_ps
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/usr/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
     self.test(*self.arg)
   File "/home/abuild/rpmbuild/BUILD/python-djvulibre-0.8/tests/test_decode.py", line 413, in test_export_ps
     stdout, stderr = run('ps2ascii', tmp.name, LC_ALL='C')
   File "/home/abuild/rpmbuild/BUILD/python-djvulibre-0.8/tests/test_decode.py", line 128, in run
     raise subprocess.CalledProcessError(child.returncode, cmd[0])
 CalledProcessError: Command 'ps2ascii' returned non-zero exit status 139

It seems related to Ghostscript 9.22.

jwilk commented 6 years ago

Command 'ps2ascii' returned non-zero exit status 139

Huh, looks like gs is segfaulting. Could you check what happens if you run these commands:

djvups tests/images/test0.djvu test0.ps
gs -q -dSAFER -sDEVICE=txtwrite -o test0.txt test0.ps

?

It seems related to Ghostscript 9.22.

I have Ghostscript 9.22 here, too, but it doesn't fail that way. ps2ascii succeeds, but it doesn't output what the test expects, so the test fails later:

======================================================================
FAIL: test_decode.test_documents.test_export_ps
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File ".../python-djvulibre/tests/test_decode.py", line 415, in test_export_ps
    assert_equal(stdout, b('\x0c') * 2)
AssertionError: '  [...]  \x00\r\n' != '\x0c\x0c'

----------------------------------------------------------------------

(I manually truncated the left operand in the assertion error message, because it was nearly 50 kilobytes long!)

jwilk commented 6 years ago
AssertionError: '  [...]  \x00\r\n' != '\x0c\x0c'

This should be fixed in 688e1cbb18dc1b3893e0d8d0e1f95dfafd7eda08.

LazyKent commented 6 years ago

Could you check what happens if you run these commands:

djvups tests/images/test0.djvu test0.ps
gs -q -dSAFER -sDEVICE=txtwrite -o test0.txt test0.ps

?

Segmentation fault (core dumped).

I see two different logs for i586 and x86_54. https://build.opensuse.org/build/openSUSE:Factory/standard/i586/python-djvulibre/_log https://build.opensuse.org/build/openSUSE:Factory/standard/x86_64/python-djvulibre/_log

jwilk commented 6 years ago

I see two different logs for i586 and x86_54.

Aha, thanks for the hint that this might be architecture-specific. I now reproduced the crash on amd64, and filed a bug in my distro's bug tracker: https://bugs.debian.org/887661

https://build.opensuse.org/build/openSUSE:Factory/standard/i586/python-djvulibre/_log https://build.opensuse.org/build/openSUSE:Factory/standard/x86_64/python-djvulibre/_log

I get anonymous_user(Anonymous user is not allowed here - please login): for both. :-(

LazyKent commented 6 years ago

I get anonymous_user(Anonymous user is not allowed here - please login): for both. :-(

Attached. Nothing new, anyway. One fail (x86_64) is from my report and another one (i586) is from your comment.

x86_64.log.gz i586.log.gz

LazyKent commented 6 years ago

I now reproduced the crash on amd64, and filed a bug in my distro's bug tracker

Also reported to bugzilla.opensuse.org.

jwilk commented 6 years ago

I've forwarded the bug to Ghostscript upstream: https://bugs.ghostscript.com/show_bug.cgi?id=699391

jwilk commented 6 years ago
AssertionError: '  [...]  \x00\r\n' != '\x0c\x0c'

I've just released python-djvulibre 0.8.1, which includes the fix for the above.

Regarding Ghostscript segfaulting: I don't intend to implement any work-around for this. I recommend that affected downstreams disable the failing test until Ghostscript is fixed. test_export_ps is for an obscure feature I'm pretty sure nobody uses, so disabling it temporarily shouldn't be a big deal.

LazyKent commented 6 years ago

disable the failing test

How can I disable a single test?

The command line is: python -m nose --verbose

jwilk commented 6 years ago

How can I disable a single test?

Pass --exclude='^test_export_ps$' to nose.

LazyKent commented 6 years ago

Python2 tests are OK:

 /usr/bin/python2 -m nose '--exclude=^test_export_ps$' --verbose
...
 Ran 108 tests in 0.307s

 OK

But Python3 tests are failed:

 /usr/bin/python3 -m nose '--exclude=^test_export_ps$' --verbose
 Failure: ImportError (dynamic module does not define module export function (PyInit_sexpr)) ... ERROR
 Failure: ImportError (dynamic module does not define module export function (PyInit_decode)) ... ERROR
 Failure: ImportError (dynamic module does not define module export function (PyInit_sexpr)) ... ERROR

 ======================================================================
 ERROR: Failure: ImportError (dynamic module does not define module export function (PyInit_sexpr))
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/usr/lib/python3.6/site-packages/nose/failure.py", line 39, in runTest
     raise self.exc_val.with_traceback(self.tb)
   File "/usr/lib/python3.6/site-packages/nose/loader.py", line 417, in loadTestsFromName
     addr.filename, addr.module)
   File "/usr/lib/python3.6/site-packages/nose/importer.py", line 47, in importFromPath
     return self.importFromDir(dir_path, fqname)
   File "/usr/lib/python3.6/site-packages/nose/importer.py", line 94, in importFromDir
     mod = load_module(part_fqname, fh, filename, desc)
   File "/usr/lib64/python3.6/imp.py", line 235, in load_module
     return load_source(name, filename, file)
   File "/usr/lib64/python3.6/imp.py", line 172, in load_source
     module = _load(spec)
   File "<frozen importlib._bootstrap>", line 684, in _load
   File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
   File "<frozen importlib._bootstrap_external>", line 678, in exec_module
   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
   File "/home/abuild/rpmbuild/BUILD/python-djvulibre-0.8.1/tests/test_const.py", line 16, in <module>
     from djvu.const import (
   File "/home/abuild/rpmbuild/BUILD/python-djvulibre-0.8.1/tests/djvu/const.py", line 18, in <module>
     import djvu.sexpr
 ImportError: dynamic module does not define module export function (PyInit_sexpr)

 ======================================================================
 ERROR: Failure: ImportError (dynamic module does not define module export function (PyInit_decode))
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/usr/lib/python3.6/site-packages/nose/failure.py", line 39, in runTest
     raise self.exc_val.with_traceback(self.tb)
   File "/usr/lib/python3.6/site-packages/nose/loader.py", line 417, in loadTestsFromName
     addr.filename, addr.module)
   File "/usr/lib/python3.6/site-packages/nose/importer.py", line 47, in importFromPath
     return self.importFromDir(dir_path, fqname)
   File "/usr/lib/python3.6/site-packages/nose/importer.py", line 94, in importFromDir
     mod = load_module(part_fqname, fh, filename, desc)
   File "/usr/lib64/python3.6/imp.py", line 235, in load_module
     return load_source(name, filename, file)
   File "/usr/lib64/python3.6/imp.py", line 172, in load_source
     module = _load(spec)
   File "<frozen importlib._bootstrap>", line 684, in _load
   File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
   File "<frozen importlib._bootstrap_external>", line 678, in exec_module
   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
   File "/home/abuild/rpmbuild/BUILD/python-djvulibre-0.8.1/tests/test_decode.py", line 25, in <module>
     from djvu.decode import (
 ImportError: dynamic module does not define module export function (PyInit_decode)

 ======================================================================
 ERROR: Failure: ImportError (dynamic module does not define module export function (PyInit_sexpr))
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/usr/lib/python3.6/site-packages/nose/failure.py", line 39, in runTest
     raise self.exc_val.with_traceback(self.tb)
   File "/usr/lib/python3.6/site-packages/nose/loader.py", line 417, in loadTestsFromName
     addr.filename, addr.module)
   File "/usr/lib/python3.6/site-packages/nose/importer.py", line 47, in importFromPath
     return self.importFromDir(dir_path, fqname)
   File "/usr/lib/python3.6/site-packages/nose/importer.py", line 94, in importFromDir
     mod = load_module(part_fqname, fh, filename, desc)
   File "/usr/lib64/python3.6/imp.py", line 235, in load_module
     return load_source(name, filename, file)
   File "/usr/lib64/python3.6/imp.py", line 172, in load_source
     module = _load(spec)
   File "<frozen importlib._bootstrap>", line 684, in _load
   File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
   File "<frozen importlib._bootstrap_external>", line 678, in exec_module
   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
   File "/home/abuild/rpmbuild/BUILD/python-djvulibre-0.8.1/tests/test_sexpr.py", line 31, in <module>
     from djvu.sexpr import (
 ImportError: dynamic module does not define module export function (PyInit_sexpr)

 ----------------------------------------------------------------------
 Ran 3 tests in 0.034s

 FAILED (errors=3)
jwilk commented 6 years ago
ImportError: dynamic module does not define module export function (PyInit_sexpr)

I seem to recall this happens when Python 3 tries to import modules that were built for Python 2.