From 4db02c3e7742461e7ae3f159f749c6414451bf2f Mon Sep 17 00:00:00 2001 From: postscript-dev Date: Mon, 21 Nov 2022 16:19:30 +0000 Subject: [PATCH 1/2] Fix exiv2 app: extract, existing file (1. #1934) --- app/actions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/actions.cpp b/app/actions.cpp index 5e933af780..e7f28646e5 100644 --- a/app/actions.cpp +++ b/app/actions.cpp @@ -1718,7 +1718,7 @@ int metacopy(const std::string& source, const std::string& tgt, Exiv2::ImageType std::string target(bStdout ? temporaryPath() : tgt); std::unique_ptr targetImage; - if (Exiv2::fileExists(target)) { + if (preserve && Exiv2::fileExists(target)) { targetImage = Exiv2::ImageFactory::open(target); targetImage->readMetadata(); } else { From 91e7f9ce9bf9fbe53716ff2296315211f98e7050 Mon Sep 17 00:00:00 2001 From: postscript-dev Date: Mon, 21 Nov 2022 16:36:34 +0000 Subject: [PATCH 2/2] Add testing for fix of 1. in #1934 --- test/data/pr_2425_poc1.jpg | Bin 0 -> 7325 bytes tests/bugfixes/github/test_pr_2425.py | 28 ++++++++++++++++++ tests/bugfixes/redmine/test_issue_751.py | 3 +- .../test_regression_allfiles.py | 1 + 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 test/data/pr_2425_poc1.jpg create mode 100644 tests/bugfixes/github/test_pr_2425.py diff --git a/test/data/pr_2425_poc1.jpg b/test/data/pr_2425_poc1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..19a28882a94ec0cada8fa6d6dbbf967b07870a96 GIT binary patch literal 7325 zcmeHJc{o)6+dgA#Av@WZv1XZJP3%9gPwijpFc zrA$P!udn)jf4}#A|9t;`d(L&v^_=IqKlk&T`?}6`-6xYLvjC%kj=l~60)YU%(+fD6 z1EAVr?k)hJuP*^m0{{R5=s{!v?PXVz__{V zMFe2XB8<$@5uRuzXNZQnfNGd>n75xdCdg4B%-hQ+P&rHu@`qgcH2+$3Z-6UIR!K<- zCIg4T;nJrF>A-NGAjd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2`<`b|?9zYVGi^OhVO7#F>=Lff_yTjF{!bD&eZTxN-sLLX})f zu_D-_&~&<5U$kxxeYAS#+|ZXcM(cDT)#Sur+N{QuoZfFOxlx68@2Dvcmp9f`LT0RW z%D!+pN2-{^aUZEp0PF4HmNXuY4N^ctMJw(>beH!|&lMZ!ekvy)=DNCP!Dy}vJ9a^h zS57It%K0YF|%Xcv$ct4WGDBW4LaQ99#!ZALMxa;(sKL@S(4`nhLj!-0d2 z1+ft#e+y+g^+c8wIaio{#~mHJMP`F(-~QmAR%Cn^OB)B;pj6NJl^WEff0?-FLtMQ} zQp~&izXV~Ls%xUZ z8$@jTF_?`gPK&{w0gMC)#hDXfM<~AB7ofP}01;s9nc0EL<8c{*|29wkFCOOBP=*tcL(bSGmJN`eH1&pjYq` z#YRuQG0aSGI~-qIaY$MTMQwBV)Vi%Pg=oEY`~FHn5l9odXs|->J1a=)3SyR3buJToqVV~W?S{^S-^~Y{}laLo-0hB*Y#mIF? zb{J=yy33AN6np8NYaZDRD74BGD=2q*#eE>w(k0%N<_rZ1`i^&;BLp<-Fqw#2EX#?0 z)sZtmwHYvDcqa}nPV~H+? z5ou$mQgA$S*NFvADIc)NSln%%V$Teo0z14Ua$YvJbR+ZV!siR<@?gV%k zq{vA*HmqwwHe;ojs3LXG#d}~4dp^I)ERtq%AXrl_yTt`y`q7X67~}r7>8p_nJ?Lh! J!|2I}{{mnMVD10_ literal 0 HcmV?d00001 diff --git a/tests/bugfixes/github/test_pr_2425.py b/tests/bugfixes/github/test_pr_2425.py new file mode 100644 index 0000000000..17d2514f0b --- /dev/null +++ b/tests/bugfixes/github/test_pr_2425.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +from system_tests import CaseMeta, CopyTmpFiles, path + +@CopyTmpFiles("$data_path/pr_2425_poc1.jpg") +class testExiv2AppExtractOverrideFile(metaclass=CaseMeta): + url = "https://github.com/Exiv2/exiv2/issues/2425" + description = "Fix bug 1. reported in https://github.com/Exiv2/exiv2/issues/1934" + + filename_jpg = "$tmp_path/pr_2425_poc1.jpg" + filename_exv = "$tmp_path/pr_2425_poc1.exv" + + commands = ["$exiv2 --force --extract XXeix $filename_jpg", + "$exiv2 --print a $filename_exv", + "$exiv2 --force --extract XXex $filename_jpg", + "$exiv2 --print a $filename_exv"] + + retval = [0]*4 + stderr = [""]*4 + stdout = ["""""", + """Exif.Image.ImageDescription Ascii 11 Test image +Iptc.Application2.Subject String 12 Test subject +Xmp.dc.subject XmpBag 1 Test subject +""", + """""", + """Exif.Image.ImageDescription Ascii 11 Test image +Xmp.dc.subject XmpBag 1 Test subject +"""] diff --git a/tests/bugfixes/redmine/test_issue_751.py b/tests/bugfixes/redmine/test_issue_751.py index f2366cbcbd..398602d4e0 100644 --- a/tests/bugfixes/redmine/test_issue_751.py +++ b/tests/bugfixes/redmine/test_issue_751.py @@ -66,7 +66,6 @@ def read_xmpfile(): "", """Warning: Updating namespace URI for imageapp from orig/ to dest/ """, - """Warning: Updating namespace URI for imageapp from dest/ to orig/ -""", + """""", ] retval = [0] * 4 diff --git a/tests/regression_tests/test_regression_allfiles.py b/tests/regression_tests/test_regression_allfiles.py index 25ba4c0e86..75c06e44c6 100644 --- a/tests/regression_tests/test_regression_allfiles.py +++ b/tests/regression_tests/test_regression_allfiles.py @@ -148,6 +148,7 @@ def get_valid_files(data_dir): # different output let's try and fix this later "exiv2-bug1044.tif", "issue_2403_poc.exv", + "pr_2425_poc1.jpg", ] file_paths = [