Skip to content

fix: merge upstream master into region-icloud-8257 to resolve PR #8818 conflicts - #2

Open
xz-dev wants to merge 594 commits into
timerring:region-icloud-8257from
xz-dev:fix-8818-merge
Open

xz-dev wants to merge 594 commits into
timerring:region-icloud-8257from
xz-dev:fix-8818-merge

Conversation

@xz-dev

@xz-dev xz-dev commented May 3, 2026

Copy link
Copy Markdown

Summary

This PR merges the current rclone/rclone master into region-icloud-8257 to resolve the merge conflicts in rclone/rclone#8818.

What was resolved

The original PR had conflicts because master significantly refactored the iCloud Drive backend since the PR was created:

  • init() and Config() moved from iclouddrive.go to icloud.go
  • SRP authentication was added
  • iCloud Photos support was added
  • api/client.go was restructured with disk caching, mutex, session reuse

Conflict resolutions

File Resolution
iclouddrive.go Removed duplicate init()/Config()/NewFs logic (now lives in icloud.go); kept master's NFC normalization, Disconnecter, and m configmap.Mapper
icloud.go Added configRegion constant, region option in init(), and UseChinaMainlandEndpoints() calls in both Config() and newICloudClient()
api/client.go Added homeEndpoint variable; UseChinaMainlandEndpoints() switches all 4 endpoints
docs/content/iclouddrive.md Region option added to config example and auto-generated docs

What was preserved from master

  • SRP authentication flow (all icloud.go/icloudphotos.go code untouched)
  • Disk caching of webservices
  • Disconnecter interface and m configmap.Mapper
  • iCloud Photos support (NewServiceFs, ServiceOptions, etc.)
  • NFC Unicode normalization in findLeafItem
  • Mutex-protected Client.DriveService() and Client.Authenticate()

Verification

make rclone          # builds successfully
make backenddocs     # docs generated (68 backends, 0 failures)
go test ./backend/iclouddrive/...  # all tests pass

Once merged into this branch, rclone#8818 should become mergeable with master.

acme and others added 30 commits February 5, 2026 12:10
- Add new Fastly provider with US East, US West, and EU Central regions
- Add `etag_is_not_md5` quirk for providers with mandatory encryption
- Disable server-side copy for Fastly (not supported)
Avoid buffering the entire file in memory during download, especially
for large files.
StackPath's object storage service no longer exists and all S3
endpoints are no longer operational.

Before this change, users could select StackPath as an S3 provider
during configuration, but connections would fail as the endpoints no
longer respond and the service has been discontinued.

After this change, StackPath is removed from the list of supported
S3 providers, preventing users from attempting to configure a
non-functional service.

Fixes rclone#9148
Before this change directories and files were created in the default
workspace, not the workspace specified by --drime-workspace-id.
It was possible in the presence of --max-connections and recursive
calls to the pacer to deadlock it leaving all connections waiting on
either a max connection token or a pacer token.

This fixes the problem by making sure we return the pacer token on
schedule if we take it.

This also short circuits the pacer token if sleepTime is 0.
Before this change we read sleepTime before acquiring the pacer token
and uses that possibly stale value to schedule the token return. When
many goroutines enter while sleepTime is high (e.g., 10s), each
goroutine caches this 10s value. Even if successful calls rapidly
decay the pacer state to 0, the queued goroutines still schedule 10s
token returns, so the queue drains at 1 req/10s for the entire herd.
This can create multi‑minute delays even after the pacer has dropped
to 0.

After this change we refresh the sleep time after getting the token.

This problem was introduced by the desire to skip reading the pacer
token entirely when sleepTime is 0 in high performance backends (eg
s3, azure blob).
These stats weren't being updated in the global stats read by rc
core/stats:

- transferQueue
- deletesSize
- serverSideCopies
- serverSideCopyBytes
- serverSideMoves
- serverSideMoveBytes
Before this change when doing a sync with `--no-traverse` and
`--files-from` we could call `NewObject` a total of `--checkers` *
`--checkers` times simultaneously.

With `--checkers 128` this can exceed the 10,000 thread limit and
fails when run on a local to local transfer because `NewObject` calls
`lstat` which is a syscall which needs an OS thread of its own.

This patch uses a weighted semaphore to limit the number of
simultaneous calls to `NewObject` to `--checkers` instead which won't
blow the 10,000 thread limit and is far more sensible use of OS
resources.

Fixes rclone#9073
In the actions config use Go ~1.25.7 to pin the go version to 1.25.x,
x >= 7.

Before this it was choosing Go 1.26.0 which isn't what we want.
lukecyca and others added 28 commits April 24, 2026 18:51
The background kicker goroutine had a bare select outside a for loop,
so the 5s ticker fired at most once before the goroutine exited. The
intent was to run every 5s for the lifetime of the Downloaders.

This wraps the select in a for loop so the ticker fires repeatedly
until ctx is cancelled.

In practice this was benign because every downloader exit and every
successful Write already calls kickWaiters, so the background kicker
is only load-bearing when a waiter is queued, no downloader is
running, and _ensureDownloader failed transiently. In that state,
before this fix, the waiter would hang until another Download() call
or Close() arrived; now it gets retried every 5s and will either
recover or accumulate enough errors to trip maxErrorCount and error
out cleanly.
… other

On Windows, passing "*" as mountPoint to the mount/mount RC command
auto-assigns a drive letter (e.g. "Z:"), but the resolved letter was
never propagated back to mountlib. This caused liveMounts to be keyed
on the literal "*", breaking tracking of multiple mounts and making
unmount unreliable.

