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
When running cloc directly on a source RPM file (.src.rpm), it reports zero code lines detected. The .src.rpm contains a nested .tar.gz archive with C++ sources, but cloc does not recursively extract the inner archive — it only processes the top-level files (cppzmq.spec, cppzmq-4.10.0.tar.gz), leaving the C++ code inside the tarball uncounted.
After manual extraction (rpm2cpio | cpio | tar), the same files are correctly counted by cloc.
cloc; OS; OS version
cloc version: 2.00
OS: Alpine Linux
OS version: 3.20 (aarch64)
Reproducible via podman or docker
To Reproduce
Start an Alpine container:
podman run --rm -it alpine:3.20 /bin/sh
Install dependencies:
apk add --no-cache cloc gzip rpm2cpio cpio tar wget
Download a Fedora source RPM (cppzmq — a pure C++ library):
When running cloc cppzmq.src.rpm, the language table should match the extracted content — showing C++ (~2832 lines) and C/C++ Header (~2883 lines). Instead, cloc silently returns success with no languages counted.
Key observation: find_preprocessor() returns cppzmq-4.10.0.tar.gz and cppzmq.spec, but cloc never recurses into the .tar.gz — it only classifies cppzmq.spec (as unknown) and writes null results.
Describe the bug
When running
clocdirectly on a source RPM file (.src.rpm), it reports zero code lines detected. The.src.rpmcontains a nested.tar.gzarchive with C++ sources, but cloc does not recursively extract the inner archive — it only processes the top-level files (cppzmq.spec,cppzmq-4.10.0.tar.gz), leaving the C++ code inside the tarball uncounted.After manual extraction (
rpm2cpio | cpio | tar), the same files are correctly counted by cloc.cloc; OS; OS version
podmanordockerTo Reproduce
Start an Alpine container:
Install dependencies:
Download a Fedora source RPM (cppzmq — a pure C++ library):
wget -q \ "https://dl.fedoraproject.org/pub/fedora/linux/releases/44/Everything/source/tree/Packages/c/cppzmq-4.10.0-12.fc44.src.rpm" \ -O cppzmq.src.rpmRun cloc directly on the
.src.rpmfile:Observe the result — only 1 text file counted, C++ inside the nested
.tar.gzis ignored:The
.src.rpmcontainscppzmq.spec(the 1 text file) andcppzmq-4.10.0.tar.gz(ignored — cloc does not recursively extract it).Now extract manually and run cloc again:
Observe the correct result:
Expected result
When running
cloc cppzmq.src.rpm, the language table should match the extracted content — showing C++ (~2832 lines) and C/C++ Header (~2883 lines). Instead, cloc silently returns success with no languages counted.Actual result
Only
cppzmq.specis counted;cppzmq-4.10.0.tar.gz(containing all the C++ source) is silently skipped.Minimal reproducible Dockerfile
Additional context
.src.rpmcontains:cppzmq-4.10.0.tar.gz+cppzmq.spec.src.rpm(exit code 0, rpm2cpio runs)cppzmq-4.10.0.tar.gz) inside the RPM is not recursively processed.tar.gzinside.deb; closed in 2017 without a fix)-v 3verbose trace forcloc cppzmq.src.rpmKey observation:
find_preprocessor()returnscppzmq-4.10.0.tar.gzandcppzmq.spec, but cloc never recurses into the.tar.gz— it only classifiescppzmq.spec(asunknown) and writes null results.