apt2aptly: use dist-scoped, directory-safe upload directory - #72
apt2aptly: use dist-scoped, directory-safe upload directory#72andrewshadura with Copilot wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Uploading to a shared /api/files/apt2aptly directory caused concurrent
apt2aptly instances (running for different distributions) to interfere
with each other. Fix by using /api/files/apt2aptly-{dist} instead, where
{dist} is the base distribution name with any non-alphanumeric characters
(e.g. /) replaced by - to ensure a valid directory name.
For example, v2022/snapshots/20260129T071258Z becomes
apt2aptly-v2022-snapshots-20260129T071258Z.
Closes: #71
Co-Authored-By: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
50a3f50 to
6ea72cd
Compare
|
I was curious whether or not guarding by component might be useful, so I asked DeepWiki: No: a per-component guard isn't needed, based on how Within a single
So for one The concurrency problem the patch fixes is specifically separate OS processes running for different distributions (e.g., two cron/CI invocations for The only scenario where a per-component split could matter is if two separate |
|
I’m now testing this on a test conversion of Apertis. Seems to work so far for one concurrent instance (so no regressions). |
|
Why not coming up with a name that is unlikely to collide instead of picking the dist? UUIDv7 so you can easily spot old stale folders? Maybe having two instances publishing to same dist works, maybe doesn't, but this surely does not work in that case. |
|
Do we need to run multiple instances uploading the same dist? |
It is just that while we are fixing the issue it seems to be appropriate to fix it generally given it is not much more affort than fixing it partially. Let's fix the our side so at some point we may try to see how the rest of aptly copes with multiple concurrent uploads. |
Concurrent
apt2aptlyruns all uploaded to/api/files/apt2aptly, causing files from different distributions to collide and land in the wrong repos.Changes
apt2aptly/src/main.rs: Replace the hardcoded"apt2aptly"upload directory with a per-distribution name derived frombase_dist(), sanitized to be directory-safe (non-alphanumeric chars except-/_replaced with-).base_dist()is used (rather than the full path which includes/snapshots/…) so snapshot runs for the same dist still share a namespace, while different dists are fully isolated.