Release engineer comparing the device and inode numbers of five paths after whole-tree and per-file GNU cp runs.

Split a GNU cp Job Without Breaking Hard-Link Groups

Sat, Dec 5, 2026

A release script used to copy a deployment tree with one recursive command. The refactor puts the filenames in a queue and runs GNU cp -a once for each file. Every command succeeds. All five destination paths exist, and their SHA-256 hashes match the approved values. Then a consumer opens left/a for an in-place update and expects to read that update through right/a. Whether that expectation survives the refactor depends on a property missing from the checksum report.

The source owner deliberately gave two names to each of two files. A fifth name belongs to an independent file that happens to contain the same six bytes as the first pair. The release check has four parts. Inventory the requested paths, compare each payload with the approved bytes, establish exactly which destination names denote the same file, and verify that no destination file shares its identity with a source file.

You can make that decision before allowing the consumer to write. The experiment below holds the source still, changes the scope of the copy command, and records the resulting groups by relative name. A separate write trial lets you see what one of those groups means to the consumer. Keep the verified tree intact for handoff. If the groups split, rebuild from the approved source. If the owner cannot say which names belong together, hold the release.

Define the filesystem relationship the consumer needs

Start the review with a question for the owner of the deployment files. If a process opens one name and changes the existing file, which other names must expose that change? Ask the complementary question about names that must continue to contain their own values. In this tree, the two directories represent two consumer entry points. The owner can describe the intended relationship without knowing an inode number or seeing what the copy program produced.

Property

Acceptance condition for this tree

Exact paths

The root contains the directories left and right. Together they contain exactly the five declared regular-file paths. Reject extra entries, including empty directories.

Exact bytes

Each regular file contains its approved byte string, including the final line feed. Record the length and SHA-256 digest for review.

Exact partition

Two destination names share a device/inode pair if and only if they belong to the same declared group. The declaration covers every requested name once.

Source isolation

The set of destination regular-file identities has an empty intersection with the set of source regular-file identities. Compare across all names.

A hard link gives an existing file an additional directory entry. Both names address the same contents and inode attributes. Neither name has privileged status as the real file. This explains why a consumer can open one name and read a change made through the other, and why removing a name is a different operation from editing the file. The underlying interface and its filesystem restrictions are described in the Linux link(2) manual.

Use the consumer's requirement to decide which metadata enters the review. A team transferring executables might also need to qualify file modes at a CI artifact handoff. Here the owner is approving regular-file names, literal contents, peer names and separation from the source. A matching digest for two independent files gives the operator no authority to combine them. Likewise, finding two hard links in an unexplained source tree establishes their current relationship. Only the owner can say whether that relationship belongs in the release contract.

Pin the runtime and create an isolated working area

Run as one ordinary account on an owned Linux filesystem. Reserve a writable working directory for the experiment, keep other processes away from its contents, and run the controller there. It creates a fresh private directory with a generated name and prints its absolute path first. Each candidate and the source occupy separate children. The evidence directory is their sibling, so recording a result cannot add an unexpected file to a candidate.

The reproduction here used Python 3.12.16, GNU Coreutils 9.7 packaged by Debian as 9.7-3, Linux 6.18.64 on x86_64, and an ext4 mount at /workspace, under UID 1000. The controller records the resolved executable, full version banner, interpreter, kernel and mount information. Keep your own values. A wrapper with the same name, a different filesystem at the output location, or a different implementation of archive mode can change what this test establishes.

Save the listings as contract.py, verify.py and run.py in one directory. The successive run.py listings form one file in reading order. The accompanying lab archive also contains all three complete files and the reproduction evidence. From the directory containing the scripts, use either of these commands on a fresh run. The second includes the optional behavioral trial.

python3.12 run.py

# Or run the complete experiment, including the disposable write trial.

python3.12 run.py --probe

Begin run.py with the following setup. Each subprocess receives individual arguments. This preserves operand boundaries even when the laboratory path contains a space. For copy commands, the explicit -- ends option parsing before the source and destination paths.

import json
import os
from pathlib import Path
import platform
import shutil
import stat
import subprocess
import sys
import tempfile
from contract import PAYLOAD
from verify import compare, conforms, inspect_tree
if sys.version_info[:2] != (3, 12) or os.geteuid() == 0:
    sys.exit("Use Python 3.12 as an ordinary user.")
