install copies the binary to $(BINDIR), defaulting to /usr/local/bin.
PREFIX, BINDIR and INSTALL are overridable, and DESTDIR is honoured so a
packager can stage into a temporary root; it is deliberately left
undefaulted rather than set to empty.
uninstall removes what install placed, and is idempotent.
Both use install(1) rather than cp, so the mode is set explicitly and the
target directory is created in the same step. The flags used, -d and -m,
are common to GNU and BSD install, which SPEC.md section 19 asks for.
Verified: staged install under DESTDIR, PREFIX and BINDIR overrides,
uninstall in both plain and staged form, uninstall with nothing to
remove, and install from a clean tree rebuilding first.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018KyCHPAxWzqa3vHKdXJkgx
Nine files had drifted into four different combinations: _GNU_SOURCE in
walk.c, _XOPEN_SOURCE 700 in utility.c, _DEFAULT_SOURCE in scan.c,
_POSIX_C_SOURCE 200809L in list.c and diff.c, and all three at once in
create.c and types.c, where _XOPEN_SOURCE 700 already implies POSIX 2008.
_GNU_SOURCE was also wider than anything the code asks for: walk needs
dirent.d_type, which _DEFAULT_SOURCE provides. Closing that gap is what
SPEC.md section 19 asks for and what the README flags as the one thing
keeping the tree from being POSIX-only.
CPPFLAGS now carries -D_POSIX_C_SOURCE=200809L -D_DEFAULT_SOURCE, and the
sources declare nothing. Confirmed DT_UNKNOWN is still visible under that
pair, so the d_type fast path stays active rather than silently falling
back to lstat.
Verified against the previous build: byte-identical scan output over
/usr/include, /usr/share/doc and /etc (17820 entries), and byte-identical
snapshots from create.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018KyCHPAxWzqa3vHKdXJkgx
Without optimisation GCC skips the flow analysis most of these warnings
are derived from, so -O2 is what makes the existing -W flags do their job.
The new flags found three real defects:
-Wstrict-prototypes/-Wold-style-definition: init_crc32_table() and
RecordObjectNew() were declared with (), which in C11 means "no
prototype", not "no arguments". RecordObjectNew even contradicted its
own header, which declares (void).
-Wwrite-strings: walk's blacklist held string literals in a
non-const char *[], so they were writable through the array.
Also make ignore_file size its loop with sizeof(blacklist[0]) instead of
repeating the element type, and drop the order-only build/ prerequisite
on the link rule, which the %.o rule's mkdir -p already covers.
The tree builds clean under all twelve flags.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018KyCHPAxWzqa3vHKdXJkgx
Add fsnap diff <old> <new> that compares two snapshots and reports
added (A), deleted (D), metadata changed (M), permissions changed (P),
and symlink target changed (L) records.
Both snapshots are loaded into memory, sorted by path using qsort,
and merged with a two-pointer algorithm. Residual records after the
merge are emitted as A or D. Escape sequences in paths are decoded
on output.
Also add GetTime accessor, set errno on load_in_memory failures
for meaningful error messages, and fix unused-variable warnings.
Hash the followed target content with CRC-32 (hash.c/hash.h) and emit a FINGERPRINT field for non-directory records in create.c. Schema: TYPE|MODE|UID|GID|MTIME|SIZE|FINGERPRINT|TARGET per SPEC §17/§18.
Splits RecordObject, unpack, release, field and field_name out of list.c into types.c/types.h; declares field extern in the header with a single definition in types.c; adds src/types.c to SOURCES.