diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 9e0059cf0e..72b73dcacc 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -30,7 +30,7 @@ jobs: elif [ "$ID" = "arch" ]; then pacman -Syu --noconfirm curl docker git bash base-devel elif [ "$ID" = "fedora" ]; then - dnf install -y curl docker git bash gcc make openssl-devel bzip2-devel libffi-devel zlib-devel xz-devel tk-devel gdbm-devel readline-devel sqlite-devel python3-libdnf5 + dnf install -y curl docker git bash gcc make patch p7zip p7zip-plugins openssl-devel bzip2-devel libffi-devel zlib-devel xz-devel tk-devel gdbm-devel readline-devel sqlite-devel python3-libdnf5 elif [ "$ID" = "gentoo" ]; then echo "media-libs/libglvnd X" >> /etc/portage/package.use/libglvnd emerge-webrsync diff --git a/bbot/core/helpers/misc.py b/bbot/core/helpers/misc.py index 216fa3a685..ad96cdb374 100644 --- a/bbot/core/helpers/misc.py +++ b/bbot/core/helpers/misc.py @@ -1333,7 +1333,11 @@ def which(*executables, path=None): for e in executables: location = shutil.which(e, path=path) if location: - return location + # Resolve directory symlinks but preserve the binary name. + # This fixes native 7zip on Fedora where /usr/sbin -> bin symlink + # causes codec loading to fail when invoked as /usr/sbin/7z. + resolved_dir = os.path.realpath(os.path.dirname(location)) + return os.path.join(resolved_dir, os.path.basename(location)) def search_dict_by_key(key, d): diff --git a/bbot/modules/internal/unarchive.py b/bbot/modules/internal/unarchive.py index 80dacc2f28..3cba8ef9ab 100644 --- a/bbot/modules/internal/unarchive.py +++ b/bbot/modules/internal/unarchive.py @@ -17,12 +17,12 @@ class unarchive(BaseInternalModule): async def setup(self): self.ignore_compressions = ["application/java-archive", "application/vnd.android.package-archive"] self.compression_methods = { - "zip": ["7z", "x", '-p""', "-aoa", "{filename}", "-o{extract_dir}/"], + "zip": ["7z", "x", "-aoa", "{filename}", "-o{extract_dir}/"], "bzip2": ["tar", "--overwrite", "-xvjf", "{filename}", "-C", "{extract_dir}/"], "xz": ["tar", "--overwrite", "-xvJf", "{filename}", "-C", "{extract_dir}/"], - "7z": ["7z", "x", '-p""', "-aoa", "{filename}", "-o{extract_dir}/"], - # "rar": ["7z", "x", '-p""', "-aoa", "{filename}", "-o{extract_dir}/"], - # "lzma": ["7z", "x", '-p""', "-aoa", "{filename}", "-o{extract_dir}/"], + "7z": ["7z", "x", "-aoa", "{filename}", "-o{extract_dir}/"], + # "rar": ["7z", "x", "-aoa", "{filename}", "-o{extract_dir}/"], + # "lzma": ["7z", "x", "-aoa", "{filename}", "-o{extract_dir}/"], "tar": ["tar", "--overwrite", "-xvf", "{filename}", "-C", "{extract_dir}/"], "gzip": ["tar", "--overwrite", "-xvzf", "{filename}", "-C", "{extract_dir}/"], } diff --git a/bbot/test/test_step_2/module_tests/test_module_unarchive.py b/bbot/test/test_step_2/module_tests/test_module_unarchive.py index 5a742ef969..84b53b7e72 100644 --- a/bbot/test/test_step_2/module_tests/test_module_unarchive.py +++ b/bbot/test/test_step_2/module_tests/test_module_unarchive.py @@ -33,11 +33,11 @@ async def setup_after_prep(self, module_test): tar_file = temp_path / "test.tar" tgz_file = temp_path / "test.tgz" commands = [ - ("7z", "a", '-p""', "-aoa", f"{zip_file}", f"{text_file}"), - ("7z", "a", '-p""', "-aoa", f"{zip_zip_file}", f"{zip_file}"), + ("7z", "a", "-aoa", f"{zip_file}", f"{text_file}"), + ("7z", "a", "-aoa", f"{zip_zip_file}", f"{zip_file}"), ("tar", "-C", f"{temp_path}", "-cvjf", f"{bz2_file}", f"{text_file.name}"), ("tar", "-C", f"{temp_path}", "-cvJf", f"{xz_file}", f"{text_file.name}"), - ("7z", "a", '-p""', "-aoa", f"{zip7_file}", f"{text_file}"), + ("7z", "a", "-aoa", f"{zip7_file}", f"{text_file}"), # ("tar", "-C", f"{temp_path}", "--lzma", "-cvf", f"{lzma_file}", f"{text_file.name}"), ("tar", "-C", f"{temp_path}", "-cvf", f"{tar_file}", f"{text_file.name}"), ("tar", "-C", f"{temp_path}", "-cvzf", f"{tgz_file}", f"{text_file.name}"),