Open hattne opened 2 months ago
This test program fails in archive_read_open_fd() with current libarchive:
archive_read_open_fd()
libarchive
#include <Windows.h> #include <fcntl.h> #include <archive.h> int main(int argc, char* argv[]) { struct archive *archive; HANDLE hFile; int fd; hFile = CreateFileA(argv[0], GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); fd = _open_osfhandle((intptr_t)hFile, _O_RDONLY); archive = archive_read_new(); archive_read_open_fd(archive, fd, 16384); archive_free(archive); CloseHandle(hFile); printf("Happy ending\n"); return (0); }
For a libarchive built with /MD there is a Happy ending.
/MD
Happy ending
One way to fix this is provided in #91.
anyio 4.1.0 pyhd8ed1ab_0 conda-forge archspec 0.2.2 pyhd8ed1ab_0 conda-forge attrs 23.1.0 pyh71513ae_1 conda-forge azure-core 1.29.5 pyhd8ed1ab_0 conda-forge beautifulsoup4 4.12.2 pyha770c72_0 conda-forge blinker 1.7.0 pyhd8ed1ab_0 conda-forge boltons 23.0.0 pyhd8ed1ab_0 conda-forge boolean.py 4.0 pyhd8ed1ab_0 conda-forge brotli-python 1.1.0 py312h53d5487_1 conda-forge bzip2 1.0.8 hcfcfb64_5 conda-forge ca-certificates 2024.2.2 h56e8100_0 conda-forge certifi 2024.2.2 pyhd8ed1ab_0 conda-forge cffi 1.16.0 py312he70551f_0 conda-forge chardet 5.2.0 py312h2e8e312_1 conda-forge charset-normalizer 3.3.2 pyhd8ed1ab_0 conda-forge cirun 0.30 pyhd8ed1ab_0 conda-forge click 8.1.7 win_pyh7428d3b_0 conda-forge cmake 3.29.1 hf0feee3_0 conda-forge colorama 0.4.6 pyhd8ed1ab_0 conda-forge conda 24.1.2 py312h2e8e312_0 conda-forge conda-build 24.3.0 py312h2e8e312_1 conda-forge conda-forge-pinning 2023.12.08.22.42.32 hd8ed1ab_0 conda-forge conda-index 0.4.0 pyhd8ed1ab_0 conda-forge conda-libmamba-solver 23.11.1 pyhd8ed1ab_0 conda-forge conda-package-handling 2.2.0 pyh38be061_0 conda-forge conda-package-streaming 0.9.0 pyhd8ed1ab_0 conda-forge conda-smithy 3.34.1 pyhd8ed1ab_0 conda-forge cryptography 42.0.5 py312h1f4a190_0 conda-forge cython 3.0.10 py312h53d5487_0 conda-forge deprecated 1.2.14 pyh1a96a4e_0 conda-forge distlib 0.3.7 pyhd8ed1ab_0 conda-forge distro 1.8.0 pyhd8ed1ab_0 conda-forge docbook-xsl 1.79.2 h57928b3_1 conda-forge editables 0.3 pyhd8ed1ab_0 conda-forge exceptiongroup 1.2.0 pyhd8ed1ab_0 conda-forge fftw 3.3.10 nompi_h38027f0_108 conda-forge filelock 3.13.1 pyhd8ed1ab_0 conda-forge fmt 10.1.1 h181d51b_1 conda-forge git 2.44.0 h57928b3_0 conda-forge gitdb 4.0.11 pyhd8ed1ab_0 conda-forge gitpython 3.1.40 pyhd8ed1ab_0 conda-forge h11 0.14.0 pyhd8ed1ab_0 conda-forge h2 4.1.0 pyhd8ed1ab_0 conda-forge hatch 1.7.0 pyhd8ed1ab_0 conda-forge hatchling 1.18.0 pyhd8ed1ab_0 conda-forge hpack 4.0.0 pyh9f0ad1d_0 conda-forge httpcore 1.0.2 pyhd8ed1ab_0 conda-forge httpx 0.25.2 pyhd8ed1ab_0 conda-forge hyperframe 6.0.1 pyhd8ed1ab_0 conda-forge hyperlink 21.0.0 pyhd3deb0d_0 conda-forge idna 3.6 pyhd8ed1ab_0 conda-forge importlib-metadata 7.0.0 pyha770c72_0 conda-forge importlib_metadata 7.0.0 hd8ed1ab_0 conda-forge importlib_resources 6.1.1 pyhd8ed1ab_0 conda-forge intel-openmp 2023.2.0 h57928b3_50497 conda-forge isodate 0.6.1 pyhd8ed1ab_0 conda-forge jaraco.classes 3.3.0 pyhd8ed1ab_0 conda-forge jaraco.context 5.3.0 pyhd8ed1ab_0 conda-forge jaraco.functools 4.0.0 pyhd8ed1ab_0 conda-forge jinja2 3.1.2 pyhd8ed1ab_1 conda-forge jsonpatch 1.33 pyhd8ed1ab_0 conda-forge jsonpointer 2.4 py312h2e8e312_3 conda-forge jsonschema 4.20.0 pyhd8ed1ab_0 conda-forge jsonschema-specifications 2023.11.2 pyhd8ed1ab_0 conda-forge keyring 25.1.0 pyh7428d3b_0 conda-forge krb5 1.21.2 heb0366b_0 conda-forge lerc 4.0.0 h63175ca_0 conda-forge libarchive 3.7.2 h313118b_1 conda-forge libblas 3.9.0 20_win64_mkl conda-forge libcblas 3.9.0 20_win64_mkl conda-forge libcurl 8.7.1 hd5e4a3a_0 conda-forge libdeflate 1.20 hcfcfb64_0 conda-forge libexpat 2.6.2 h63175ca_0 conda-forge libffi 3.4.2 h8ffe710_5 conda-forge libiconv 1.17 hcfcfb64_2 conda-forge libjpeg-turbo 3.0.0 hcfcfb64_1 conda-forge liblapack 3.9.0 20_win64_mkl conda-forge liblief 0.14.1 he0c23c2_1 conda-forge libmamba 1.5.4 h3f09ed1_0 conda-forge libmambapy 1.5.4 py312h66cf91f_0 conda-forge libsolv 0.7.27 h12be248_0 conda-forge libsqlite 3.45.2 hcfcfb64_0 conda-forge libssh2 1.11.0 h7dfc565_0 conda-forge libtiff 4.6.0 hddb2be6_3 conda-forge libuv 1.48.0 hcfcfb64_0 conda-forge libxml2 2.12.6 hc3477c8_1 conda-forge libxslt 1.1.39 h3df6e99_0 conda-forge libzlib 1.2.13 hcfcfb64_5 conda-forge license-expression 30.1.1 pyhd8ed1ab_0 conda-forge lz4-c 1.9.4 hcfcfb64_0 conda-forge lzo 2.10 he774522_1000 conda-forge m2-bash 4.3.042 5 conda-forge m2-coreutils 8.25 102 conda-forge m2-db 5.3.28 3 conda-forge m2-gcc-libs 5.3.0 4 conda-forge m2-gdbm 1.11 4 conda-forge m2-gmp 6.1.0 3 conda-forge m2-groff 1.22.3 2 conda-forge m2-less 481 2 conda-forge m2-libcrypt 1.3 2 conda-forge m2-libdb 5.3.28 3 conda-forge m2-libgdbm 1.11 4 conda-forge m2-libiconv 1.14 3 conda-forge m2-libintl 0.19.7 4 conda-forge m2-libpcre 8.38 2 conda-forge m2-libpipeline 1.4.0 2 conda-forge m2-man-db 2.7.4 2 conda-forge m2-msys2-runtime 2.5.0.17080.65c939c 3 conda-forge m2-ncurses 6.0.20160220 2 conda-forge m2-patch 2.7.5 2 conda-forge m2-perl 5.22.1 2 conda-forge m2-sed 4.2.2 3 conda-forge m2-zlib 1.2.8 4 conda-forge m2w64-gcc-libgfortran 5.3.0 6 conda-forge m2w64-gcc-libs 5.3.0 7 conda-forge m2w64-gcc-libs-core 5.3.0 7 conda-forge m2w64-gmp 6.1.0 2 conda-forge m2w64-libwinpthread-git 5.0.0.4634.697f757 2 conda-forge markdown-it-py 3.0.0 pyhd8ed1ab_0 conda-forge markupsafe 2.1.5 py312he70551f_0 conda-forge mdurl 0.1.0 pyhd8ed1ab_0 conda-forge menuinst 2.0.2 py312h53d5487_0 conda-forge mkl 2023.2.0 h6a75c08_50497 conda-forge more-itertools 10.1.0 pyhd8ed1ab_0 conda-forge msrest 0.7.1 pyhd8ed1ab_0 conda-forge msys2-conda-epoch 20160418 1 conda-forge nlopt 2.7.1 py312h7fb0d8c_4 conda-forge numpy 1.26.4 py312h8753938_0 conda-forge oauthlib 3.2.2 pyhd8ed1ab_0 conda-forge openssl 3.2.1 hcfcfb64_1 conda-forge packaging 23.2 pyhd8ed1ab_0 conda-forge pandoc 3.1.13 h57928b3_0 conda-forge pathspec 0.11.2 pyhd8ed1ab_0 conda-forge pexpect 4.8.0 pyh1a96a4e_2 conda-forge pip 23.3.1 pyhd8ed1ab_0 conda-forge pkginfo 1.9.6 pyhd8ed1ab_0 conda-forge pkgutil-resolve-name 1.3.10 pyhd8ed1ab_1 conda-forge platformdirs 4.1.0 pyhd8ed1ab_0 conda-forge pluggy 1.3.0 pyhd8ed1ab_0 conda-forge psutil 5.9.8 py312he70551f_0 conda-forge ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge py-lief 0.14.1 py312h275cf98_1 conda-forge pybind11-abi 4 hd8ed1ab_3 conda-forge pycosat 0.6.6 py312he70551f_0 conda-forge pycparser 2.21 pyhd8ed1ab_0 conda-forge pycryptodome 3.20.0 py312he70551f_0 conda-forge pygithub 2.1.1 pyhd8ed1ab_0 conda-forge pygments 2.17.2 pyhd8ed1ab_0 conda-forge pyjwt 2.8.0 pyhd8ed1ab_0 conda-forge pynacl 1.5.0 py312hc560f31_3 conda-forge pyperclip 1.8.2 pyhd8ed1ab_2 conda-forge pysocks 1.7.1 pyh0701188_6 conda-forge python 3.12.2 h2628c8c_0_cpython conda-forge python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge python-libarchive-c 5.1 py312h2e8e312_0 conda-forge python_abi 3.12 4_cp312 conda-forge pytz 2023.3.post1 pyhd8ed1ab_0 conda-forge pywin32-ctypes 0.2.2 py312h2e8e312_1 conda-forge pyyaml 6.0.1 py312he70551f_1 conda-forge referencing 0.32.0 pyhd8ed1ab_0 conda-forge reproc 14.2.4.post0 hcfcfb64_1 conda-forge reproc-cpp 14.2.4.post0 h63175ca_1 conda-forge requests 2.31.0 pyhd8ed1ab_0 conda-forge requests-oauthlib 1.3.1 pyhd8ed1ab_0 conda-forge rich 13.7.0 pyhd8ed1ab_0 conda-forge ripgrep 14.0.3 h7f3b576_1 conda-forge rpds-py 0.18.0 py312hfccd98a_0 conda-forge ruamel.yaml 0.18.6 py312he70551f_0 conda-forge ruamel.yaml.clib 0.2.8 py312he70551f_0 conda-forge scrypt 0.8.24 py312h6be9b4e_0 conda-forge setuptools 68.2.2 pyhd8ed1ab_0 conda-forge shellingham 1.5.4 pyhd8ed1ab_0 conda-forge six 1.16.0 pyh6c4a22f_0 conda-forge smmap 5.0.0 pyhd8ed1ab_0 conda-forge sniffio 1.3.0 pyhd8ed1ab_0 conda-forge soupsieve 2.5 pyhd8ed1ab_1 conda-forge tbb 2021.7.0 h91493d7_0 conda-forge tk 8.6.13 h5226925_1 conda-forge tomli 2.0.1 pyhd8ed1ab_0 conda-forge tomli-w 1.0.0 pyhd8ed1ab_0 conda-forge tomlkit 0.12.3 pyha770c72_0 conda-forge toolz 0.12.0 pyhd8ed1ab_0 conda-forge tqdm 4.66.1 pyhd8ed1ab_0 conda-forge trove-classifiers 2023.11.29 pyhd8ed1ab_0 conda-forge truststore 0.8.0 pyhd8ed1ab_0 conda-forge typer 0.9.0 pyhd8ed1ab_0 conda-forge typing-extensions 4.8.0 hd8ed1ab_0 conda-forge typing_extensions 4.8.0 pyha770c72_0 conda-forge tzdata 2023c h71feb2d_0 conda-forge ucrt 10.0.22621.0 h57928b3_0 conda-forge urllib3 2.1.0 pyhd8ed1ab_0 conda-forge userpath 1.7.0 pyhd8ed1ab_0 conda-forge vc 14.3 h64f974e_17 conda-forge vc14_runtime 14.38.33130 h82b7239_18 conda-forge virtualenv 20.25.0 pyhd8ed1ab_0 conda-forge vs2015_runtime 14.38.33130 hcb4865c_18 conda-forge vs2019_win-64 19.29.30139 he1865b1_18 conda-forge vsts-python-api 0.1.22 py_0 conda-forge vswhere 3.1.4 h57928b3_0 conda-forge wheel 0.42.0 pyhd8ed1ab_0 conda-forge win_inet_pton 1.1.0 pyhd8ed1ab_6 conda-forge winflexbison 2.5.25 h1537add_0 conda-forge wrapt 1.16.0 py312he70551f_0 conda-forge xz 5.2.6 h8d14728_0 conda-forge yaml 0.2.5 h8ffe710_2 conda-forge yaml-cpp 0.8.0 h63175ca_0 conda-forge zipp 3.17.0 pyhd8ed1ab_0 conda-forge zstandard 0.22.0 py312h01d794b_0 conda-forge zstd 1.5.5 h12be248_0 conda-forge
active environment : microed-build active env location : C:\Users\hattne\miniconda3\envs\microed-build shell level : 2 user config file : C:\Users\hattne\.condarc populated config files : C:\Users\hattne\.condarc conda version : 24.3.0 conda-build version : not installed python version : 3.8.13.final.0 solver : libmamba (default) virtual packages : __archspec=1=x86_64_v4 __conda=24.3.0=0 __cuda=11.3=0 __win=0=0 base environment : C:\Users\hattne\miniconda3 (writable) conda av data dir : C:\Users\hattne\miniconda3\etc\conda conda av metadata url : None channel URLs : https://conda.anaconda.org/conda-forge/win-64 https://conda.anaconda.org/conda-forge/noarch https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/win-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/msys2/win-64 https://repo.anaconda.com/pkgs/msys2/noarch package cache : C:\Users\hattne\miniconda3\pkgs C:\Users\hattne\.conda\pkgs C:\Users\hattne\AppData\Local\conda\conda\pkgs envs directories : C:\Users\hattne\miniconda3\envs C:\Users\hattne\.conda\envs C:\Users\hattne\AppData\Local\conda\conda\envs platform : win-64 user-agent : conda/24.3.0 requests/2.31.0 CPython/3.8.13 Windows/10 Windows/10.0.26100 solver/libmamba conda-libmamba-solver/23.11.1 libmambapy/1.5.4 administrator : False netrc file : None offline mode : False
Solution to issue cannot be found in the documentation.
Issue
This test program fails in
archive_read_open_fd()
with currentlibarchive
:For a
libarchive
built with/MD
there is aHappy ending
.One way to fix this is provided in #91.
Installed packages
Environment info