Files
magpie/docs
yetone 0d58ec8dcb davsync: a write a server without conditional PUTs let another go over is merged again at the next sync (#1776)
On an S3 server that refuses If-Match (Aliyun OSS answers 400
NotImplemented), put falls back to HEAD then an unconditional PUT. Two
computers writing in the moment between both pass the HEAD, both are
told they wrote, and the later file is kept. Worse, the loser's next sync
then took the winner's file as having seen its own: its st.Remote was the
file it wrote, so its changed parts looked unchanged here and changed
there, and the old parts were brought in over its own changes. The edit
was lost on the server and on the computer that made it.

- version.Blind marks a write the server didn't check (s3.go's fallback).
- state.Blind keeps, for such a write, the file's sum and the remote and
  local part hashes from before it. The next sync that reads another
  file than that one merges from before the write. What this computer
  changed counts as changed again and goes back up beside the other's.
  A 304 or the same file clears it. Restore and Upload clear it.
- docs/reference.md says what happens on such a server.

No compare-and-swap exists on OSS, so the race itself isn't closed: the
other computer's file is kept for up to one sync interval (3 minutes)
before this computer's change is merged back. The reporter's AppendObject
journal would close it but needs every computer upgraded and OSS-only
signing. If the other computer saw this one's write and then changed the
same part again, the next sync can't tell that from a write that went
over it. It counts the part as changed on both sides: the newer stays,
the other is saved, and a notice says so. Nothing is lost.

Run:
- TestS3BlindWriteGoneOverIsMergedAgain (fake S3 with no conditional
  writes, two computers): A renames a provider and B sets the theme, B's
  PUT goes over A's, then A's next sync puts both on the server with no
  conflict notice, B brings in the rename, and nothing more is written.
  With the reset taken out (broken by hand), it fails: "A's rename here
  after its next sync: \"DeepSeek\"".
- go test ./internal/davsync whole.

Not tried against real Aliyun OSS: the fake answers conditional PUTs the
way the reporter quotes OSS (NotImplemented).
2026-10-12 19:38:15 +08:00
..