Revision history for App-FileSync

0.003.0	Sun Nov 29 09:16:35 AM EST 2026
	[ Security ]
	- Text from another machine (a file name, or a path a hostile
	  client sent that the server journalled) was printed with its terminal
	  escape sequences intact, so "filesync-admin log" or a sync report
	  could retitle the window, clear the screen or rewrite earlier lines.
	  Control characters, C1 controls and bidirectional overrides are now
	  shown as \x{..} escapes (the new App::FileSync::printable).

	[ Bug Fixes ]
	- A file saved locally while a sync was running could be lost: a pull
	  planned from the scan replaced it with the master's copy, and a
	  planned local delete moved an edited file to the trash.  The sync now
	  stops when a path changed after the scan, and the next run plans the
	  change (as a conflict if the master changed too).
	- The server took requests out of order.  A done straight after the
	  hello ended the session as a success and saved an empty base for the
	  client, so its next sync took every file for new; a second plan, or a
	  manifest after the plan, was accepted; the first message was not
	  checked to be a hello; chunk and chunk_end were accepted inside a
	  delta upload; and a planned path could be changed twice in one
	  session (a second ack journalled its conflict twice).  Each is now
	  refused, ending the session.  The real client never sent these.
	- A directory the client could not read looked deleted, so the sync
	  deleted its files from the server and every other client.  The
	  sync now stops before changing anything and names the directory.
	- A max_delete_percent of NaN switched the mass-deletion guard off;
	  numeric arguments of NaN are now refused.
	- On a Perl with 32-bit integers (such as armv6l), every block delta
	  silently became a whole-file transfer: the weak checksum of any block
	  over 64 KiB was wrong, so no block ever matched.  The sums are now
	  kept small enough to stay exact there too.
	  Fixes https://matrix.perl-magpie.org/results/eb93a13a-e42c-11f1-92d0-b3d4df82f922
	- Reading a file that turned out to be a directory gave an empty text
	  instead of an error on Perl before 5.38, whose close does not report
	  the failed read.  It is now io.read everywhere.
	- A pulled file that could not be installed (its old version could not
	  be removed) left its temporary file in the sync root.
	- A path or conflict-copy name given as a character string was measured
	  in characters, not bytes, so a name of emoji could pass the 255-byte
	  component limit or make a conflict copy too long to create.
	- --since and --until read a year below 1000 as a rolling century
	  ("0050-01-01" meant 2050) and accepted dates before 1970.  Both are
	  now refused.  Requires Time::Local 1.27.
	- A protocol line was only checked against its size limit between
	  reads, so one that ended inside the last read could be up to 64 KiB
	  over it.
	- A file written to while the scan was hashing it was described with
	  its old size and its new hash, an entry no upload could match, so the
	  sync failed on that file until the writer stopped.  It is now left
	  for the next run ("changed while being read"), neither pushed nor
	  taken for a deletion.
	- An ignore pattern with blanks before its "!" ("  !keep.log") was
	  taken as a pattern for a file named "!keep.log", not a negation.
	- When installing an upload failed after its hash was checked, the
	  temporary file stayed in the master until the hourly stale-file sweep.
	- Replacing a file that another process removed at the same moment
	  failed with "No such file or directory".
	- An ignore pattern with many stars, such as "*a*a*a*a*a*a*a*a*c",
	  could take minutes to test against one path, stalling every client the
	  repo config reached.  Matching is now linear, with the same results.
	- An error text holding a long run of tabs (which a server can send)
	  took minutes to clean up for display.
	- Dates, epochs, ports and lengths written in other scripts' digits
	  (such as Arabic-Indic) were accepted and read as 0; only 0-9 count
	  now.  An epoch of more than 15 digits, which cannot be held exactly,
	  is refused instead of becoming Inf.
	- A conflict copy of a long UTF-8 name could be cut part-way through a
	  character, giving a name macOS refuses.
	- Reading a directory as a file (a configuration path that is a
	  directory, say) gave an internal Perl message; it is now "Cannot
	  read PATH: Is a directory".
	- Calling a public routine with an odd number of arguments gave an
	  internal "Usage: Params::Get->..." message.
	- The internal open_file helper ran its path as a shell command when
	  given a pipe mode; no caller did that, and it now refuses.
	- Opening a file with an invalid mode could report whatever earlier
	  error was left over ("No such file or directory" on Perl 5.42)
	  instead of the real reason.
	- On Windows, a program that does not exist (such as a mistyped ssh
	  path) was started through cmd.exe, which only complained on stderr;
	  it is now the documented "Cannot start" error.
	- "filesync snapshot --keep 0" was refused ("--keep must be positive")
	  though it is documented to keep every snapshot; it now does.
	- A delta push the server refused part-way (a dcopy) hung the sync:
	  the server waited for data the client never sends, and the client
	  waited for the refusal.  The refusal now comes back at once.
	- An ssh killed by a signal was reported as a clean exit.
	- A client configuration without a client_id failed with "Local
	  transport: no client given"; it now says "No client_id in the
	  client configuration".
	- When ssh could not create the temporary file for its error output,
	  the error named a Perl file and line; it is now an ordinary
	  "Cannot write" error.
	- Many routines cleared the caller's $@ (an error being reported)
	  when an eval inside them succeeded; they now leave it alone.
	- A sync that deleted a directory failed with "Cannot move ... Invalid
	  cross-device link" when the repo and its trash were on different
	  filesystems, on that run and every later one.  Files were already
	  copied across, but a directory could only be renamed.  A directory
	  is now copied into the trash, keeping its modes, times and symlinks,
	  and then removed.  If the copy fails, the partial copy is removed and
	  the original is left in place.
	- "filesync sync NAME" (without --repo) synced every repo; sync,
	  status, init and the admin commands repo list, repo show and client
	  allow/list/forget now refuse arguments they do not take, as the other
	  commands already did.  "client forget --repo R A B" used to forget
	  only A.
	- A symlinked directory in a client's tree could be written through:
	  a file another client created under that name was pulled to wherever
	  the link pointed.  Such a path is now refused.  "filesync-admin
	  restore" had the same hole in the master and now refuses it too.
	- The server followed a symlink in the master when sending a file, and
	  did not check the mtime and mode of an upload (only the manifest's).
	  Both are now refused.
	- A directory the scan could not read was recorded as an empty
	  directory; it is now only reported as skipped.  The reason no longer
	  carries a Perl file and line.
	- Files of 4 GiB and more got delta blocks over 1 MiB, which the server
	  refuses, so every delta pull of them failed.  Signatures now stop at
	  the 4 GiB reach of a copy record, and a malformed block length from
	  a peer is refused.
	- A small compressed frame could make the reader inflate gigabytes
	  before its size was checked; the limit now applies while inflating.
	- An impossible date (--since 2026-02-30) leaked Time::Local's message
	  and location; it is now "Bad --since ...".  A trash directory named
	  like one no longer stops trash pruning, and a trash bucket that
	  could not be removed is no longer reported as removed.
	- A conflict copy of a file with a very long extension got a name too
	  long to create.
	- Setting a file's time could fail silently (the sync then believed
	  the time was set).
	- A hostile repo name is refused by the server's config loader and the
	  trash refuses a path that would leave it, as everywhere else.
	- A settings file given by bare name (no directory) looked for
	  universal.json in / instead of beside it.
	- Setuid and setgid bits are no longer synced, so a client cannot push
	  a set-id program to the others.  Other permissions and the sticky
	  bit still are.
	- The server requires the size and hash of every upload; without them
	  an upload had no size limit and nothing checked what arrived.
	- A control message is limited to 256 MiB (a plan of some 2.5 million
	  files), so a peer that never sends a newline cannot exhaust memory.
	  Reading a long message no longer rescans it after every read.
	- A message holding a character outside Latin-1 printed "Wide
	  character" and went out as UTF-8, changing any Latin-1 byte in the
	  same message.  Such characters are now sent as \u escapes.
	- On some Perls (5.40 in CI) an error from a failed open still ended
	  with "at (eval N)[.../Fatal.pm:L] line M."; that location is now
	  removed like any other.
	- On a Windows server, an error quoting the server root as configured
	  ("/srv/filesync" rather than "\srv\filesync") reached the client
	  with the root in it; both spellings are now replaced.

	[ Build ]
	- The minimum Perl is now 5.26, which Params::Validate::Strict,
	  Log::Abstraction and Object::Configure already required.  The 5.14
	  the metadata claimed was never possible: App::FileSync itself uses
	  __SUB__, which needs 5.16.
	- Errno and parent are declared as runtime prerequisites, and every
	  module the tests load is declared, most with the minimum version the
	  tests rely on.

	[ Testing ]
	- Added white-box testing
	- Added black-box unit tests of every public routine (t/unit.t)
	- Added destructive, boundary and security tests (t/edge_cases.t)
	- Added data-flow tests: define-use chains, handle and temp-file
	  lifecycles, permission lockouts mid-operation, races (t/data-flow.t)
	- Added domain tests: equivalence partitions and boundary values of
	  every documented input, including multibyte text (t/domain.t)
	- Added logic tests: the merge decision table, conflict resolution,
	  delete limits, the server's per-action permissions and ignore
	  precedence, each proven over every combination of inputs (t/logic.t)
	- Added path tests for every branch the suite did not reach (t/path.t),
	  and removed two that no input can reach: the "no child" guard in
	  both transports' close()
	- Added simulated penetration tests of the remote-input boundaries:
	  forced commands, paths, ids, terminal output, CR/LF, a CGI-style
	  environment (t/cgi_security.t)
	- Added transaction-flow tests: a file's whole lifecycle, failures
	  between and inside actions, repeated runs, two syncs at once, and
	  files changed between the scan and the step that acts on them
	  (t/transaction.t)
	- Added state transition tests of the server session, against the new
	  STATE DIAGRAM in App::FileSync::Server's POD (t/transition.t)

