Commit 19ae55a
authored
When `/bin` is a symlink to `/usr/bin` (common on modern Linux distros),
`find_cached()` canonicalizes `/bin` → `/usr/bin` and only caches
entries under `/usr/bin`. A subsequent `try_from` call with
`/bin/python3` fails the direct cache lookup and returns `None`, causing
the environment to be reported as `Unknown`.
**Fix:** In `try_from`, after a cache miss, canonicalize the executable
path and retry the lookup. When found via the canonical path, add the
original path as a symlink and update both cache entries for
consistency.
- Canonicalize executable once, use for both path guard and cache
fallback
- Path guard accepts executables whose canonical path resolves to a
known bin dir
- Cache fallback adds the original path as a symlink for complete
metadata
- Both canonical and original cache entries updated to keep symlink
lists consistent
Fixes #405
1 parent 05d75c6 commit 19ae55a
1 file changed
+39
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
95 | 100 | | |
96 | 101 | | |
97 | 102 | | |
98 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
99 | 132 | | |
100 | 133 | | |
101 | 134 | | |
| |||
0 commit comments