You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(foundation): the pypcap engine raises a pcap loader's OSError instead of falling back as pcap_ct does #2132
pcapkit.extract(engine='pypcap') raises the loader's OSError when a pcap module is installed but cannot load. That happens, for example, with pcap-ct on macOS (dlopen(libc.so.6 …)), on Windows without Npcap (Cannot find npcap/wpcap.dll), or on Linux without libpcap.so. The same situation with engine='pcap_ct' warns and falls back to the default engine.
Cause:PyPCAP._reason_for in pcapkit/foundation/engines/pypcap.py only returns _pcap_backend.wrong_backend_reason(...). PCAP_CT._reason_for also reports a probe whose module is installed but unusable (found.name is None and not found.missing), with the OSError as the reason.
Reproduced in the #2131 review with a fake pcap package whose import raises OSError('Cannot find libpcap.so library'), put on sys.path in a subprocess:
engine='pcap_ct' warns and falls back.
engine='pypcap' raises OSError.
Found while root-causing #2129, whose benchmark-side workaround is #2131.
Fix: give PyPCAP._reason_for the same installed-but-unusable branch, or move that branch into a helper in _pcap_backend that both engines call. Add a test with a fake pcap package that fails without the fix.
Activity
fix(foundation): let the pypcap engine fall back when the pcap module…
fix(foundation): let the pypcap engine fall back when the pcap module…