if sys.argv[1:] not in ([], ["--probe"]):
    sys.exit("Usage: python3.12 run.py [--probe]")
lab = Path(tempfile.mkdtemp(prefix="cp-review-", dir=Path.cwd()))
print(lab, flush=True)
source = lab / "src"
evidence = lab / "evidence"
evidence.mkdir()
def save(name, value):
    (evidence / (name + ".json")).write_text(json.dumps(value, indent=2) + "\n")
def execute(argv):
    args = [str(arg) for arg in argv]
    try:
        run = subprocess.run(args, cwd=lab, capture_output=True, text=True)
    except OSError as error:
        return {"argv": args, "status": None, "launch_error": str(error)}
    return {"argv": args, "status": run.returncode, "stdout": run.stdout, "stderr": run.stderr}
cp = shutil.which("cp")
if cp is None:
    sys.exit("HOLD: cp unavailable")
runtime = [execute([cp, "--version"]), execute(["uname", "-srmo"]), execute(["findmnt", "-n", "-T", lab, "-o", "TARGET,FSTYPE"])]
save("runtime", {"python": sys.version, "interpreter": sys.executable, "machine": platform.machine(), "uid": os.geteuid(), "lab": str(lab), "commands": runtime})
if (any(row["status"] != 0 for row in runtime) or "GNU coreutils" not in runtime[0]["stdout"]):
    sys.exit("HOLD: incomplete GNU/Linux runtime record")

Establish that the filesystem supports the fixture

A directory named “local” can sit on a mounted filesystem with different behavior from its parent. Query the mount containing the actual laboratory and create a regular file there. Add a second name with os.link, inspect both entries, and require equal device and inode numbers. This tests the operation under the account and mount used for the remaining steps. A refused link, an unexpected type or inaccessible metadata stops the experiment before there is a baseline to interpret.

probe = lab / "link-test"
peer = lab / "link-peer"
probe.write_bytes(b"test\n")
os.link(probe, peer)
first, second = probe.lstat(), peer.lstat()
if not (stat.S_ISREG(first.st_mode) and stat.S_ISREG(second.st_mode) and (first.st_dev, first.st_ino) == (second.st_dev, second.st_ino)):
    sys.exit("HOLD: link probe failed")
peer.unlink()
probe.unlink()

The two removals address only the names just created inside the new laboratory. Keep the source and every destination on this same mount for all cases, including the linked-copy control. The Python interfaces used for the link operation, pathname inspection and returned identity fields are documented in the Python 3.12 os reference.

Build five paths with three independent identities

Put the owner's declaration in contract.py, outside the source tree. Read the byte literals as bytes. The escape \n denotes one LF byte, so each alpha payload is six bytes long and each beta payload is five. There are five file paths, three underlying files and two distinct payloads. Those different totals make this small example more discriminating than a tree in which every file contains unique text.

PAYLOAD = {
    "left/a": b"alpha\n",
    "right/a": b"alpha\n",
    "left/b": b"beta\n",
    "right/b": b"beta\n",
    "left/independent": b"alpha\n",
}
GROUPS = sorted([
    ["left/a", "right/a"],
    ["left/b", "right/b"],
    ["left/independent"],
])
DIRECTORIES = ["left", "right"]

Create the two left-hand group members and the independent path by ordinary writes. Add the two right-hand members with hard links. Starting from an empty source matters even here. An ordinary write through an existing linked pathname would retain the old relationship and could invalidate the intended independent control. Append this fixture construction to run.py.

(source / "left").mkdir(parents=True)
(source / "right").mkdir()
for name in ("left/a", "left/b", "left/independent"):
    (source / name).write_bytes(PAYLOAD[name])
for leaf in ("a", "b"):
    os.link(source / "left" / leaf, source / "right" / leaf)
approved = inspect_tree(source)
save("before", approved)
if not conforms(approved):
    sys.exit("HOLD: unexpected fixture")

The fixture generator uses the declaration for its contents, while the verifier walks the filesystem to establish what actually exists. If someone changes the fixture builder to write a new right/b instead of linking it, its bytes still agree with the manifest. The preflight group comparison catches the mistake before GNU cp has run. Retain that failed preflight as a setup discrepancy. A copy result cannot tell you how a correctly linked source would have behaved if the source never had the required link.