0.002.2	Wed Nov 18 09:33:20 PM EST 2026
	[ Bug Fixes ]
	- When the server refused a request that carries data (a delta
	  signature, an upload chunk), it closed the connection without reading
	  that data, so the client could fail with "Broken pipe" instead of
	  showing the reason.  This happened mostly on Windows.  The server now
	  reads the data before it replies.
	- A server repo created with "--trash-days 0" pruned its trash after
	  30 days, while a client's "local_trash_days": 0 kept its trash
	  forever.  0 now means "keep forever" on both sides, and the
	  documentation says so.  "filesync-admin repo show" prints
	  "kept forever" for such a repo instead of "0 days".
	- "filesync-admin repo show" printed "0 files / 0%" for a repo whose
	  deletion limits are switched off, which read as "nothing may be
	  deleted".  It now says "no file limit", "no percentage limit", or
	  "none (any number of deletions)" when both are off.
	- "filesync-admin repo create --max-delete-percent" accepted values
	  over 100.  It now refuses anything above 100, and so does the
	  deletion check when a policy file holds such a value.
	- A bad argument was reported in Params::Validate::Strict's own
	  English, naming the internal parameter: "Admin::repo_create:
	  Parameter 'trash_days' (-1) must be at least 0".  It is now a
	  catalogued message, and the programs name the option that was
	  typed: "--trash-days must be at least 0, not -1".
	- A directory that became a file could not be synced if it still
	  held an ignored file (a .DS_Store, say): the sync failed with
	  "Cannot replace non-empty directory", then and on every later run.
	  The directory, with whatever the sync does not track, now goes to
	  the trash (the server's or the client's local one) and the file
	  takes its place.  The server journals it; the client logs a
	  warning naming the trash.
	- An error the server sent a client named where the server keeps its
	  files ("Cannot create a temporary file in
	  /srv/filesync/master/docs/sub").  A path in the master is now given
	  relative to the repo ("in sub"), and any other server path starts
	  with "[server root]".  The server's log is written the same way,
	  since over ssh its standard error reaches the client; the journal
	  keeps the full paths.
	- The server accepted a "mkdir" request for a path whose planned
	  action was a conflict the client's file had won, which no client
	  sends: a client wins a conflict only with a file, and uploads it.
	  Such a request is now refused like any other outside the plan.

	[ Documentation ]
	- "filesync-admin help", the repo_create POD and the website now
	  describe the repo create options, and say that a --max-deletes or
	  --max-delete-percent of 0 switches that deletion limit off.
	- The deletion limits are documented as they behave: both are
	  inclusive (a sync may delete exactly --max-deletes files), and the
	  percentage limit rounds down but always allows one file.
	- filesync-server documents its exit status: 0 after a finished
	  session, 1 after any other.

	[ Build ]
	- META.json says dynamic_config 1, since Win32API::File is required
	  only on Windows; it said 0, so an installer could skip Makefile.PL
	  and miss it.
	- A regression test that builds a 20 MB file runs only with
	  EXTENDED_TESTING set (or on GitHub Actions), so it does not burden
	  CPAN smokers.

0.002.1	Sun Nov 15 03:36:05 PM EST 2026
	[ Enhancements ]
	- Block deltas are much faster to compute.  A changed file of 8 MiB or
	  more with no blocks in common took about 45 seconds to diff; it now
	  takes about 3.  Signatures (the receiver's description of its copy)
	  are computed about twice as fast.  The wire format is unchanged, so
	  old and new clients and servers still work together.
	- JSON now goes through JSON::MaybeXS (a new dependency), which
	  installs and uses Cpanel::JSON::XS wherever there is a compiler.
	  Reading a 100,000-file manifest took about 15 seconds with JSON::PP
	  and takes under half a second with Cpanel::JSON::XS.  Pure-Perl
	  installs still work, on JSON::PP, and either side of a sync may use
	  either backend.
	- Paths read back from JSON as hash keys (manifests are keyed by
	  path) kept Perl's UTF-8 flag, so a file test on a non-ASCII name
	  looked for a differently encoded file.  "verify" silently left such
	  files out of its random sample.  Keys are now byte strings, like
	  values.
	[ Bug Fixes ]
	- On Windows, a client whose session ended early (any error mid-sync)
	  hung for ever instead of reporting the error: the server or ssh it
	  started inherited the client's end of its own input pipe, so it never
	  saw end of file, and the client waited for it to exit.  The client's
	  pipe ends are no longer inheritable, and a server or ssh that has not
	  exited 30 seconds after the session ends is stopped.  The Windows test
	  runs had hung in t/regressions.t since 0.001.1.
	- "filesync settings" on Windows named an environment variable in the
	  spelling it was looked up with (App__FileSync__ssh_identity) rather
	  than the one the environment holds (APP__FILESYNC__SSH_IDENTITY):
	  Windows' %ENV lookups ignore case, so the exact-match test always
	  succeeded.

0.002.0	Wed Nov  4 09:44:06 PM EST 2026
	[ Enhancements ]
	- Created a website
	- "filesync sync --quiet" prints nothing for a repo where nothing
	  happened, instead of an all-zero summary and transfer line, so a
	  cron job that finds nothing to do stays silent.
	[ Bug Fixes ]
	- t/locales.t failed its three system-locale subtests on Windows: it
	  passed a multi-line child program to "perl -e", which Windows cut at
	  the first newline, and imported LC_MESSAGES, which Windows' POSIX
	  lacks.  The child is now a script file and falls back to LC_CTYPE.

0.001.5	Sun Oct 25 12:53:45 PM EDT 2026
	[ Bug Fixes ]
	- Log::Abstraction 0.36 is now required, because the client logs its
	  run summary as structured fields in a trailing hashref.  An older
	  copy, which the installer accepted, turned that into
	  "sync finishedHASH(0x...)" in the log file and an empty entry in an
	  array logger, so the counts were lost and t/settings.t failed its
	  seven logger assertions.

0.001.4	Sun Oct 25 09:31:17 AM EDT 2026
	[ Bug Fixes ]
	- t/ssh.t: the stand-in for ssh now names the perl running the tests on
	  its first line instead of "#!/usr/bin/env perl".  The transport starts
	  that file as a program, so the kernel picked whichever perl came first
	  on PATH - on a smoke tester the system perl, which cannot see the
	  modules the build installed - and the filesync-server it then ran died
	  with "Can't locate Params/Validate/Strict.pm" against a build that never
	  lacked it (GitHub issue #4).  The Windows wrapper already named $^X.
	[ Tests ]
	- t/ssh.t checks the interpreter line of the stand-in it writes, so the
	  PATH-dependent first line cannot come back unnoticed.

0.001.3	Sun Oct 25 07:25:08 AM EDT 2026
	[ Documentation ]
	- More improvements
	[ Bug Fixes ]
	- Bump minimim Config::Abstraction

0.001.2	Sat Oct 24 09:02:12 PM EDT 2026
	[ Bug Fixes ]
	- filesync-admin repo create names the server root and the directory
	  that blocks it when the root cannot be written, and says to chown
	  it to the running account or use --root elsewhere.  It used to
	  report only "Permission denied" against a path below the root.
	- That advice is given only when a directory really is unwritable, so
	  a full disk or a root that is a file keeps its own error.

	[ Documentation ]
	- The examples are split by machine - what to run on the
	  server, on each client, and from cron - and keep the master in a
	  home directory, so nothing needs sudo.
	- What a /srv/filesync root needs instead, the wrapper that
	  adds --root to filesync-server, and the ssh key the first sync
	  requires.
	- The backup and restore commands follow the example's master
	  layout, and make the backup directory before cron mirrors into it.
	- The synopsis creates the repo first, so it runs as printed.

0.001.1	Sat Oct 24 09:52:47 AM EDT 2026
	[ Bug Fixes ]
	- Build: test on Windows with Perl 5.42 again.  Its B::Hooks::EndOfScope
	  faults at exit, so the plain-Perl hook is used there.
	- filesync, filesync-server and filesync-admin select that hook for
	  themselves on 5.42 for Windows, so it no longer has to be set to run
	  them; an implementation already in the environment is left alone.
	  A test checks the choice in a child process that starts without the
	  variable.
	- Security: an ssh server of the form "-v@host" (or a program name
	  starting with "-") is refused; it was passed to ssh as an option.
	- Security: client and repo names that are not plain ids ("../x",
	  over 64 characters) are refused by the server, admin and client.
	- Server: a conflict copy is kept under the planned name whether or
	  not the client names it, and any other name is refused; acks are
	  accepted only for actions the client applies; get validates its
	  offset and caps its size; an upload larger than announced is
	  refused and discarded.
	- Ignore: building a matcher no longer modifies the caller's pattern
	  list (which turned "!keep.tmp" into "keep.tmp" and could delete the
	  file remotely); "/top" anchors to the root; "build/" matches at any
	  depth.
	- Trash: same-day versions sort numerically and are no longer capped
	  at .99.  Each client repo has its own local trash; restore still
	  finds files in the old shared one.
	- Admin: journal_read works when the server root contains spaces.
	- All messages come from a catalogue (App::FileSync::I18N::en) and can
	  be translated; errors no longer show Perl file and line numbers
	  unless FILESYNC_TRACE is set.
	- Internals: new Args, Base, Constants, I18N, IO and Platform modules;
	  private subs are enforced with Sub::Private; full POD.
	- Removed the unused POSIX and Encode prerequisites.
	- Build: requires Perl 5.14; declares ExtUtils::MakeMaker 6.64 as a
	  configure prerequisite so test prerequisites are honoured; the
	  gzip and (on macOS) gtar dist settings are now actually applied;
	  t/ and xt/ are not indexed; bug tracker link added.
	- $VERSION is a version object (version->declare), so every tool
	  reads 0.001.1 as the dotted version v0.1.1.
	- Every module and program carries the same GPL v2 licence notice.

0.001.0	Fri Oct 23 03:44:45 PM EDT 2026
	First draft
