Package: grep Version: 3.1-2 Severity: normal The version of grep in Debian carries a patch to dlopen libpcre.so.3. However, it is also directly linked to libpcre.so.3 (objdump -Tx /bin/grep shows "NEEDED libpcre.so.3"), and will not execute without it. This also generates a hard dependency (in fact a Pre-Depends, because grep is Essential: yes).
If the intention was to make grep -P opportunistically use libpcre.so.3 if present, but not use it if absent (like the way libopenal1 has a weak dependency on libasound2, libpulse0 and libportaudio2), then it should not be linked with -lpcre, only with -ldl. This will need some sort of patch to its build system. Alternatively, if grep -P is considered to be part of the Essential functionality of grep, then the dlopen patch can be dropped and it can just use libpcre like a normal library (the same as pcregrep). Please choose one or the other: the current situation is the worst of both worlds (you have the maintenance headache of the patch, but you still have the dependency). The changelog entry for 2.25-6 suggests that a weak dependency is what was intended. If so, then it should be possible for the upstream-test-suite-no-pcre3 autopkgtest to be reinstated and pass without libpcre3 installed. It would probably be also good to have an autopkgtest that runs "objdump -Tx /bin/grep | grep NEEDED" and asserts that libpcre is not in the output. smcv