Summary
lib/bash/file/lib_file.sh reimplements the same "walk lines, track in_section, match START_M/END_M" awk logic in near-identical inline blocks in up to five places.
Details
:143-172 (__base_bash_libs_file_section_markers_ordered__)
:276-298 (base_file_section_needs_update)
:438-453 (inside base_file_update_file_section)
:486-506 (removal variant)
:522-548 (replace variant)
base_file_section_needs_update already duplicates its own extraction logic almost verbatim against base_file_update_file_section.
Impact
A future correctness fix (e.g. CRLF handling, marker-matching edge cases) has to be applied in up to five places, and is easy to miss in one of them.
Suggested fix
Factor the shared awk program(s) into one or two parameterized helpers (e.g. a mode=extract|check|remove|replace argument) instead of five inline copies.
Summary
lib/bash/file/lib_file.shreimplements the same "walk lines, track in_section, match START_M/END_M" awk logic in near-identical inline blocks in up to five places.Details
:143-172(__base_bash_libs_file_section_markers_ordered__):276-298(base_file_section_needs_update):438-453(insidebase_file_update_file_section):486-506(removal variant):522-548(replace variant)base_file_section_needs_updatealready duplicates its own extraction logic almost verbatim againstbase_file_update_file_section.Impact
A future correctness fix (e.g. CRLF handling, marker-matching edge cases) has to be applied in up to five places, and is easy to miss in one of them.
Suggested fix
Factor the shared awk program(s) into one or two parameterized helpers (e.g. a
mode=extract|check|remove|replaceargument) instead of five inline copies.