commit:     e0b583e63f9c846d1c99359f7f3940e3b209fcf6
Author:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 11 21:53:42 2025 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Sat Jan 11 21:56:55 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e0b583e6

sys-apps/dcfldd: Add simple test to detect miscompilation

Closes: https://bugs.gentoo.org/947030
Suggested-by: Sam James <sam <AT> gentoo.org>
Signed-off-by: Sebastian Pipping <sping <AT> gentoo.org>

 sys-apps/dcfldd/dcfldd-1.9.2-r1.ebuild | 53 ++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/sys-apps/dcfldd/dcfldd-1.9.2-r1.ebuild 
b/sys-apps/dcfldd/dcfldd-1.9.2-r1.ebuild
new file mode 100644
index 000000000000..9ed9f564a117
--- /dev/null
+++ b/sys-apps/dcfldd/dcfldd-1.9.2-r1.ebuild
@@ -0,0 +1,53 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+inherit autotools bash-completion-r1
+
+DESCRIPTION="enhanced dd with features for forensics and security"
+HOMEPAGE="https://github.com/resurrecting-open-source-projects/dcfldd";
+SRC_URI="https://github.com/resurrecting-open-source-projects/${PN}/archive/v${PV}.tar.gz
 -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~riscv ~x86"
+
+DEPEND="virtual/pkgconfig"
+
+DOCS=(
+       AUTHORS
+       CONTRIBUTING.md
+       ChangeLog
+       NEWS
+       README.md
+)
+
+src_prepare() {
+       default
+       eautoreconf
+}
+
+src_configure() {
+       econf --with-bash-completion
+}
+
+src_install() {
+       default
+
+       # Fix Bash completion filename
+       mv "${D}$(get_bashcompdir)"/dcfldd{-bash_completion,} || die
+}
+
+src_test() {
+       # Just in case upstream add tests in future
+       default
+
+       # Smoke test for Gentoo bug #930996
+       # Inspired by https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114698#c0
+       expected_sha256sum="$(sha256sum <<<TestInput | awk '{print $1}' \
+               | tee /dev/stderr)"
+       actual_sha256sum="$(dcfldd hash=sha256 2>&1 <<<TestInput \
+               | grep -F sha256 | awk '{print $3}' | tee /dev/stderr)"
+       [[ ${actual_sha256sum} = ${expected_sha256sum} ]] \
+               || die "dcfldd did not produce the expected SHA256 sum."
+}

Reply via email to