app-forensics/scalpel: bump to github snapshot 2.1_pre20210326 version

new HOMEPAGE and SRC_URI
update LICENSE
add gcc-11 and clang fixes
add fix for use with musl libc
adopt proxy maintainership

Closes: https://bugs.gentoo.org/520252
Closes: https://bugs.gentoo.org/716104
Signed-off-by: Martin Dummer <martin.dummer@gmx.net>
Closes: https://github.com/gentoo/gentoo/pull/26190
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
This commit is contained in:
Martin Dummer
2022-01-18 23:13:50 +01:00
committed by Joonas Niilola
parent 1608835879
commit ba215a5ebd
5 changed files with 401 additions and 11 deletions

View File

@@ -1 +1,2 @@
DIST scalpel-2.0.tar.gz 1436379 BLAKE2B 7a645c1d6ea32fbd1b0bcfcbfa0f704b6eb58ebe091b8a7ef89f59756c18ce9937849f9754f6ab8548c805e3503f9eb3cc58a2f835956a1315668db5ce19c41f SHA512 7bf8e36f2fd22eb34e0f454c44a3ec3bc4e61dfd44ecda6ae93f0cc41cc3ad2b9fd9604637329bb96274a606812a578c968dd435d9d4a3ac5533613c849d321a
DIST scalpel-2.1_pre20210326.tar.gz 1445147 BLAKE2B f70e16d6854c6f781c2ec389b4595e25055bedc5c69b4c0713ae263d138f0bd9824641099e224cd1969688f6b0acb07c707072afe43955c8752391132eb9b84e SHA512 76811437f01125dcdb27e185ad4f82ba589461eb47638a32af4291b0b81803180e095ccf89440d6c50e35e641e9c3eed63d6ffb33715b5ebe0a3a73389c25e5f

View File

