[Midnightbsd-cvs] [MidnightBSD/mports] 4b6f0c: Mk/scripts/do-fetch.sh: diagnose duplicated distin...

Lucas Holt noreply at github.com
Fri Aug 21 20:56:37 EDT 2026


  Branch: refs/heads/mk/do-fetch-cksize
  Home:   https://github.com/MidnightBSD/mports
  Commit: 4b6f0c769d3419282e25121bca13223d92911b22
      https://github.com/MidnightBSD/mports/commit/4b6f0c769d3419282e25121bca13223d92911b22
  Author: Lucas Holt <luke at foolishgames.com>
  Date:   2026-08-21 (Fri, 21 Aug 2026)

  Changed paths:
    M Mk/scripts/do-fetch.sh

  Log Message:
  -----------
  Mk/scripts/do-fetch.sh: diagnose duplicated distinfo entries

distinfo_data() prints one line per matching entry, so a distfile listed
twice in distinfo makes CKSIZE two values instead of one:

    CKSIZE=$(distinfo_data SIZE "${full_file}")   -> "117326728 117326728"

CKSIZE is interpolated unquoted into "-S ${CKSIZE}", so it word-splits into
fetch(1)'s argument list and the second value is taken as an extra URL. The
result is a failure on every mirror with an error that points nowhere near
the real problem:

    fetch: 117326728: No such file or directory
    fetch: rust/crates/Inflector-0.11.4.crate is not a directory
    => Couldn't fetch it - please try to retrieve this port manually

The size comparison further down breaks the same way, because
[ "${actual_size}" -eq "${CKSIZE}" ] gets too many arguments, so even a
completed download is discarded as a size mismatch.

Validate CKSIZE before it reaches the command line and report the actual
cause instead:

    => Invalid SIZE for zipmix_src.zip in .../distinfo.
    => Expected a single integer, got: 4759 4759
    => The entry is most likely present more than once.

The check sits inside the existing "-z dp_DISABLE_SIZE" guard, so makesum,
which runs with DISABLE_SIZE=yes and NO_CHECKSUM=yes, is unaffected and
remains usable to regenerate a duplicated distinfo.

Not changed: checksum.sh iterates "for chksum in $CKSUM" deliberately to
allow several recorded checksums, and the _sha256sum lookup here is only
tested for emptiness. Neither is affected by duplicates.

Tested with archivers/zipmix against a scratch DISTDIR: clean distinfo
fetches normally, a duplicated one now reports the message above instead of
"Couldn't fetch it", and makesum still rewrites a duplicated distinfo
correctly.

AI-Assisted-by: Claude Opus 5 <noreply at anthropic.com>
Signed-off-by: Lucas Holt <luke at foolishgames.com>



To unsubscribe from these emails, change your notification settings at https://github.com/MidnightBSD/mports/settings/notifications


More information about the Midnightbsd-cvs mailing list