Write the required partition without reading cp output

Write down the three groups in terms that survive a copy. The name left/a must be paired with right/a, left/b with right/b, and left/independent must appear alone. Every pair of names drawn from different groups must have different identities. This last clause catches an unintended merge even when every required positive pairing is present. It also gives the independent alpha file its own explicit requirement.

An inode number identifies a file within a filesystem. Combine st_dev with st_ino when comparing measurements, then replace each group key with the sorted names under it when comparing partitions. Fresh independent copies will usually have different inode numbers from the corresponding source files. Store those numbers as evidence for this run and retain relative names as the durable contract. The distinction between the filesystem identifier, inode number and hard-link count is documented in the Linux inode(7) manual.

Establish the one-invocation baseline

Create an empty destination and copy the contents of the source directory into it. In the command below the working directory is the generated laboratory, src is the verified fixture, and whole is the fresh destination. The commands displayed for individual cases are equivalents of the controller's argument arrays. Run the controller once to build the cases. Use these short forms when reviewing its saved plans or repeating a case in a separate fresh laboratory.

mkdir -- whole
cp -a -- src/. whole/

The final dot in the source operand src/. matters to the shape of the result. The consumer expects to find whole/left/a. Copying a source directory by name into an existing destination directory could instead introduce a src component. A recursive search by basename might still find an a, even though the consumer's exact path fails to open. Inventory from the expected root before evaluating the contents of the files you found.

GNU defines -a as -dR --preserve=all, with -d including --preserve=links. Here links names the hard-link preservation attribute. Archive mode also requests other attributes, including mode, ownership and timestamps. A command can request a property that your review never measured. Record the actual option string and keep the resulting acceptance statement limited to the four checks the owner asked for. The option definitions come from the GNU Coreutils cp(1) manual, consulted on 5 December 2026.

In the initial run and the independent reproduction, the whole-tree command on GNU Coreutils 9.7 returned zero. The reproduction recorded empty standard error. All five relative paths resolved to regular files with the required bytes. There were two two-name groups and the independent singleton. None of the three destination identities occurred among the source identities. This candidate is an independent reference tree for the consumer's release check. Leave it intact throughout the experiment, including the later trial that deliberately changes bytes.

Read the baseline report from the perspective of someone reviewing tomorrow's refactor. It gives them an observed partition and a known passing command under the same conditions as the proposed split. If the baseline itself fails, investigate the operands, fixture and mount before attributing anything to batching. Five successful per-file commands cannot repair a faulty comparison setup.

Split the work into five file copies

The refactor gives the scheduler a small, convenient unit of work. Each invocation receives one source file and the full name it should have at the destination. Precreate the two directories in a new candidate. Leave the approved source, payloads and command option unchanged. The five processes can run sequentially, which removes scheduling order and simultaneous writes from the explanation of any difference.

mkdir -p -- per-file/left per-file/right
cp -a -- src/left/a per-file/left/a
cp -a -- src/left/b per-file/left/b
cp -a -- src/left/independent per-file/left/independent
cp -a -- src/right/a per-file/right/a
cp -a -- src/right/b per-file/right/b

Each of those processes receives only one member of any given pair. When the call that handles right/a starts, the call that copied left/a has already finished. The wrapper supplies neither the earlier source operand nor an instruction to link the new name to its peer. In this fixture all five calls returned zero. Five digests matched. The destination groups were {left/a}, {left/b}, {left/independent}, {right/a} and {right/b}. Both required peer relationships had disappeared.

The singleton control still passes its individual requirement, as does source isolation. Identifying the precise failure helps a release owner choose a repair. Reading file bytes again will confirm the same content, and logging a more detailed success message for each subprocess will describe the same five completed operations. The failed predicate concerns the relationship between outputs produced by different calls.

Retain each command result before evaluating the tree

Append the plan builder and case controller below to run.py. The execute function defined earlier waits for its child and reads its return code directly. An executable that could not be launched gets a separate error and a null status. The controller saves the planned argument arrays before running them, then writes the accumulated results after each completed attempt. Compare the count and the statuses with the plan when inspecting an interrupted job.