Change MountFn to return the actual mount point as an additional
return value. Update MountPoint.Mount() to store the resolved value,
and mountRc() to use it as the liveMounts key. The mount/mount RC
response now returns the actual mountPoint so callers can discover
which drive letter was assigned.
Add read-only iCloud Photos support to the existing iclouddrive
backend via `service = photos` config option.

Also includes auth improvements on top of rclone#9209's SRP authentication.

**Photos features:**
- 3-level hierarchy: libraries (Personal + Shared Photo Library) →
  albums → photos/videos
- server-side smart albums (All Photos, Videos, Favorites,
  Screenshots, Live, Bursts, Panoramas, Slo-mo, Time-lapse, Portrait,
  Long Exposure, Animated, Hidden, Recently Deleted)
- User-created albums and nested album folders
- Live Photo `.MOV` companions as first-class entries
- Edited photo versions (`-edited` suffix) and RAW alternatives
- Duplicate filename dedup for camera counter wrap collisions
- Parallel cold listing for large albums
- Delta sync via CloudKit `changes/zone` - warm listings near-instant from disk cache
- Disk cache (libraries, albums, photos) with atomic writes for crash safety
- `ChangeNotify` support for FUSE mounts via `changes/zone` polling
- `ListR` support for `--fast-list` and recursive operations
- `--metadata` support - width, height, added-time, favorite, hidden
- Fresh download URLs per file - no stale URL failures on long copies
- FUSE mount documentation with recommended flags

**Auth improvements over rclone#9209:**
- SMS 2FA fallback for users without trusted Apple devices
- Explicit push notification request - fixes iOS/macOS 26.4+ where 409
  no longer auto-pushes
- Thread safety for concurrent FUSE callers (mutexes on session and client state)
- Session endpoint caching - skips ~5s `/validate` round-trip on warm start
- `Disconnect` support - clears auth state + disk cache
- PCS cookie support for Advanced Data Protection accounts, including
  trusted-device approval for PCS cookies

Built on @coughlanio's Photos PoC (Closes rclone#8734) and @mikegillan's SRP auth (rclone#9209).

Fixes rclone#7982
Co-authored-by: Chris Coughlan <[email protected]>
These don't get updated by `go get` and were missed until recently. It
turns out `github.com/jlaffaye/ftp` was the only one that needed
updating.
Bump go-proton-api and Proton-API-Bridge to versions that send the new
NameSignatureEmail field and omit NodePassphraseSignature/SignatureEmail
for ordinary nodes, matching the schema accepted by the Proton Drive
API. Without this rclone moveto, --backup-dir, server-side rename and
DirMove all failed with "value cannot be empty" / "outdated app" 422.

Fixes rclone#8512
next_page is not currently being returned on listings which is causing
the rclone listing code to go wrong. This was returned so is likely a
regression in Drime.

This changes the page counter to calculate using current_page and
last_page. last_page on the first page request is just current_page+1.
drime appears to be capping per_page to 200. as more pages are
requested, last_page increments by 1 until current_page = last_page
…e builds

Previously `make fetch-gui` extracted the GUI release into cmd/gui/dist/
and the unpacked tree was embedded uncompressed via `//go:embed dist`.

This commits and embeds the GUI bundle (dist.zip) and its release tag
(dist.tag) to the repo so:

- the rclone binary is smaller
- `go build` works on a fresh clone without first running fetch-gui
- a given commit pins an exact GUI version

The "Fetch GUI" step was removed from .github/workflows/build.yml.
Add Huawei Drive backend implementation and tests

Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Nick Craig-Wood <[email protected]>
The S3 ListObjects response from `rclone serve s3` was sorting object
contents by modification time instead of object key. This made the
listing order incompatible with S3 clients which expect lexicographic
key ordering.

In particular, `aws s3 sync` assumes both source and destination
iterators are ordered by key. With the old modtime ordering it could
misidentify files as missing or outdated and re-download objects that
were already up to date.

Change the pager to sort returned objects by key and add a regression
test which uses keys and modtimes arranged so the old behaviour would
fail.

Fixes rclone#9002
Merge rclone/rclone master into timerring/region-icloud-8257 to resolve
PR rclone#8818 conflicts. Adapts the region feature to the current master
codebase without reverting any existing functionality.

Key conflict resolutions:
- iclouddrive.go: removed duplicate init()/Config() that moved to icloud.go;
  removed duplicate NewFs logic that moved to newICloudClient(); kept
  NFC normalization, Disconnecter, and m configmap.Mapper from master
- icloud.go: added configRegion constant and region option registration;
  added region-aware endpoint switching in Config() and newICloudClient()
- api/client.go: added homeEndpoint variable alongside existing ones;
  UseChinaMainlandEndpoints() switches all 4 endpoints including homeEndpoint
- docs: region option appears in config example and auto-generated docs

Fixes rclone#8257
@xz-dev

xz-dev commented May 3, 2026 •

Copy link
Copy Markdown
Author

Transparency Note

This PR was AI-assisted (using Claude/opencode). Because the merge involves many changes across the codebase, I want to be transparent about what was actually tested:

  • Only this merge commit (531a5664f) was build-tested and unit-tested
  • The original 2 commits from your region-icloud-8257 branch were not re-tested after merge
  • Specifically: make rclone, make backenddocs, and go test ./backend/iclouddrive/... all pass on the merged result
  • But I do not have a China Mainland iCloud account to do end-to-end integration testing of the region switching feature

If you'd like, I can also close this PR and instead provide the conflict resolution as a patch/script for you to apply directly on your branch — that way your commit history stays clean and you maintain full authorship of the resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.