Skip to content

makepkg corrupts .NET self-contained/ single-file applications in pacman 6.1.0-3

Greetings,

in pacman 6.1.0-3, makepkg corrupts .NET 8.0 self-contained/ single-file applications.

The compiled file present in the final .pkg.tar.zst is much smaller than the original one, and it appears that makepkg strips-away parts of the dotnet application.

Minimal reproduction of the issue

The issue can be re-produced by creating a minimal .NET console application (with dotnet-sdk installed), publishing it as a self-contained sile-file application, packing it as a .tar.gz, and creating a package:

#Install .NET SDK
sudo pacman -S dotnet-sdk

#Create console application
mkdir PacmanRepro
cd PacmanRepro
dotnet new console

#Publish self-contained single-file application and pack
dotnet publish . --output Publish/ --configuration Release --self-contained true -p:PublishSingleFile=true
pushd Publish/
tar -czf ../pacman-repro.tar.gz .
popd

#Create minimal PKGBUILD
tee PKGBUILD >/dev/null << __EOF__
pkgname="pacman-repro"
pkgver="1.0.0"
pkgrel="1"
arch=("x86_64")
options=("!strip")
source=("pacman-repro.tar.gz")
sha512sums=("SKIP")

package()
{
	rm \${srcdir}/\$source

	mkdir -p \${pkgdir}/opt/pacman-repro/
	cp -r \${srcdir}/* \${pkgdir}/opt/pacman-repro/
}
__EOF__

#Create package
makepkg -dsc CARCH="x86_64" Version="1.0.0"

Note: since these single-file applications contain dependencies such as the framework, it is necessary to specify the option options=("!strip") in PKGBUILD.

Observations

  • The /opt/pacman-repro/PacmanRepro file in the .pkg.tar.zst is much smaller than the one in pacman-repro.tar.gz, despite the !strip option
  • Running the same with pacman 6.0.2-9 does not corrupt the file
  • Specifying the options options=("!strip" "!debug") in PKGBUILD also does not corrupt the file, it looks like with the default debug enabled, the file is actually stripped even with !strip specified

PS: for easier repro without having to install .NET, please find attached a pre-compiled pacman-repro.tar.gz here, so that the first few steps above can be skipped.

Keep up the great work and all the best

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information