def commands(kind, destination):
    if kind == "per-file":
        for folder in ("left", "right"):
            (destination / folder).mkdir()
        return [[cp, "-a", "--", source / name, destination / name] for name in sorted(PAYLOAD)]
    roots = [source / "left", source / "right"]
    if kind == "two-roots":
        return [[cp, "-a", "--", *roots, destination]]
    if kind == "split-roots":
        return [[cp, "-a", "--", root, destination] for root in roots]
    option = "-al" if kind == "linked" else "-a"
    return [[cp, option, "--", str(source) + "/.", str(destination) + "/"]]

def case(kind):
    destination = lab / kind
    destination.mkdir()
    plan = commands(kind, destination)
    results = []
    save(kind + "-plan", [[str(x) for x in cmd] for cmd in plan])
    for argv in plan:
        results.append(execute(argv))
        save(kind + "-commands", results)
    report = compare(source, destination)
    same_source = all(
        row["identity"] == approved["files"][name]["identity"]
        for name, row in report["source"]["files"].items() if name in PAYLOAD
    )
    completed = len(results) == len(plan) and all(r["status"] == 0 for r in results)
    if not (completed and same_source and conforms(report["source"])):
        decision = "HOLD"
    elif not (report["candidate"]["paths_ok"] and report["candidate"]["bytes_ok"]):
        decision = "HOLD"
    elif not report["pass"]:
        decision = "REBUILD"
    else:
        decision = "ACCEPT"
    report.update(decision=decision, completed=completed, same_source_ids=same_source)
    save(kind, report)
    print(kind, decision)
    return decision

The post-copy inspection starts after all planned attempts have returned. In a partial run the available records may explain how far the copy got. A missing command record or a missing final report leaves the case on hold, even if the most recently saved command exited successfully. The logger's ability to create a JSON file says nothing about the success of the child whose result it recorded.

Compare one call with two source roots against two calls

A per-directory worker sounds like a natural compromise. It retains a recursive copy within each directory and produces the layout the consumer expects. In this fixture, though, both hard-link pairs cross the proposed boundary. Run the two command shapes below against different empty directories. Both destination roots must already exist so that left and right land under their own names.

mkdir -- two-roots split-roots
cp -a -- src/left src/right two-roots/
cp -a -- src/left split-roots/
cp -a -- src/right split-roots/

In the first case, two argument positions select the source directories and one GNU cp process handles both. It encounters both names of each linked file within the same invocation. In the second, each process handles one directory. From the consumer's point of view the requested names are identical. From the copy program's point of view the two halves of each pair have been assigned to separate operations. The resulting partitions expose the difference.

Case on GNU Coreutils 9.7

Direct statuses

Regular paths with approved bytes

Destination groups

Shared source identities

Whole source tree

0

5 of 5

Required pairs and singleton

0

One file per call

0, 0, 0, 0, 0

5 of 5

Five singletons

0

Two roots in one call

0

5 of 5

Required pairs and singleton

0

One call per root

0, 0

5 of 5

Five singletons

0

Linked-copy control

0

5 of 5

Required pairs and singleton

3

These are recorded results for the five principal cases. The reproduction matched the initial observations on the same GNU Coreutils release and Debian package revision. In particular, the two-root invocation provides a practical option when a deployment needs selected roots rather than every child of their parent. Its success here rests on the selected roots containing every declared member and on the measured result satisfying the contract.

Before approving such a wrapper, inspect the argument vectors it actually emits. A configuration file that lists two roots together is consistent with either execution plan in the example. A loop, a worker queue or a limit on arguments per command can separate roots after selection. Ask the wrapper to retain the final plan so that the owner can map a required group to the call that handled its members. These trials measure the resulting files. They provide no timing or throughput comparison.

Test whether a linked copy still depends on the source

A reviewer looking only at the destination partition might accept a shorter way to reproduce it. GNU cp accepts -l to create hard links to source files. Combine it with archive mode on the same filesystem and perform one more copy into a fresh directory. The two destination pairs now have exactly the peer names the owner requested. All five literals also match.

mkdir -- linked
cp -al -- src/. linked/

