markokr / rarfile

Python module for RAR archive reading
https://pypi.org/project/rarfile/
ISC License
246 stars 55 forks source link

test_unar_tool test failure #104

Open xiota opened 6 months ago

xiota commented 6 months ago

Python 3.12

=================================== FAILURES ===================================
________________________________ test_unar_tool ________________________________

    @pytest.mark.skipif(sys.platform == "win32", reason="unar not available on Windows")
    @pytest.mark.skipif(not have_tool(rarfile.UNAR_TOOL), reason="unar not installed")
    def test_unar_tool():
        install_unar_tool()
        try:
>           test_read_rar3()

test/test_tool.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test/test_tool.py:56: in test_read_rar3
    rf.read(fn)
rarfile.py:838: in read
    return f.read()
rarfile.py:2310: in read
    self._check()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <rarfile.PipeReader object at 0x7f5d0024f520>

    def _check(self):
        """Check final CRC."""
        final = self._md_context.digest()
        exp = self._inf._md_expect
        if exp is None:
            return
        if final is None:
            return
        if self._returncode:
            check_returncode(self._returncode, "", tool_setup().get_errmap())
        if self._remain != 0:
            raise BadRarFile("Failed the read enough data")
        if final != exp:
>           raise BadRarFile("Corrupt file - CRC check failed: %s - exp=%r got=%r" % (
                self._inf.filename, exp, final))
E           rarfile.BadRarFile: Corrupt file - CRC check failed: stest1.txt - exp=3317163682 got=3067759956

rarfile.py:2326: BadRarFile
=========================== short test summary info ============================
FAILED test/test_tool.py::test_unar_tool - rarfile.BadRarFile: Corrupt file -...
=================== 1 failed, 150 passed, 6 skipped in 9.35s ===================
markokr commented 6 months ago

What is the version of unar you are running? And what OS are you on?

xiota commented 6 months ago

Arch Linux. unarchive 1.10.8

CarloDePieri commented 3 months ago

I can confirm this test failure. I'm also running Arch, python 3.12.4 and the unar binary reports version v1.10.7 (although the unarchiver package is at 1.10.8-2).

People are also reporting this error on the aur page of python-rarfile (not that the aur package is to blame per se: I'm failing the test even by running pytest from this repo code directly).

bgermann commented 1 month ago

The version is known to be reported wrongly, see https://github.com/MacPaw/XADMaster/pull/169