There is definitely a bug in yay.
It’s not regarding your use case, that’s normal: if you already have the current, up to date version of the PKGBUILD in your yay cache, there is no need to download it. You get this when you download packages and then stop the update process.
But here is an example where it doesn’t do that, yet the diffs are wrong. I just updated librewolf and I got this:
:: 1 Packages to upgrade/install.
1 aur/librewolf-bin 112.0-1 -> 112.0.1-2
==> Packages to exclude: (eg: "1 2 3", "1-3", "^4" or repo name)
-> Excluding packages may cause partial upgrades and break systems
==>
AUR Explicit (1): librewolf-bin-112.0.1-2
:: (1/1) Downloaded PKGBUILD: librewolf-bin
1 librewolf-bin (Build Files Exist)
==> Packages to cleanBuild?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==>
1 librewolf-bin (Build Files Exist)
==> Diffs to show?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> a
looks good so far, but when I view the diffs, it prints out everything with +:
diff --git /home/kresimir/.cache/yay/librewolf-bin/PKGBUILD /home/kresimir/.cache/yay/librewolf-bin/PKGBUILD
new file mode 100644
index 0000000..d2390ad
--- /dev/null
+++ /home/kresimir/.cache/yay/librewolf-bin/PKGBUILD
@@ -0,0 +1,115 @@
+# Maintainer: lsf <lsf at pfho dot net>
+
+pkgname=librewolf-bin
+provides=(${pkgname//-bin/""})
+pkgrel=2
+pkgdesc="Community-maintained fork of Firefox, focused on privacy, security and freedom."
+arch=(x86_64 aarch64)
+license=(MPL GPL LGPL)
+url="https://librewolf-community.gitlab.io/"
+depends=(gtk3 libxt startup-notification mime-types dbus-glib
+ nss ttf-font libpulse ffmpeg)
+makedepends=(git)
+optdepends=(
+ 'hunspell-en_US: Spell checking, American English'
+ 'libnotify: Notification integration'
+ 'networkmanager: Location detection via available WiFi networks'
+ 'pulseaudio: Audio support'
+ 'speech-dispatcher: Text-to-Speech'
+ 'xdg-desktop-portal: Screensharing with Wayland'
+)
+validpgpkeys=('662E3CDD6FE329002D0CA5BB40339DD82B12EF16') # librewolf maintainers
+backup=('usr/lib/librewolf/librewolf.cfg'
+ 'usr/lib/librewolf/distribution/policies.json')
+options=(!emptydirs)
+install='librewolf-bin.install'
+
+_project_id=44042130
+_base_url=https://gitlab.com/api/v4/projects/${_project_id}/packages/generic/${pkgname//-bin/""}/${pkgver}-${pkgrel}
+_uploadpath_aarch64=${_base_url}/${pkgname//-bin/""}-${pkgver}-${pkgrel}-linux-arm64-package.tar.bz2
+_uploadpath_x86_64=${_base_url}/${pkgname//-bin/""}-${pkgver}-${pkgrel}-linux-x86_64-package.tar.bz2
+_uploadpath_sig_aarch64=${_uploadpath_aarch64}.sig
+_uploadpath_sig_x86_64=${_uploadpath_x86_64}.sig
+_source_tag="${pkgver}-${pkgrel}"
+source=(
+ "git+https://gitlab.com/${pkgname//-bin/""}-community/browser/source.git#tag=${_source_tag}"
+source=(
+ "git+https://gitlab.com/${pkgname//-bin/""}-community/browser/source.git#tag=${_source_tag}"
+ default192x192.png
+ librewolf.desktop
+)
+# source_aarch64=("${_uploadpath_aarch64}" "${_uploadpath_sig_aarch64}")
+# source_x86_64=("${_uploadpath_x86_64}" "${_uploadpath_sig_x86_64}")
+source_aarch64=("https://gitlab.com/librewolf-community/browser/bsys6/-/jobs/4139609098/artifacts/raw/librewolf-112.0.1-2-linux-arm64-package.tar.bz2")
+source_x86_64=("https://gitlab.com/librewolf-community/browser/bsys6/-/jobs/4139609097/artifacts/raw/librewolf-112.0.1-2-linux-x86_64-package.tar.bz2")
+sha256sums=('SKIP'
+ '959c94c68cab8d5a8cff185ddf4dca92e84c18dccc6dc7c8fe11c78549cdc2f1'
+ '21054a5f41f38a017f3e1050ccc433d8e59304864021bef6b99f0d0642ccbe93')
+sha256sums_x86_64=('66d7f94c3c5b1db62784e2156b18e9104f2f4c605ba5b29d22d87c87f41ffc68')
+sha256sums_aarch64=('c074aa32f2124c394cbe5dc9adfd39d1185d81634dd5f540f8742858ecc2f7c1')
+
+package() {
+ # Yep, that's somewhat redundant. But it works.
+ install -dm 755 ${pkgdir}/usr/lib/librewolf
+ install -dm 755 ${pkgdir}/usr/bin
+ cp -r "${srcdir}"/${pkgname//-bin/""}/* "${pkgdir}"/usr/lib/librewolf
+
etc… etc…
It is as if the package was cleanly installed.