Take the set of device/inode pairs for the five source names. Take the corresponding set for the destination and intersect them. The linked-copy control yielded three common identities. For example, the identity under linked/left/a belonged to both source names in the alpha pair. Even linked/left/independent shared its identity with src/left/independent. “Independent” in that filename describes the owner's requirement within a tree. The pathname alone cannot establish isolation across trees.

Exclude this candidate from the write probe. The intersection already establishes the defect relative to this owner's contract, without changing any approved payload. The control also explains a detail in the later reports. Creating an extra name increments the link count of a source file, even while its bytes and identity stay fixed. The experiment keeps source names, contents and identities fixed. It deliberately records the metadata change caused by creating the linked control.

For the consequences of an in-place write through a name shared with another tree, see how shared inodes affect an older backup generation. The official rsync manual gives the ordinary archive expansion as -rlptgoD. Hard-link preservation requires the separate -H option. All copy commands in the present comparison use GNU cp.

Explain what equal hashes and link counts leave unresolved

Reassuring observation

Example in this laboratory

Question still open

Two digests match

left/a and left/independent both hash the six alpha bytes.

Did these names identify one file or two?

A path has link count two

After the linked copy, src/left/independent has a second name.

Is the other name an intended local peer or a name in another tree?

The destination groups match

The linked-copy control has both required pairs and the singleton.

Does any destination identity also belong to the source?

A link count can flag an interesting file for inspection, but it carries no list of peer names. Keep it in the evidence as a diagnostic alongside the digest. To settle the consumer's requirement, enumerate actual names and compare their identities.

Compute the destination partition after every copy

Save the following as verify.py. It has no copy plan and receives no list of successful writes from the controller. It opens the source and the specified candidate independently. It enumerates the root, checks entry types with lstat, descends into directories, and reads regular files only. An unexpected type is reported by name. A directory read or metadata error interrupts inspection and produces a nonzero exit. The Linux stat(2) manual documents the pathname behavior on which that type check relies.

import hashlib

import json

import os

from pathlib import Path

import stat

import sys

from contract import DIRECTORIES, GROUPS, PAYLOAD

def inspect_tree(root):

    if not stat.S_ISDIR(root.lstat().st_mode):

        raise ValueError(f"Expected directory: {root}")

    files, directories, unexpected = {}, [], []

    members = {}

    def visit(directory):

        for path in sorted(directory.iterdir()):

            name = path.relative_to(root).as_posix()

            info = os.lstat(path)

            if stat.S_ISDIR(info.st_mode):

                directories.append(name)

                visit(path)

            elif stat.S_ISREG(info.st_mode):

                identity = (info.st_dev, info.st_ino)

                data = path.read_bytes()

                files[name] = {

                    "identity": list(identity), "nlink": info.st_nlink,

                    "size": len(data), "sha256": hashlib.sha256(data).hexdigest(),

                    "bytes_ok": data == PAYLOAD.get(name),

                }

                members.setdefault(identity, []).append(name)

            else:

                unexpected.append(name)

    visit(root)

    groups = sorted(sorted(names) for names in members.values())

    paths_ok = (files.keys() == PAYLOAD.keys()

                and sorted(directories) == DIRECTORIES and not unexpected)

    return {

        "files": files, "directories": sorted(directories),

        "unexpected_types": unexpected, "groups": groups,

        "paths_ok": paths_ok,

        "bytes_ok": files.keys() == PAYLOAD.keys()

                    and all(row["bytes_ok"] for row in files.values()),

        "groups_ok": groups == GROUPS,

    }

def conforms(tree):

    return all(tree[key] for key in ("paths_ok", "bytes_ok", "groups_ok"))

def identities(tree):

    return {tuple(row["identity"]) for row in tree["files"].values()}

def compare(source, destination):

    original = inspect_tree(source)

    candidate = inspect_tree(destination)

    shared = sorted(identities(original) & identities(candidate))

    return {

        "source": original, "candidate": candidate, "shared": shared,

        "isolated": not shared,

        "pass": conforms(original) and conforms(candidate) and not shared,

    }

if name == "__main__":

    try:

        source, destination = map(Path, sys.argv[1:])

        report = compare(source, destination)

    except (OSError, ValueError) as error:

        print(json.dumps({"inspection_error": str(error)}))

        sys.exit(2)

    print(json.dumps(report, indent=2))

    sys.exit(0 if report["pass"] else 1)

