flathub / flathub/com.bambulab.BambuStudio
aarch64: all bambustudio:// downloads fail ("File size exception") — libcurl 8 progress-callback ABI mismatch
- Dominant language
- CMake
- Stars
- 21
- Forks
- 4
- Avg merge
- 1h 17m
- Merged PRs (30d)
- 1
Description
Filing here for visibility because the trigger is this package's runtime, though the defect is in upstream source.
## Symptom
On `app/com.bambulab.BambuStudio/aarch64/stable` (2.7.1.62), every `bambustudio://open?file=…` download — i.e. every "Open in Bambu Studio" link from MakerWorld — fails with:
> Download failed; File size exception.
No file is written. Reproducible from a localhost HTTP server with no account, no MakerWorld link and no internet.
## Cause
`src/slic3r/Utils/Http.cpp` selects its libcurl progress callback with:
```cpp
#if LIBCURL_VERSION_MAJOR >= 7 && LIBCURL_VERSION_MINOR >= 32
```
This runtime (`org.gnome.Platform//50`) provides **libcurl 8.15.0**, so it evaluates `8 >= 7` (true) `&& 15 >= 32` (**false**) and compiles the legacy branch — which installs the `curl_off_t`-typed `xfercb` as `CURLOPT_PROGRESSFUNCTION`, an option libcurl invokes with `double` arguments. On AArch64 the doubles arrive in FP registers while the callback reads general-purpose ones, so `dltotal` is garbage, trips the 500 MiB guard in `Plater::import_model_id()`, and cancels the transfer before the destination file is ever opened.
Official x86-64 builds bundle libcurl 7.x, where the guard happens to evaluate correctly — which is why this appears to be unreported.
Full analysis, reproduction and proof: **bambulab/BambuStudio#11790**
## Verified fix
Rewriting the option at runtime (`LD_PRELOAD` shim mapping `CURLOPT_PROGRESSFUNCTION` 20056 → `CURLOPT_XFERINFOFUNCTION` 20219, pairing libcurl's `curl_off_t` convention with the `curl_off_t` callback already being passed) makes downloads complete correctly — verified byte-identical on a localhost file, and confirmed working on real MakerWorld links.
The proper fix is two lines upstream:
```diff
-#if LIBCURL_VERSION_MAJOR >= 7 && LIBCURL_VERSION_MINOR >= 32
+#if LIBCURL_VERSION_NUM >= 0x072000 /* 7.32.0 */
::curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, xfercb);
::curl_easy_setopt(curl, CURLOPT_XFERINFODATA, static_cast(this));
#else
- ::curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, xfercb);
+ ::curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, xfercb_legacy);
::curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, static_cast(this));
#endif
```
If upstream is slow to act, this may be worth carrying as a patch in the manifest — it makes model downloads unusable on this build, and it will affect the x86-64 Flatpak too wherever the leftover register contents happen to be non-zero.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with src/slic3r/Utils/Http.cpp and compare the libcurl version check and progress-callback branches described in the issue. Reproduce a bambustudio:// download against a localhost HTTP server, then verify that the selected callback ABI matches libcurl and that the download completes without the file-size exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp, linux
- Domain
- build-system, desktop, networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100