Record the refresh race investigation and the remaining race detector
reports in the security tests, give the reasons the TestMain and two
crypto items are left, and tick Task 7 in the plan.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Seen failing with three race-enabled suites run at once:
- TestDownloadRefetchOtherHash had 300 ms to corrupt a block in; 2 s
- TestPollerShutdownAndReuse could apply the replayed events after its
last use, emptying the cache, so polling stopped; it now keeps using
the Fs while it waits
- polls of the fake remote ending after captureLog put the log config
back raced with it; the fake remote no longer polls after captureLog
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A saved session whose key password unlocks no key failed with "is the
password right?" alone; it now also says to run rclone config
reconnect, as other unusable saved sessions do.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rclone config create, show and dump print the saved session, whose
salted key password outlives a sign out. Also say that a cache unused
for 10 minutes is forgotten, and make the fake server's init.d stop
kill protonfake if it hasn't stopped within 10s.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An uncompressed encrypted name, passphrase, hash key or extended
attributes far larger than the limit for its kind was decrypted into
memory in full before being refused; one of 10 MiB took about 230 MiB
to list. It is now refused by its size first. Also wrap the error for
folders nested too deep once rather than at every level, where a
hostile server could make it about 88 KB.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
captureLog writes rclone's global log config, which an Fs polling for
changes reads; three hostile server cases called it with an Fs still
polling, a data race seen under load. They now shut the Fs down or
make it after capturing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Shutdown cancelled a poll in flight without waiting for it, so a poll
whose response had already arrived could still log after Shutdown
returned; the race detector caught one racing with a test's change to
the log level. Shutdown and Disconnect now wait for the poll, though
not for any notification it makes.
Also make TestPollerShutdownAndReuse wait for its polls rather than
count them after a fixed sleep, which failed under load.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TestListingRacingChange now releases its held request however it ends,
rather than hanging until the package timeout, protonfake's TestRun
stops and waits for its server on a failed assertion, and
TestClientBootstrapCreateVolumeRace starts both clients at once rather
than always waiting 2 s for one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Go's HTTP client drops only standard credential headers on a redirect
to another host, so pm-storage-token and x-pm-uid went with it; they
are now dropped too. Also let a later pass of a sync retry an upload
whose source changed while it was read, rather than failing it for
the whole run.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A caller waiting for another's fetch of the same public keys got that
caller's context error if it was cancelled; it now fetches them
itself. Also:
- build each own address's public key ring once at sign-in rather
than on every lookup, 2-3 times per decrypted node
- a listing caching a node under a new parent forgets the old
parent's listing, as caching a single node already did
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A server answering More with an anchor already followed made a listing
page until its context ended; it now fails at once. Also read an
extended attribute Size of null as missing, so the block sizes give
the size, rather than as 0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With nothing subscribed to changes, a node cache neither read nor
filled for 10 minutes is now cleared, which stops polling until the
Fs is used again; before, an Fs never shut down polled for ever.
Also keep to one events request per interval:
- a Retry-After on an events request no longer holds up the listing
that filled the cache; it delays the next poll instead
- after Shutdown, polling resumes from the cursor it had, an interval
after reuse, instead of fetching a new cursor at once
- once the start cursor fetch has failed, the next is fetched after
the backoff rather than inline
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The root can't move, so an event reporting a parent for it now drops
only the root's listing rather than everything cached. Also:
- staleNode.parentID is the cached parent, empty for uncached nodes;
the reported parent is always newParentID
- log at debug level when an events page with More set doesn't advance
- drop invalidateTree's walk of listings, which found nothing the
walk of nodes doesn't, and a dead case in changedPaths
- test that refresh and a gone volume forget pending nodes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SetEventsPageSize of 0 or less served empty pages with More set for
ever; it now restores the default. Also check that deleting a draft
revision emits no event.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fstests waits 27 s for changes and Proton allows one events request per
30 s. The live events check otherwise passed; record its findings and
tick plan 002 Task 6.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One line per page with the event count, the cursor and whether more
follow, so -vv shows what each poll read. Only IDs are logged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Checked live: rename, move and trash emit UpdateMetadata, a new
revision Update, and the Link fields of an event are the link's state
when the events are read, so a link deleted for good has no parent and
isn't trashed. The test server now does the same; injected events keep
their own fields. The backend already treats UpdateMetadata like
Update; a test pins a rename as UpdateMetadata and a folder made and
removed between polls.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DirCacheFlush reset the directory cache to the volume root until the
root was found again, so a change notified in between would be named
relative to the volume root. It now keeps the root folder's ID, as
flushes made for change events do.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A folder the node cache no longer held but the directory cache did, as
after the cache is cleared, was notified only by its new parent when
another client moved it, so a mount kept showing it at its old path.
Its old path is now notified as well, and flushed as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An item's event can be applied before rclone caches the item, as for
its own uploads and new folders. Its folder is still notified at once,
and the item itself is now notified at its path if it is cached within
the next two polls, with no extra requests. This makes mounts and the
FsChangeNotify integration test see exact paths for such items.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add ChangeNotify, fed by the volume events: an item is reported at its
old path, and its new folder if it moved, when it was cached; otherwise
its folder is reported. An expired cursor reports the root. Every event
batch also flushes the folders it names from the dircache, so a folder
renamed or moved by another client is found under its new path and
nothing is left at its old one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The notify function runs on the backend's goroutine while the test
reads the changes it records, so guard them with a mutex. This showed
up as a race detector failure for backends whose ChangeNotify is
tested with -race.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first poll after a fill of the cache runs on the goroutine which
filled it, which may hold the dircache's lock or VFS's. It no longer
waits for the poller's lock there, and hands any notification (a gone
volume) to a goroutine of its own, so a subscriber taking those locks
can't deadlock.
Also clamp events_min_interval for Proton's endpoint written with a
trailing dot, document that onFill must be set before the cache is
shared, test a failing start cursor on the first fill, and make the
backoff test serial and less tight, as it counts shared goroutines and
pool buffers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Timing bounds in parallel tests leave room for a slow race runner, the
block 502 test checks its fault fired, refusedCommit's 408 exclusion is
pinned, the user docs explain the "server doesn't show it yet" error and
the conformance checklist matches the current draft and trust rules.
Every other minor from the review is listed in docs/TODO.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Log lines no longer cut a name inside a UTF-8 sequence, the "superseded
upload" error says the file's state rather than claiming a revision is
active, a test-only block decrypter moves to the tests, a one-line alias
of encryptPassphrase goes, the upload godoc is rewrapped and the fake's
server struct is gofmt clean.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the access token expired and the refresh request got a 5xx, 429 or
408, the operation failed instead of being retried, and a 408 even ended
the session as if the refresh token had been rejected. Such failures are
now retried like any other call.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only fstest.Initialise, run by the integration test, applied
RCLONE_CONFIG, so a filtered test run read the default rclone config,
which may hold a real Proton remote. TestMain now applies it first.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The race suite ran under Go's default 10 minute limit, which a slow
runner would hit; it now has 40 minutes in a 60 minute job. Go is the
1.27 line the code was verified with, not go.mod's minimum, so
govulncheck checks a patched standard library, and govulncheck is
pinned to v1.9.0 so a new release can't break the build.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Proton announces requirements it will enforce, such as a minimum client
version, in x-pm-drive-requirements response headers. They are now
logged at debug level whenever they change, so they show in -vv bug
reports.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Proton's generic "requirements not met" code 2000, which it returns for
a node changed since it was read (as when a lost rename response is
resent), aborted the whole run with "upgrade rclone". It is now an
ordinary error that isn't retried. Code 2028 (a feature disabled,
rate-limited or blocked) is retried, and the codes Proton actually uses
for a rejected or missing app version, 5003 and 5001, now give the
upgrade message.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A file whose extended attributes don't record its block sizes, as some
other clients write, was read from the first block for every ranged
read, so a multi-thread copy, which opens each chunk as a range,
downloaded data quadratically: about 8.5 GiB for a 1 GiB file. The sizes
of blocks already read are now remembered per Fs (bounded to 16
revisions and 65536 blocks), so later chunks start at the right block.
A block list that disagrees with what was learnt is an integrity error.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A remote set up with environment variables or a connection string can't
save its draft client ID, so it got a new random one on every run, and a
draft left by an earlier run then blocked uploading that name as if
another client were uploading it. When the ID can't be saved it is now
derived from the remote name and the account's volume, so it is the same
on every run. A remote in the config file still gets a random ID, saved.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Extended attributes whose signature failed or was missing were used, so
a server could set a file's modification time, size and SHA-1 at will:
for example make `rclone sync --update` skip every changed file. Without
ignore_signature_errors they are now not used and an ERROR is logged:
the modification time is the server's, there is no SHA-1, and the size
comes from the recorded block sizes, which reads check. The file stays
readable.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Renaming or moving a node whose name signature failed reused the old
name's session key, which a server that made that name knows, so it could
read the new name. The new name now gets a new session key unless the
old name's signature verified.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A folder's hash key whose signature failed or was missing was only
logged, and the names of everything written into the folder were then
hashed with it, so a server which made the key could test guesses at
those names. Creating, uploading, renaming, moving or copying into such
a folder is now refused unless ignore_signature_errors is set, when an
ERROR is logged once per folder. Reading is unaffected.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A node or share key from the server was unlocked with whatever Argon2
parameters it carried, so a crafted key could make every listing
including it allocate up to 2 TiB and crash rclone. Node and share keys
locked with Argon2 beyond 4 passes, parallelism 8 or 128 MiB are now
refused before the key derivation runs, as an integrity error.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>