git: 8c672e345611 - main - sysutils/bulk_extractor: fix for exiv2 0.28, update → 2.0.3
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 09 Jul 2023 22:09:29 UTC
The branch main has been updated by mandree: URL: https://cgit.FreeBSD.org/ports/commit/?id=8c672e3456117f47aaaf3584405b674f8c34540d commit 8c672e3456117f47aaaf3584405b674f8c34540d Author: Matthias Andree <mandree@FreeBSD.org> AuthorDate: 2023-07-02 10:56:10 +0000 Commit: Matthias Andree <mandree@FreeBSD.org> CommitDate: 2023-07-09 22:08:07 +0000 sysutils/bulk_extractor: fix for exiv2 0.28, update → 2.0.3 Caused by: PR: 272311 --- sysutils/bulk_extractor/Makefile | 5 +- sysutils/bulk_extractor/distinfo | 6 +- ...ch-src_be20__api_dfxml__cpp_src_dfxml__writer.h | 13 +++ .../bulk_extractor/files/patch-src_scan__exiv2.cpp | 125 +++++++++++++++++++++ 4 files changed, 144 insertions(+), 5 deletions(-) diff --git a/sysutils/bulk_extractor/Makefile b/sysutils/bulk_extractor/Makefile index 0ca940a5cbb1..000a3125a478 100644 --- a/sysutils/bulk_extractor/Makefile +++ b/sysutils/bulk_extractor/Makefile @@ -1,7 +1,6 @@ PORTNAME= bulk_extractor -PORTVERSION= 2.0.0 +PORTVERSION= 2.0.3 DISTVERSIONPREFIX= v -PORTREVISION= 4 CATEGORIES= sysutils MAINTAINER= nobutaka@FreeBSD.org @@ -37,6 +36,8 @@ CXXFLAGS_powerpc= -DBIG_ENDIAN CXXFLAGS_powerpcspe= -DBIG_ENDIAN CONFIGURE_ARGS= --enable-exiv2=true +TEST_TARGET= check + PLIST_FILES= bin/bulk_extractor bin/test_be man/man1/bulk_extractor.1.gz post-extract: diff --git a/sysutils/bulk_extractor/distinfo b/sysutils/bulk_extractor/distinfo index 891d74b044f8..62bf07914da9 100644 --- a/sysutils/bulk_extractor/distinfo +++ b/sysutils/bulk_extractor/distinfo @@ -1,6 +1,6 @@ -TIMESTAMP = 1645265605 -SHA256 (simsong-bulk_extractor-v2.0.0_GH0.tar.gz) = 57efb6fac52fdd70f9778bfad96f76ce01466b48e4a0bb732a39b66abb698cfb -SIZE (simsong-bulk_extractor-v2.0.0_GH0.tar.gz) = 42333931 +TIMESTAMP = 1688292189 +SHA256 (simsong-bulk_extractor-v2.0.3_GH0.tar.gz) = 42c16b0d5708c3bda0bb44eec14dc06b69590496ede550ee736100597a43710f +SIZE (simsong-bulk_extractor-v2.0.3_GH0.tar.gz) = 42335471 SHA256 (simsong-be20_api-f63dcd5_GH0.tar.gz) = 76713af7d1430d5ade05603f218f5a0d9523357b292319e935ef941033a8b4c2 SIZE (simsong-be20_api-f63dcd5_GH0.tar.gz) = 485552 SHA256 (dfxml-working-group-dfxml_cpp-09030bc_GH0.tar.gz) = caf43f6b8440fb7acc3069602d513d36886c7413209043274cc88f6615363502 diff --git a/sysutils/bulk_extractor/files/patch-src_be20__api_dfxml__cpp_src_dfxml__writer.h b/sysutils/bulk_extractor/files/patch-src_be20__api_dfxml__cpp_src_dfxml__writer.h new file mode 100644 index 000000000000..c01216240489 --- /dev/null +++ b/sysutils/bulk_extractor/files/patch-src_be20__api_dfxml__cpp_src_dfxml__writer.h @@ -0,0 +1,13 @@ +--- src/be20_api/dfxml_cpp/src/dfxml_writer.h.orig 2023-07-02 09:24:33 UTC ++++ src/be20_api/dfxml_cpp/src/dfxml_writer.h +@@ -96,6 +96,10 @@ + #include <uuid/uuid.h> + #endif + ++#ifdef HAVE_EXIV2 ++#include <exiv2/exiv2.hpp> ++#endif ++ + #include "cpuid.h" + + class dfxml_writer { diff --git a/sysutils/bulk_extractor/files/patch-src_scan__exiv2.cpp b/sysutils/bulk_extractor/files/patch-src_scan__exiv2.cpp new file mode 100644 index 000000000000..ae9c9d6cd03c --- /dev/null +++ b/sysutils/bulk_extractor/files/patch-src_scan__exiv2.cpp @@ -0,0 +1,125 @@ +--- src/scan_exiv2.cpp.orig 2023-04-07 18:27:14 UTC ++++ src/scan_exiv2.cpp +@@ -33,6 +33,8 @@ + #pragma GCC diagnostic ignored "-Weffc++" + #endif + ++using std::string; ++ + #include <exiv2/image.hpp> + #include <exiv2/exif.hpp> + #include <exiv2/error.hpp> +@@ -90,7 +92,7 @@ static string fix_gps(string s) + std::vector<std::string> parts = split(s,' '); + if(parts.size()!=3) return s; // return the original + double res = rational(parts[0]) + rational(parts[1])/60.0 + rational(parts[2])/3600.0; +- s = dtos(res); ++ s = std::to_string(res); + return s; + } + +@@ -106,7 +108,7 @@ void scan_exiv2(struct scanner_params &sp) + { + sp.check_version(); + if(sp.phase==scanner_params::PHASE_INIT){ +- sp.info.set_name("exiv2" ); ++ sp.info->set_name("exiv2" ); + sp.info->author = "Simson L. Garfinkel"; + sp.info->description = "Searches for EXIF information using exiv2. Use exif scanner if this is not available or if this crashes."; + sp.info->scanner_flags.default_enabled = false; +@@ -117,7 +119,7 @@ void scan_exiv2(struct scanner_params &sp) + } + if(sp.phase==scanner_params::PHASE_SCAN){ + +- const sbuf_t &sbuf = sp.sbuf; ++ const sbuf_t *sbuf = sp.sbuf; + feature_recorder &exif_recorder = sp.named_feature_recorder("exif"); + feature_recorder &gps_recorder = sp.named_feature_recorder("gps"); + +@@ -127,23 +129,23 @@ void scan_exiv2(struct scanner_params &sp) + #endif + + size_t pos_max = 1; // by default, just scan 1 byte +- if(sbuf.bufsize > min_exif_size){ +- pos_max = sbuf.bufsize - min_exif_size; // we can scan more! ++ if(sbuf->bufsize > min_exif_size){ ++ pos_max = sbuf->bufsize - min_exif_size; // we can scan more! + } + + /* Loop through all possible locations in the buffer */ + for(size_t pos=0;pos<pos_max;pos++){ + size_t count = exif_gulp_size; +- count = min(count,sbuf.bufsize-pos); +- //size_t count = sbuf.bufsize-pos; // use all to end ++ count = min(count,sbuf->bufsize-pos); ++ //size_t count = sbuf->bufsize-pos; // use all to end + + /* Explore the beginning of each 512-byte block as well as the starting location + * of any JPEG on any boundary. This will cause processing of any multimedia file + * that Exiv2 recognizes (for which I do not know all the headers. + */ +- if(pos%512==0 || jpeg_start(sbuf+pos)){ ++ if(pos%512==0 || jpeg_start(sbuf->slice(pos))){ + try { +- Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(sbuf.buf+pos,count); ++ Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(sbuf->slice(pos).get_buf(),count); + if(image->good()){ + image->readMetadata(); + +@@ -153,8 +155,8 @@ void scan_exiv2(struct scanner_params &sp) + /* + * Create the MD5 of the first 4K to use as a unique identifier. + */ +- sbuf_t tohash(sbuf,0,4096); +- string md5_hex = exif_recorder->fs.hasher.func(tohash.buf,tohash.bufsize); ++ sbuf_t tohash(*sbuf,0,4096); ++ string md5_hex = exif_recorder.hash(tohash.slice(0, tohash.bufsize)); + + char xmlbuf[1024]; + snprintf(xmlbuf,sizeof(xmlbuf), +@@ -250,10 +252,10 @@ void scan_exiv2(struct scanner_params &sp) + gps_lat = fix_gps(i->value().toString()); + } else if(key=="Exif.GPSInfo.GPSAltitude"){ + has_gps = true; +- gps_ele = dtos(rational(i->value().toString())); ++ gps_ele = std::to_string(rational(i->value().toString())); + } else if(key=="Exif.GPSInfo.GPSSpeed"){ + has_gps = true; +- gps_speed = dtos(rational(i->value().toString())); ++ gps_speed = std::to_string(rational(i->value().toString())); + } else if(key=="Exif.GPSInfo.GPSTrack"){ + has_gps = true; + gps_course = i->value().toString(); +@@ -262,20 +264,20 @@ void scan_exiv2(struct scanner_params &sp) + xml.append("</exiv2>"); + + // record EXIF +- exif_recorder->write(sp.sbuf.pos0+pos,md5_hex,xml); ++ exif_recorder.write(sp.sbuf->pos0+pos,md5_hex,xml); + + // record GPS + if (has_gps) { + if (has_gps_date) { + // record the GPS entry using the GPS date +- gps_recorder->write(sp.sbuf.pos0+pos,md5_hex, ++ gps_recorder.write(sp.sbuf->pos0+pos,md5_hex, + gps_date+"T"+gps_time+","+gps_lat_ref+gps_lat+"," + +gps_lon_ref+gps_lon+"," + +gps_ele+","+gps_speed+","+gps_course); + + } else { + // record the GPS entry using the date obtained from Photo +- gps_recorder->write(sp.sbuf.pos0+pos,md5_hex, ++ gps_recorder.write(sp.sbuf->pos0+pos,md5_hex, + photo_time+","+gps_lat_ref+gps_lat+"," + +gps_lon_ref+gps_lon+"," + +gps_ele+","+gps_speed+","+gps_course); +@@ -283,7 +285,7 @@ void scan_exiv2(struct scanner_params &sp) + } + } + } +- catch (Exiv2::AnyError &e) { } ++ catch (Exiv2::Error &e) { } + catch (std::exception &e) { } + } + }