tarCopyOutcome.php
Table of Contents
Functions
-
tarCopyOutcome()
: array{ok: bool, moved: list
, reason: string} - Tells what a copy made by {@see tarCopyScript()} amounts to.
Functions
tarCopyOutcome()
Tells what a copy made by {@see tarCopyScript()} amounts to.
tarCopyOutcome(int $status, string $error) : array{ok: bool, moved: list, reason: string}
Exit code 1 is accepted when, and only when, every line tar wrote says that a file moved while it was read. GNU tar has three forms of it:
tar: <path>: file changed as we read it— a file written to during the copy;tar: <path>: File removed before we read it— a file deleted between the listing and the reading, a cache entry for instance;tar: <path>: File shrank by <n> bytes; padding with zeros— a file cut short while it was read, a log being truncated. Its copy is completed with zeros.
A copy taken from a directory in use is never a frozen picture of it; these three say which files were caught in motion, and they are named so a caller can report them. One other line, and the copy fails: tar exits 1 for nothing else, and a message this function has not been taught is not one to wave through.
Parameters
- $status : int
-
What the script exited with: 0, 1 or 2 from the reading tar, 3 when the writing one failed.
- $error : string
-
What the two tar wrote on standard error.
Tags
Return values
array{ok: bool, moved: listWhether the copy stands, the paths that moved while they were read, and why the copy failed when it did.