For an independent review, run the verifier from the scripts directory and supply the source and candidate under the laboratory path printed by the controller. The following Bash commands prompt for that path, run the independent inspection and retain its status immediately. The JSON contains the per-name device/inode pair, byte length, SHA-256 digest, literal comparison and link count in each tree.

read -r -p 'Absolute laboratory path: ' lab

python3.12 verify.py "$lab/src" "$lab/whole" > "$lab/evidence/whole-review.json"

review_status=$?

printf 'Independent verifier status: %s\n' "$review_status"

Read a pair of rows horizontally to compare versions, then vertically to compare names within a version. The following inode numbers come from the article reproduction. Every listed identity had device number 65040. The complete report retains both numbers for every path. The same alpha digest occurs in three rows, yet only two of those rows may share an identity.

Relative name

Approved bytes

Source inode

Whole-tree inode

Per-file inode

left/a

alpha\n

1180033

1180040

1180050

right/a

alpha\n

1180033

1180040

1180054

left/b

beta\n

1180034

1180041

1180052

right/b

beta\n

1180034

1180041

1180055

left/independent

alpha\n

1180035

1180042

1180053

Sorting removes dependence on directory enumeration order. Comparing the resulting lists checks the membership of every group, including the singleton. Even a candidate with the right number of groups and the right distribution of group sizes can fail. For example, pairing left/a with left/independent and leaving right/a alone would preserve the alpha bytes and the group sizes. It would direct an update to the wrong consumer path.

Exit zero means the measured trees meet the data and identity predicates. Exit one means a comparison failed. Exit two means inspection could not finish. Release review additionally needs the actual command results and the frozen-source evidence. For another case where the owner's byte requirement determines acceptance, see why a checksum option can still leave rejected bytes during a transfer. Here every principal case passes the byte comparison, so the partition and intersection carry the decision.

Probe the accepted copy's shared behavior

An operator can sign off the measured identities without modifying the accepted candidate. If the owner wants a demonstration of the consumer's update, ask what operation the consumer performs. This probe models opening an existing regular file, writing through that open handle, closing it, and then opening each named path for inspection. It makes sense for a consumer that really edits its file in place. A consumer that publishes a new file by renaming it over an old name has a different operation to test.

The initial run covered the five copy cases. The reproduction also included the optional write probe under the recorded runtime. The controller created a separate write-test tree with a fresh recursive copy and admitted it only after all four checks passed and the copy command completed. It also kept the baseline whole intact. This admission step matters because an operator who accidentally targets the linked control could change the approved source through an entirely different pathname.

Name read after close

Before

After on the trial tree

After on the source

left/a

alpha\n

gamma\n

alpha\n

right/a

alpha\n

gamma\n

alpha\n

left/independent

alpha\n

alpha\n

alpha\n

left/b and right/b

beta\n

beta\n at each path

beta\n at each path

Use an in-place write for the behavioral probe

Finish run.py with the driver below. Opening with r+b starts at offset zero in the existing file. The write supplies the new bytes and truncate() sets the file length at the current position. The context manager closes the handle before any observation. The check records the post-write bytes, verifies all five identities are unchanged within the trial, and rechecks the original baseline against the source.

expected = {"whole": "ACCEPT", "per-file": "REBUILD", "two-roots": "ACCEPT",

            "split-roots": "REBUILD", "linked": "REBUILD", "rebuilt": "ACCEPT"}

try:

    outcomes = {kind: case(kind) for kind in expected}

    if outcomes != expected:

        sys.exit("HOLD: inspect results before continuing")

    if sys.argv[1:] == ["--probe"]:

        if case("write-test") != "ACCEPT":

            sys.exit("HOLD: write-test candidate failed admission")

        target = lab / "write-test"

        before = inspect_tree(target)

        with (target / "left/a").open("r+b") as handle:

            handle.write(b"gamma\n")

            handle.truncate()

        after = inspect_tree(target)

        source_after = inspect_tree(source)

        wanted = dict(PAYLOAD)

        wanted.update({"left/a": b"gamma\n", "right/a": b"gamma\n"})

        behavior_ok = all((target / n).read_bytes() == data for n, data in wanted.items())

        unchanged_ids = all(before["files"][n]["identity"] == after["files"][n]["identity"]

                            for n in PAYLOAD)

        passed = (behavior_ok and unchanged_ids and after["paths_ok"] and after["groups_ok"]

                  and conforms(source_after) and compare(source, lab / "whole")["pass"])

        save("probe-result", {"before": before, "after": after, "source_after": source_after,

                              "observed_hex": {n: (target / n).read_bytes().hex() for n in PAYLOAD},

                              "pass": passed})

        if not passed:

            sys.exit("HOLD: behavioral discrepancy")

        print("write through left/a verified")

