#1140753 sbuild should check if build-dir exists or if it is a directory

#1140753#5
Date:
2026-06-25 19:08:45 UTC
From:
To:
sbuild has a option --build-dir, or $build_dir in sbuild.conf. It
specifies the output directory for build artifacts. When a to-be-created
directory name is supplied to this argument, it is expected that sbuild
will create the directory, while currently sbuild don't do that and
writes a file with a deb file:

	$ cd `mktemp -d`
	$ apt source --download-only hello
	$ sbuild --build-dir sbuild-artifacts --no-run-lintian --no-run-piuparts --no-run-autopkgtest *.dsc
	(...)
	du: cannot access 'sbuild-artifacts/hello_2.12.3-1.dsc': No such file or directory
	E: read_command failed to execute du
	E: Cannot determine space needed for sbuild-artifacts/hello_2.12.3-1.dsc (du failed):
	(...)
	$ ls -al sbuild-artifacts
	-rw-r--r-- 1 billchenchina billchenchina 77352 Jun 26 03:02 sbuild-artifacts
	$ file sbuild-artifacts
	sbuild-artifacts: Debian binary package (format 2.0), with control.tar.xz , data compression xz
	$ dpkg -I sbuild-artifacts
	 new Debian package, version 2.0.
	 size 77352 bytes: control archive=1976 bytes.
	     779 bytes,    21 lines      control
	    3903 bytes,    53 lines      md5sums
	 Package: hello
	 Version: 2.12.3-1
	 Architecture: amd64
	(...)

Please consider do some checks, create the directory if it does not
exist, before copying build artifacts from chroot to the build-dir.