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 a filing contains a form type with a / character (e.g. SC/10), libfec fastfec crashes with "No such file or directory (os error 2)". The form type is used directly as a filename (SC/10.csv), which the OS interprets as a path with directory SC/ and file 10.csv. Since the SC/ directory doesn't exist, File::create_new fails.
FastFEC handles this correctly by replacing / with - in filenames (producing SC-10.csv).
Root Cause
fastfec.rs:96:
let f = File::create_new(filing_directory.join(format!("{}.csv", r.row_type)))?;
r.row_type is used unsanitized as a filename component. FEC form types like SC/10, SC/9, SC/10-A contain slashes that are path separators on Unix.
Affected Filing
Filing ID: 1937483 (3KB, F3N filing for LOGAN CUNNINGHAM FOR CONGRESS)
Reproduction
# libfec crashes:
libfec fastfec ~/.cache/libfec/cache/1937483.fec /tmp/out_libfec
# error: No such file or directory (os error 2)# FastFEC succeeds:
fastfec --no-stdin ~/.cache/libfec/cache/1937483.fec /tmp/out_fastfec
# Done; parsing successful!
Observe the Difference
# libfec creates these files (missing SC/10):
ls /tmp/out_libfec/1937483/
# F3N.csv SA11AI.csv SA11D.csv SA13A.csv SB17.csv header.csv# FastFEC creates these files (includes SC-10):
ls /tmp/out_fastfec/1937483/
# F3N.csv SA11AI.csv SA11D.csv SA13A.csv SB17.csv SC-10.csv header.csv# Diff the file lists:
diff <(ls /tmp/out_libfec/1937483/)<(ls /tmp/out_fastfec/1937483/)# > SC-10.csv
Suggested Fix
Sanitize r.row_type before using as a filename, replacing / with - to match FastFEC behavior.
Note
Much of this ticket was composed with Claude
When a filing contains a form type with a
/character (e.g.SC/10),libfec fastfeccrashes with "No such file or directory (os error 2)". The form type is used directly as a filename (SC/10.csv), which the OS interprets as a path with directorySC/and file10.csv. Since theSC/directory doesn't exist,File::create_newfails.FastFEC handles this correctly by replacing
/with-in filenames (producingSC-10.csv).Root Cause
fastfec.rs:96:r.row_typeis used unsanitized as a filename component. FEC form types likeSC/10,SC/9,SC/10-Acontain slashes that are path separators on Unix.Affected Filing
Filing ID: 1937483 (3KB, F3N filing for LOGAN CUNNINGHAM FOR CONGRESS)
Reproduction
Observe the Difference
Suggested Fix
Sanitize
r.row_typebefore using as a filename, replacing/with-to match FastFEC behavior.