except (OSError, ValueError) as error:

    save("hold", {"error": str(error)})

    sys.exit(f"HOLD: {error}")

In the saved after report, the two changed paths correctly fail comparison with their original alpha literals. That field tells you the trial tree no longer qualifies as the original deliverable. The separate behavioral result evaluates the new, explicitly stated expectations and passes. Preserve both readings. Substituting the post-write gamma bytes into the release manifest would erase the distinction between the artifact the owner approved and the test performed on its disposable copy.

Rebuild a candidate whose groups were split

Take the rejected per-file candidate out of the consumer's selection path. Keep it available for inspection and leave its report attached to its case name. The failure can be explained exactly. The source had two pairs crossing the file boundaries, the commands produced five independent identities, and the rejected candidate continued to carry the approved bytes. None of those observations calls for a change to the source.

Build a new empty candidate using a single invocation that includes both members of each required pair. The controller's rebuilt case uses the whole-tree scope, creates the destination with a fresh directory creation, saves the actual command status, and runs the same verifier. It returned zero and passed all four checks in the reproduction. When only the two named roots are wanted, the tested multiple-source form is another available plan. Choose the operands that cover the owner's declared tree.

A digest-driven deduplication pass would be a different repair. Consider a tool that selects one representative for every SHA-256 value and reconnects every matching pathname as a hard link. It would give the three alpha names one identity, binding left/independent to future changes under right/a. The byte report would remain green, even immediately after this new defect was introduced. A proposed merge needs declared membership for each name. In this small release, a fresh copy already provides a tested route to the right membership.

Review the rebuilt tree as its own candidate. Its absolute inode numbers can legitimately differ from the baseline and the rejected tree. What must agree are the relative paths, approved literals, partition and empty source intersection. Keep the owner approval with the rebuilt location. An approval attached only to the run's parent directory leaves a consumer free to select a rejected sibling. For an archive recovery procedure with different inputs and decisions, see reconstructing a directory from an incremental tar chain.

Handle interrupted copies and changing inputs

Suppose the per-file worker completes four calls and stops before the fifth. The command plan and saved results show which calls have records. Inspecting the candidate can establish that some paths exist, have known bytes and belong to measured groups. A name absent at that point carries no identity evidence. An inspection taken while the worker is still writing has a different problem again. It combines observations from different moments, and the final tree could disagree with any of them.

Leave the interrupted destination and its logs available, stop the writer, and start a new case in an empty directory. A retry against a partially populated tree changes the initial condition of the experiment. Even if the previous attempt left every expected name behind, the next invocation encounters existing entries whose identity relationships may reflect the failed attempt. Retrying in place would require evidence for a separate procedure. Repeating the original copy into a fresh destination gives the reviewer a result they can compare directly with the baseline.

The source requires a stable observation window from fixture approval through the last read used for a decision. The controller compares source names, contents, groups and per-path identities with the preflight. Those checks can expose a changed input. They cannot detect a writer that temporarily changes a file and restores the former state between inspections. Arrange exclusive use of the disposable tree first. Treat a reported concurrent write as a broken precondition even if the final digests happen to match.

To validate a parallel copy job, examine the proposed unit of work before using this evidence. For every required group, list the worker and actual invocation assigned to each member. If a group spans workers, the tested split predicts a concrete failure worth reproducing. If each group fits within a single invocation, test that actual plan on a fresh tree. This sequential lab supplies neither a measurement of racing workers nor approval for writers that touch overlapping destinations. Its comparison isolates the invocation boundary that the refactor changed.

Choose whether to approve the copy job

