diff options
| author | tv <tv@krebsco.de> | 2026-12-01 03:52:13 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-12-01 03:52:13 +0000 |
| commit | 9cbe2fab9a3fe30ce4218458112ab46e49c6ac7c (patch) | |
| tree | deba59a2f8d09787d27aa92dccd5bd023bb98453 /pkgs/populate/src/populate.rs | |
| parent | 75df988e1cb9863ee5d708dbc578f7690bb182de (diff) | |
populate pipe: a fixed time rsync can keep
What pipe sources make gets a fixed modification time, so only checksums
tell whether it changed. That time was in the year 3000, beyond what
rsync can keep: it stored it as 2446-05-10, so source and target differed
on every run, rsync set the time again, and the run record said the
source changed. 2000-01-01, in UTC whatever the deploying machine's time
zone, rsync keeps. The pipe scenarios check that a run with the same
output changes nothing.
Diffstat (limited to 'pkgs/populate/src/populate.rs')
| -rw-r--r-- | pkgs/populate/src/populate.rs | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/pkgs/populate/src/populate.rs b/pkgs/populate/src/populate.rs index 6c4fd42..86639ac 100644 --- a/pkgs/populate/src/populate.rs +++ b/pkgs/populate/src/populate.rs @@ -380,6 +380,12 @@ impl Kind for File { } } +/// The fixed modification time of what pipe sources make, for touch -t in +/// UTC: 2000-01-01, a time rsync can keep. It stores times beyond its +/// range wrapped, e.g. the year 3000 as 2446, so they would differ on every +/// run, and the file count as changed. +const PIPE_TIME: &str = "200001010000"; + /// What a command on the deploying machine prints. struct Pipe; @@ -397,8 +403,9 @@ impl Kind for Pipe { )?; run::status( Command::new("touch") + .env("TZ", "UTC0") .arg("-t") - .arg("300001010000") + .arg(PIPE_TIME) .arg(&out), )?; // With the fixed modification time, only checksums tell outputs of @@ -432,15 +439,12 @@ fn deliver_directory(d: &Delivery) -> Result<Outcome> { ))?; // The fixed time of pipe's output, so the same contents don't change // anything at the target path, and only checksums tell them apart. - run::status(Command::new("find").arg(out.as_ref()).args([ - "-exec", - "touch", - "-h", - "-t", - "300001010000", - "{}", - "+", - ]))?; + run::status( + Command::new("find") + .env("TZ", "UTC0") + .arg(out.as_ref()) + .args(["-exec", "touch", "-h", "-t", PIPE_TIME, "{}", "+"]), + )?; let config = Config { use_checksum: true, ..Config::default() |
