Bug 2478240

Summary: 7zip: `/bin/7z` fails to load codecs when `/bin` is a symlink to `/usr/bin`
Product: [Fedora] Fedora Reporter: Byoungchan Lee <byoungchan.lee>
Component: 7zipAssignee: Michel Lind <michel>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: 44CC: davide, michel
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 7zip-26.01-1.el10_3 7zip-26.01-1.el10_2 7zip-26.01-1.fc44 7zip-26.01-1.fc43 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2026-06-16 00:26:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Byoungchan Lee 2026-05-17 06:49:06 UTC
On Fedora 44, invoking 7-Zip as `/bin/7z` fails to load the external
codec/plugin library and reports unsupported archive formats. Invoking
the same installed binary as `/usr/bin/7z` works.

This breaks build systems that discover or cache `7z` as `/bin/7z`
and later use that path to create ZIP archives.

Package version:

```text
7zip-25.01-5.fc44
```

Reproducible: Always

Steps to Reproduce:
1. On a Fedora 44 system where `/bin` is a symlink to `/usr/bin`,
   install `7zip-25.01-5.fc44`.
2. Run:

   ```bash
   /bin/7z i
   ```

3. Try to create a ZIP archive through `/bin/7z`:

   ```bash
   /bin/7z a -tzip /tmp/7zip-test.zip README.md
   ```

4. Compare with the `/usr/bin/7z` invocation:

   ```bash
   /usr/bin/7z i
   ```
Actual Results:
`/bin/7z i` fails to load the codec library:

```text
Codec Load Error: /bin/7z.so
```

ZIP creation through `/bin/7z` fails:

```text
ERROR:
Unsupported archive type
```

The same installed binary works when invoked as `/usr/bin/7z`.

Expected Results:
`/bin/7z` and `/usr/bin/7z` should behave identically when `/bin` is a
symlink to `/usr/bin` and both paths refer to the same executable.

Both invocations should load:

```text
/usr/libexec/7zip/7z.so
```

ZIP archive creation through `/bin/7z` should work.

Additional Information:
The installed filesystem has Fedora's merged-/usr layout:

```text
/bin -> usr/bin
```

`/bin/7z` and `/usr/bin/7z` resolve to the same file:

```text
6469925 /bin/7z
6469925 /usr/bin/7z
```

They also have the same ELF build ID:

```text
BuildID[sha1]=8da5e54ad58094c35a07916c81e1ec63d7182782
```

The difference follows `argv[0]`, not the executed inode:

```bash
bash -c 'exec -a /bin/7z /usr/bin/7z i'
bash -c 'exec -a /usr/bin/7z /bin/7z i'
```

Observed behavior:

- `argv[0]=/bin/7z` fails, even when executing `/usr/bin/7z`.
- `argv[0]=/usr/bin/7z` succeeds, even when executing `/bin/7z`.

Fedora's package carries `7zip-find-so-in-libexec.diff`, which
redirects the external plugin lookup to:

```text
/usr/libexec/7zip/7z.so
```

That downstream patch appears to handle the normal installed path under
`/usr/bin`, but not the merged-/usr alias under `/bin`.

Because 7-Zip derives its module directory from the literal executable
prefix before canonicalizing the path, invoking the binary as `/bin/7z`
bypasses Fedora's libexec redirection and causes 7-Zip to search for:

```text
/bin/7z.so
```

instead of:

```text
/usr/libexec/7zip/7z.so
```

Possible fixes:

- Treat `/bin/` the same as Fedora's installed binary directory under
  `/usr/bin/` in `7zip-find-so-in-libexec.diff`.

Comment 1 Fedora Update System 2026-06-15 18:26:00 UTC
FEDORA-2026-4be7569210 (7zip-26.01-1.fc44) has been submitted as an update to Fedora 44.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-4be7569210

Comment 2 Fedora Update System 2026-06-15 18:26:26 UTC
FEDORA-2026-f36864b408 (7zip-26.01-1.fc43) has been submitted as an update to Fedora 43.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-f36864b408

Comment 3 Fedora Update System 2026-06-15 18:41:35 UTC
FEDORA-EPEL-2026-8d909527ba (7zip-26.01-1.el10_2) has been submitted as an update to Fedora EPEL 10.2.
https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2026-8d909527ba

Comment 4 Fedora Update System 2026-06-15 18:41:35 UTC
FEDORA-EPEL-2026-52d18d8d5a (7zip-26.01-1.el10_3) has been submitted as an update to Fedora EPEL 10.3.
https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2026-52d18d8d5a

Comment 5 Fedora Update System 2026-06-16 00:26:41 UTC
FEDORA-EPEL-2026-52d18d8d5a (7zip-26.01-1.el10_3) has been pushed to the Fedora EPEL 10.3 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 6 Fedora Update System 2026-06-16 00:40:48 UTC
FEDORA-EPEL-2026-8d909527ba (7zip-26.01-1.el10_2) has been pushed to the Fedora EPEL 10.2 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 7 Fedora Update System 2026-06-16 01:02:57 UTC
FEDORA-2026-4be7569210 (7zip-26.01-1.fc44) has been pushed to the Fedora 44 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 8 Fedora Update System 2026-06-16 01:11:17 UTC
FEDORA-2026-f36864b408 (7zip-26.01-1.fc43) has been pushed to the Fedora 43 stable repository.
If problem still persists, please make note of it in this bug report.