release: 0.4.15 — HEAD-fallback download cache + os.dirs glob fix#265
Merged
Conversation
Two user-visible bug fixes that compound: package recipes that omit
sha256 (~8% of fixture index, more in real index for `_linux_url`-style
helpers) were re-downloading their entire payload on every install; and
on POSIX `os.dirs("…/v*")` silently returned an empty list because the
shim quoted the pattern, suppressing shell glob expansion.
- src/core/xim/downloader.cppm
- Cache hit path now has two arms. Path 1 (sha256 verified) unchanged
except it now `fs::remove`s the stale file before falling through —
defends against a future tinyhttps Range/resume mode reusing partial
bytes from a different version.
- Path 2 (NEW): when `task.sha256` is empty, HEAD-probe the URL and
compare the local file size to `Content-Length`. Cross-check
`Last-Modified` / `ETag` against a sidecar (`<destFile>.meta`) we
write after the previous download. Match → skip download. HEAD
failure (offline, server blocks HEAD, 4xx) → trust an existing
non-empty file rather than wasting bandwidth.
- After a successful no-sha256 download, persist server-reported
Last-Modified / ETag to the sidecar so the next install has
something to compare against.
- src/libs/tinyhttps.cppm
- New `RemoteFileMeta { contentLength, lastModified, etag, ok, ... }`
+ `query_remote_meta()` returning all three header fields from one
HEAD round-trip. `query_content_length()` reduces to a thin wrapper.
- tests/unit/test_main.cpp::XimDownloaderTest::MetaSidecarRoundTrip
- Locks down the sidecar format (round-trip, missing-file, malformed
line tolerance).
- xmake.lua / src/core/config.cppm / changelog
- Bump mcpplibs-xpkg 0.0.37 → 0.0.38 (libxpkg #15 — `os.dirs` glob fix
as described above).
- VERSION 0.4.14 → 0.4.15.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two compounding download-cache bugs the user reported as "最近感觉好像有问题".
fs::exists(destFile) && !task.sha256.empty()— recipes that declareurlbut nosha256(about 8% of fixture pkgindex; more in the real index where_linux_url(version)helpers synthesize URLs without a matching hash) re-fetched the entire payload on everyxlings install.os.dirs("…/v*")returned empty on POSIX. The libxpkg shim shelled out asls -d "<pattern>" 2>/dev/null— the surrounding double quotes made the shell skip glob expansion, soos.dirs("/tmp/x/cuda_v*")looked for a file literally namedcuda_v*. Fixed in libxpkg 增加一个exec命令 用于执行命令 或 应用程序 #15 / v0.0.38, brought in via the dep bump below.Changes
Download cache (xlings)
src/core/xim/downloader.cppm:fs::removethe stale file before falling through, so a future tinyhttps Range/resume mode can't splice old bytes onto new content.Content-Length, cross-checkLast-Modified/ETagagainst a<destFile>.metasidecar we write after each download. Match → skip. HEAD failure → trust the existing non-empty file rather than wasting bandwidth (airline-friendly).Last-Modified/ETagto the sidecar so the next install has something to compare against.src/libs/tinyhttps.cppm:RemoteFileMeta { contentLength, lastModified, etag, ok, statusCode, error }+query_remote_meta()returning all three header fields from one HEAD.query_content_length()reduces to a thin wrapper (same semantics, no API break).tests/unit/test_main.cpp::XimDownloaderTest::MetaSidecarRoundTrip:Dep bump
xmake.lua:mcpplibs-xpkg 0.0.37→0.0.38.mcpplibs/mcpplibs-index#8is already merged with the new sha256 entry.Behavior comparison
Test plan
xmake build xlings_testsclean (mcpplibs-xpkg 0.0.38 resolves)xmake run xlings_tests— 216/220 pass, 4 pre-existing skipsXimDownloaderTest::MetaSidecarRoundTripexercises the parser/writeros.dirsfix:ls -d /tmp/x/cuda_v*now globs, escaped-space/tmp/x\ space/cuda_v*still resolvesRelated