@@ -0,0 +1,255 @@
fix "invalid suffix on literal; C++11 requires a space between literal and string macro"
--- a/src/dig.cpp
+++ b/src/dig.cpp
@@ -378,10 +378,10 @@
if(state->skip) {
- fprintf(state->auditFile, "\nSkipped the first %"PRIu64 "bytes of %s...\n",
+ fprintf(state->auditFile, "\nSkipped the first %" PRIu64 "bytes of %s...\n",
state->skip, scalpelInputGetId(state->inReader));
if(state->modeVerbose) {
- fprintf(stdout, "\nSkipped the first %"PRIu64 "bytes of %s...\n",
+ fprintf(stdout, "\nSkipped the first %" PRIu64 "bytes of %s...\n",
state->skip, scalpelInputGetId(state->inReader));
}
}
@@ -448,7 +448,7 @@
// found a header--record location in header offsets database
if(state->modeVerbose) {
- fprintf(stdout, "A %s header was found at : %"PRIu64 "\n",
+ fprintf(stdout, "A %s header was found at : %" PRIu64 "\n",
currentneedle->suffix,
positionUseCoverageBlockmap(state, startLocation));
@@ -478,7 +478,7 @@
if(state->modeVerbose) {
fprintf(stdout,
- "Memory reallocation performed, total header storage = %"PRIu64 "\n",
+ "Memory reallocation performed, total header storage = %" PRIu64 "\n",
currentneedle->offsets.headerstorage);
}
}
@@ -494,7 +494,7 @@
// found a footer--record location in footer offsets database
if(state->modeVerbose) {
- fprintf(stdout, "A %s footer was found at : %"PRIu64 "\n",
+ fprintf(stdout, "A %s footer was found at : %" PRIu64 "\n",
currentneedle->suffix,
positionUseCoverageBlockmap(state, startLocation));
@@ -524,7 +524,7 @@
if(state->modeVerbose) {
fprintf(stdout,
- "Memory reallocation performed, total footer storage = %"PRIu64 "\n",
+ "Memory reallocation performed, total footer storage = %" PRIu64 "\n",
currentneedle->offsets.footerstorage);
}
}
@@ -618,7 +618,7 @@
// found a header--record location in header offsets database
if(state->modeVerbose) {
- fprintf(stdout, "A %s header was found at : %"PRIu64 "\n",
+ fprintf(stdout, "A %s header was found at : %" PRIu64 "\n",
currentneedle->suffix,
positionUseCoverageBlockmap(state, startLocation));
}
@@ -647,7 +647,7 @@
if(state->modeVerbose) {
fprintf(stdout,
- "Memory reallocation performed, total header storage = %"PRIu64 "\n",
+ "Memory reallocation performed, total header storage = %" PRIu64 "\n",
currentneedle->offsets.headerstorage);
}
@@ -756,7 +756,7 @@
startLocation = offset + (foundat[needlenum][i] - readbuffer);
if(state->modeVerbose) {
- fprintf(stdout, "A %s footer was found at : %"PRIu64 "\n",
+ fprintf(stdout, "A %s footer was found at : %" PRIu64 "\n",
currentneedle->suffix,
positionUseCoverageBlockmap(state, startLocation));
}
@@ -784,7 +784,7 @@
if(state->modeVerbose) {
fprintf(stdout,
- "Memory reallocation performed, total footer storage = %"PRIu64 "\n",
+ "Memory reallocation performed, total footer storage = %" PRIu64 "\n",
currentneedle->offsets.footerstorage);
}
}
@@ -991,7 +991,7 @@
state->inReader)) > longestneedle - 1) {
if(state->modeVerbose) {
- fprintf(stdout, "Read %"PRIu64 " bytes from image file.\n", bytesread);
+ fprintf(stdout, "Read %" PRIu64 " bytes from image file.\n", bytesread);
}
if((err = scalpelInputGetError(state->inReader))) {
@@ -1106,7 +1106,7 @@
if(state->modeVerbose) {
- fprintf(stdout, "Total file size is %"PRIu64 " bytes\n", filesize);
+ fprintf(stdout, "Total file size is %" PRIu64 " bytes\n", filesize);
}
@@ -1537,7 +1537,7 @@
fprintf(stdout, "%s", currentneedle->endtext);
}
- fprintf(stdout, "\" --> %"PRIu64 " files\n", currentneedle->numfilestocarve);
+ fprintf(stdout, "\" --> %" PRIu64 " files\n", currentneedle->numfilestocarve);
}
@@ -1915,7 +1915,7 @@
(unsigned long
long)(ceil((double)filesize / (double)state->coverageblocksize));
- fprintf(stdout, "# of blocks in coverage blockmap is %"PRIu64 ".\n",
+ fprintf(stdout, "# of blocks in coverage blockmap is %" PRIu64 ".\n",
state->coveragenumblocks);
@@ -1970,7 +1970,7 @@
(unsigned long long)ceil((double)filesize /
(double)state->coverageblocksize);
- fprintf(stdout, "# of blocks in coverage blockmap is %"PRIu64 ".\n",
+ fprintf(stdout, "# of blocks in coverage blockmap is %" PRIu64 ".\n",
state->coveragenumblocks);
fprintf(stdout, "Allocating and clearing in-core coverage bitmap.\n");
@@ -2374,7 +2374,7 @@
if(state->modeVerbose && state->useCoverageBlockmap) {
fprintf(stdout,
- "Coverage map decreased current file position by %"PRIu64 " bytes.\n",
+ "Coverage map decreased current file position by %" PRIu64 " bytes.\n",
(unsigned long long)decrease);
}
}
@@ -2399,7 +2399,7 @@
if(state->useCoverageBlockmap) {
if(state->modeVerbose) {
fprintf(stdout,
- "Issuing coverage map-based READ, wants %"PRIu64 " bytes.\n",
+ "Issuing coverage map-based READ, wants %" PRIu64 " bytes.\n",
neededbytes);
}
@@ -2425,7 +2425,7 @@
if(state->modeVerbose) {
fprintf(stdout,
- "fread using coverage map to skip %"PRIu64 " bytes.\n", bytestoskip);
+ "fread using coverage map to skip %" PRIu64 " bytes.\n", bytestoskip);
}
scalpelInputSeeko(inReader, (off64_t) bytestoskip, SCALPEL_SEEK_CUR);
@@ -2450,7 +2450,7 @@
if(state->modeVerbose) {
fprintf(stdout,
- "fread using coverage map found %"PRIu64 " consecutive bytes.\n",
+ "fread using coverage map found %" PRIu64 " consecutive bytes.\n",
bytestoread);
}
@@ -2465,7 +2465,7 @@
curpos += bytestoread;
if(state->modeVerbose) {
- fprintf(stdout, "fread using coverage map read %"PRIu64 " bytes.\n",
+ fprintf(stdout, "fread using coverage map read %" PRIu64 " bytes.\n",
bytesread);
}
}
@@ -2879,7 +2879,7 @@
}
// # of headers
- if(fprintf(dbfile, "%"PRIu64 "\n", currentneedle->offsets.numheaders)
+ if(fprintf(dbfile, "%" PRIu64 "\n", currentneedle->offsets.numheaders)
<= 0) {
fprintf(stderr,
@@ -2893,7 +2893,7 @@
for(i = 0; i < currentneedle->offsets.numheaders; i++) {
#ifdef _WIN32
if(fprintf
- (dbfile, "%"PRIu64 "\n",
+ (dbfile, "%" PRIu64 "\n",
positionUseCoverageBlockmap(state,
currentneedle->offsets.
headers[i])) <= 0) {
@@ -2913,7 +2913,7 @@
}
// # of footers
- if(fprintf(dbfile, "%"PRIu64 "\n", currentneedle->offsets.numfooters)
+ if(fprintf(dbfile, "%" PRIu64 "\n", currentneedle->offsets.numfooters)
<= 0) {
fprintf(stderr,
"Error writing to header/footer database file: %s\n", fn);
@@ -2925,7 +2925,7 @@
// all footer positions for current suffix
for(i = 0; i < currentneedle->offsets.numfooters; i++) {
if(fprintf
- (dbfile, "%"PRIu64 "\n",
+ (dbfile, "%" PRIu64 "\n",
positionUseCoverageBlockmap(state,
currentneedle->offsets.
footers[i])) <= 0) {
--- a/src/helpers.cpp
+++ b/src/helpers.cpp
@@ -528,7 +528,7 @@
if((scalpelInputSeeko(inReader, state->skip, SCALPEL_SEEK_SET))) {
fprintf(stderr,
- "ERROR: Couldn't skip %"PRIu64 " bytes at the start of input file %s\n",
+ "ERROR: Couldn't skip %" PRIu64 " bytes at the start of input file %s\n",
state->skip, inputId);
@@ -543,7 +543,7 @@
}
else {
- fprintf(stderr, "\nSkipped the first %"PRIu64 " bytes of %s...\n",
+ fprintf(stderr, "\nSkipped the first %" PRIu64 " bytes of %s...\n",
state->skip, inputId);
--- a/src/scalpel_exec.cpp
+++ b/src/scalpel_exec.cpp
@@ -141,7 +141,7 @@
}
fprintf(stdout,
- "\nScalpel is done, files carved = %"PRIu64 ", elapsed = %ld secs.\n",
+ "\nScalpel is done, files carved = %" PRIu64 ", elapsed = %ld secs.\n",
state.fileswritten, (int)time(0) - starttime);
destroy_threading_model(&state);
@@ -348,7 +348,7 @@
numopts++;
state->skip = strtoull(optarg, NULL, 10);
fprintf(stdout,
- "Skipping the first %"PRIu64 " bytes of each image file.\n", state->skip);
+ "Skipping the first %" PRIu64 " bytes of each image file.\n", state->skip);
break;
case 'c':

View File

@@ -0,0 +1,83 @@
https://raw.githubusercontent.com/gentoo/musl/master/dev-libs/elfutils/files/0.178/musl-error_h.patch
From 9cb8fad40329cc6445233af0b6ac3f2adde19c65 Mon Sep 17 00:00:00 2001
From:
Date: Thu, 12 Dec 2019 22:00:47 -0600
Subject: [PATCH 9/9] Add hacked up error header for non GLIBC machines
---
lib/error.h | 27 +++++++++++++++++++++++++++
src/error.h | 27 +++++++++++++++++++++++++++
2 files changed, 54 insertions(+)
create mode 100644 lib/error.h
create mode 100644 src/error.h
diff --git a/lib/error.h b/lib/error.h
new file mode 100644
index 0000000..ef06827
--- /dev/null
+++ b/error.h
@@ -0,0 +1,27 @@
+#ifndef _ERROR_H_
+#define _ERROR_H_
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+static unsigned int error_message_count = 0;
+
+static inline void error(int status, int errnum, const char* format, ...)
+{
+ va_list ap;
+ fprintf(stderr, "%s: ", program_invocation_name);
+ va_start(ap, format);
+ vfprintf(stderr, format, ap);
+ va_end(ap);
+ if (errnum)
+ fprintf(stderr, ": %s", strerror(errnum));
+ fprintf(stderr, "\n");
+ error_message_count++;
+ if (status)
+ exit(status);
+}
+
+#endif /* _ERROR_H_ */
diff --git a/src/error.h b/src/error.h
new file mode 100644
index 0000000..ef06827
--- /dev/null
+++ b/src/error.h
@@ -0,0 +1,27 @@
+#ifndef _ERROR_H_
+#define _ERROR_H_
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+static unsigned int error_message_count = 0;
+
+static inline void error(int status, int errnum, const char* format, ...)
+{
+ va_list ap;
+ fprintf(stderr, "%s: ", program_invocation_name);
+ va_start(ap, format);
+ vfprintf(stderr, format, ap);
+ va_end(ap);
+ if (errnum)
+ fprintf(stderr, ": %s", strerror(errnum));
+ fprintf(stderr, "\n");
+ error_message_count++;
+ if (status)
+ exit(status);
+}
+
+#endif /* _ERROR_H_ */
--
2.24.1

View File

@@ -1,15 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<!-- maintainer-needed -->
<longdescription lang="en">
Scalpel is a fast file carver that reads a database of header and footer
definitions and extracts matching files or data fragments from a set of image
files or raw device files. Scalpel is filesystem-independent and will carve
files from FATx, NTFS, ext2/3, HFS+, or raw partitions. It is useful for both
digital forensics investigation and file recovery.
</longdescription>
<upstream>
<remote-id type="github">sleuthkit/scalpel</remote-id>
</upstream>
<maintainer type="person" proxied="yes">
<email>martin.dummer@gmx.net</email>
<name>Martin Dummer</name>
</maintainer>
<maintainer type="project" proxied="proxy">
<email>proxy-maint@gentoo.org</email>
<name>Proxy Maintainers</name>
</maintainer>
<longdescription lang="en">
Scalpel is a fast file carver that reads a database of header and footer
definitions and extracts matching files or data fragments from a set of image
files or raw device files. Scalpel is filesystem-independent and will carve
files from FATx, NTFS, ext2/3, HFS+, or raw partitions. It is useful for both
digital forensics investigation and file recovery.
</longdescription>
<upstream>
<remote-id type="github">sleuthkit/scalpel</remote-id>
</upstream>
</pkgmetadata>

View File

@@ -0,0 +1,44 @@
# Copyright 2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit autotools
DESCRIPTION="A high performance file carver"
HOMEPAGE="https://github.com/sleuthkit/scalpel"
SCALPEL_COMMIT="35e1367ef2232c0f4883c92ec2839273c821dd39"
SRC_URI="https://github.com/sleuthkit/scalpel/archive/${SCALPEL_COMMIT}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/scalpel-${SCALPEL_COMMIT}"
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64 ~x86"
DEPEND="dev-libs/tre"
RDEPEND="${DEPEND}"
BDEPEND="${DEPEND}"
PATCHES=( "${FILESDIR}/gcc-11-fix-literal-suffix.patch" )
DOCS=( Changelog README )
src_prepare() {
# Set the default config file location
sed -e "s:scalpel.conf:/etc/\0:" -i src/scalpel.h || die "sed failed"
sed -e 's|AM_CPPFLAGS =.*|AM_CPPFLAGS = -std=c++11|' -i Makefile.am src/Makefile.am || die "sed failed"
# #716104 compile with musl misses error.h, solution borrowed from #701478
if use elibc_musl; then
eapply "${FILESDIR}/musl-error_h.patch"
fi
default
eautoreconf
}
src_install() {
default
insinto /etc
doins scalpel.conf
}