Base the release decision on the measured candidate and the history that produced it. A reviewer should be able to point to one report value or one missing item for each action below. “Rebuild” means the evidence identifies a copy-scope or linking choice that violated the declared relationship. “Hold” means the owner lacks an acceptable execution or a sufficient basis to qualify the output. In both cases, keep the consumer on the prior approved location.

Observed evidence

Application decision

Owner action

Whole tree or two roots in one call. All planned statuses zero, all four checks pass, stable source.

Accept this candidate for the declared use.

Record the passing path and arrange the consumer check.

Five files have the right bytes. Both expected pairs split into singletons.

Rebuild.

Use a tested scope containing all members. Recheck in a fresh destination.

Correct groups and bytes. Destination identities intersect the source.

Rebuild.

Remove -l from the independent-copy plan. Retain and verify the new tree.

A required name is absent, an extra entry exists, or bytes differ from the manifest.

Hold.

Resolve selection, layout or payload provenance and repeat the full run.

A process fails, fails to launch, or lacks a matching completion record.

Hold, including when a subsequent inventory looks complete.

Retain the plan and diagnostics. Correct the failure and rerun.

Source changed during the run or its stability is disputed.

Hold.

Establish the intended stable source and confirm the manifest with its owner.

Expected pairs exist but a declared singleton was merged into a pair.

Rebuild once the source contract is confirmed.

Remove the merge step and verify group membership by name.

Hold when identity evidence is incomplete

Sometimes the manifest contains the five approved digests but nobody retained the group declaration. The bytes alone admit both observed outcomes, and the independent alpha file shows why guessing from matches would be unsafe. Ask the source owner to identify the intended peers and authorize a new manifest. A current source inventory can inform that conversation. A directory's present state by itself supplies no record of which relationships a consumer is entitled to depend on.

If a pathname disappears during inspection, preserve the path, error and case identifier. If the filesystem cannot supply usable identity measurements, record that the partition or isolation remains unresolved. A failed verifier is useful here because it denies the candidate an accidental pass. Once the precondition is restored, collect a complete result from one stable run. Joining part of yesterday's inventory to part of today's inode table gives the reviewer no single candidate to approve.

Transfer ownership of the candidate and its evidence

Hand the release owner the exact location of the accepted candidate along with the manifest revision, source provenance and the account and runtime used for the copy. For this laboratory the fixture builder, the literal declaration, the generated source location and the preflight report identify the source. Include the script version actually used and the complete command plan so another reviewer can tell whether two operands appeared in one invocation.

The evidence bundle should be readable without access to a running copy process. Keep the following items together and identify which report goes with the location proposed for the consumer.

·       The approved directory names, five file paths, expected bytes and three groups, with the owner responsible for their meaning.

·       The before-copy source inventory, exact working directory and platform record, including the mount that contained the actual candidates.

·       The completed argument vectors, raw exit statuses and diagnostics for the selected candidate, plus the per-path source and destination reports.

·       The normalized groups, source intersection and final disposition. Label the modified write-test tree separately and retain the prior approved location.

For a reversible handoff, record the consumer's current configured root, select the accepted candidate as the new root, and have the consumer start a new read from its expected relative paths. A read-only smoke check can confirm that the configured consumer sees the reviewed names and approved bytes. It need not modify the accepted release to repeat a behavior already demonstrated on the disposable trial. If the consumer misses a name or selects another location, restore the recorded prior root, reopen the consumer's files, and keep both trees available for diagnosis.

Opening fresh handles matters at this boundary. Changing a root setting does not retarget a handle that the consumer opened earlier. A returning process may still be reading the previous release until it closes and reopens its files. A related review examines the lifetime of an already-open file descriptor. Record the wrapper, batching policy and destination filesystem with the handoff. A later change to any of them identifies the precise operation or assumption that needs a new acceptance run.

Practise Linux release checks through DevOps project work

A useful scripting exercise is to give a second engineer the five-file manifest and a candidate, then ask them to name the failing predicate from their own inspection. The exercise calls on two everyday Linux skills: constructing a command with the intended operands and measuring what a consumer can open afterward.

Refonte Learning lists Linux Fundamentals and Scripting in a three-month curriculum with 12–14 hours of work per week. Its Program Specifics require engagement in bachelor's or postgraduate studies, and Admissions requires working toward a bachelor's or higher-level degree. For the curriculum and project details, see the DevOps Engineer Program.