Commit Diff
- Commit:
046f76c30e642757d0d52b64eabd263c7c206fec
- From:
- Stefan Sperling <stsp@stsp.name>
- Via:
- Thomas Adam <thomas@xteddy.org>
- Date:
- Message:
- fix gotd sometimes reading reused deltas from wrong pack file The reuse-pack is pinned but may change its cache slot while objects are being deltified. Refresh the pointer to the pinned reuse-pack before writing out the pack file, ensuring that reused deltas will in fact be read from the reuse-pack and not some other pack. Otherwise gotd may send a broken pack file, or hit an ERR_RANGE condition if the pack file which now occupies the pinned-pack's old cache slot is shorter. Which can trigger attempts to read beyond end-of-file which show up in the logs like this: gotd[37311]: repo_read /var/git/got.git: sending packfile: value out of range gotd[43877]: uid 1002: value out of range gotd[43877]: uid 1002: disconnecting
- Actions:
- Patch | Tree
--- lib/pack_create.c +++ lib/pack_create.c @@ -1932,6 +1932,9 @@ got_pack_create(uint8_t *packsha1, int packfd, FILE *d goto done; } + /* Pinned pack may have moved to different cache slot. */ + reuse_pack = got_repo_get_pinned_pack(repo); + err = genpack(packsha1, packfd, reuse_pack, delta_cache, deltify.meta, deltify.nmeta, reuse.meta, reuse.nmeta, ncolored, nfound, ntrees, nours, repo, force_refdelta, progress_cb, progress_arg, rl,