Affected Version
yay v13.0.1 - libalpm v16.0.1
Also present on next at 328f4b4939fb35f38c2f7c7ce3b8638a839bafa5.
Describe the bug
--redownload (and equivalently "redownload": "yes" in the config) is silently ignored.
It behaves exactly like --noredownload / "redownload": "no".
func (preper *Preparer) needToCloneAURBase(installInfo *dep.InstallInfo, pkgbuildDir string) bool {
if preper.cfg.ReDownload == "all" {
return true
}
srcinfoFile := filepath.Join(pkgbuildDir, ".SRCINFO")
if pkgbuild, err := gosrc.ParseFile(srcinfoFile); err == nil {
if db.VerCmp(pkgbuild.Version(), installInfo.Version) >= 0 {
preper.log.OperationInfoln(
gotext.Get("PKGBUILD up to date, skipping download: %s",
text.Cyan(installInfo.AURBase)))
return false
}
}
return true
}
Only "all" is special-cased.
The "yes" value set by --redownload falls through to the same .SRCINFO version comparison as "no", so the two values are indistinguishable at runtime.
When needToCloneAURBase returns false the pkgbase is never added to aurBasesToClone, so download.AURPKGBUILDRepos is never asked for it and the cached repo is not refreshed at all.
The stale cached PKGBUILD is then used for the build.
This contradicts the documented behaviour:
--redownload
Always download pkgbuilds of targets even when a copy is available in cache.
Reproduction Steps
- Install any AUR package so that its repo is cached in
BuildDir, and let its .SRCINFO be at a version equal to or newer than what yay resolves.
- Change the upstream PKGBUILD without a
pkgver/pkgrel bump, or simply modify the cached PKGBUILD locally to make a refresh observable.
- Run
yay -S --redownload <pkg>.
Observed: yay prints :: PKGBUILD up to date, skipping download: <pkgbase> and the cached build directory is left untouched. Identical to running with --noredownload.
Expected: the PKGBUILD for the target is fetched again regardless of the version comparison.
--redownloadall on the same package does force the refresh, which is the workaround, at the cost of also refreshing every AUR dependency.
Expected behavior
--redownload should always refresh the PKGBUILDs of the targets named on the command line, while leaving non-target AUR dependencies subject to the up-to-date check. That is the behaviour the man page describes, and the behaviour the flag had historically.
Regression history
The three-state semantics were introduced in a6cab60 and implemented as:
if config.ReDownload == "no" || (config.ReDownload == "yes" && !targets.get(pkg.Name)) {
// skip if cached copy is up to date
}
needToCloneAURBase was added for the new engine in 6ad63ca and never handled "yes".
At that point the legacy engine still implemented it correctly in pkgbuildsToSkip:
if (cfg.ReDownload == "yes" && isTarget) || cfg.ReDownload == "all" {
continue
}
e28319f removed the legacy engine and with it the last remaining "yes" handling.
So --redownload has been inert since v12.1.0.
Affected Version
yay v13.0.1 - libalpm v16.0.1
Also present on
nextat328f4b4939fb35f38c2f7c7ce3b8638a839bafa5.Describe the bug
--redownload(and equivalently"redownload": "yes"in the config) is silently ignored.It behaves exactly like
--noredownload/"redownload": "no".Only
"all"is special-cased.The
"yes"value set by--redownloadfalls through to the same.SRCINFOversion comparison as"no", so the two values are indistinguishable at runtime.When
needToCloneAURBasereturns false the pkgbase is never added toaurBasesToClone, sodownload.AURPKGBUILDReposis never asked for it and the cached repo is not refreshed at all.The stale cached PKGBUILD is then used for the build.
This contradicts the documented behaviour:
Reproduction Steps
BuildDir, and let its.SRCINFObe at a version equal to or newer than what yay resolves.pkgver/pkgrelbump, or simply modify the cached PKGBUILD locally to make a refresh observable.yay -S --redownload <pkg>.Observed: yay prints
:: PKGBUILD up to date, skipping download: <pkgbase>and the cached build directory is left untouched. Identical to running with--noredownload.Expected: the PKGBUILD for the target is fetched again regardless of the version comparison.
--redownloadallon the same package does force the refresh, which is the workaround, at the cost of also refreshing every AUR dependency.Expected behavior
--redownloadshould always refresh the PKGBUILDs of the targets named on the command line, while leaving non-target AUR dependencies subject to the up-to-date check. That is the behaviour the man page describes, and the behaviour the flag had historically.Regression history
The three-state semantics were introduced in a6cab60 and implemented as:
needToCloneAURBasewas added for the new engine in 6ad63ca and never handled"yes".At that point the legacy engine still implemented it correctly in
pkgbuildsToSkip:e28319f removed the legacy engine and with it the last remaining
"yes"handling.So
--redownloadhas been inert since v12.1.0.