From 74007ff4ff7826926138b707bb68e35177589c18 Mon Sep 17 00:00:00 2001 From: Petr Písař Date: Dec 05 2016 12:39:04 +0000 Subject: 1.6.0 bump --- diff --git a/.gitignore b/.gitignore index 32a6e98..d1ce9c7 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ gscan2pdf-0.9.31.tar.gz /gscan2pdf-1.5.3.tar.xz /gscan2pdf-1.5.4.tar.xz /gscan2pdf-1.5.5.tar.xz +/gscan2pdf-1.6.0.tar.xz diff --git a/gscan2pdf-1.5.5-Save-image-without-a-shell.patch b/gscan2pdf-1.5.5-Save-image-without-a-shell.patch deleted file mode 100644 index 171fb14..0000000 --- a/gscan2pdf-1.5.5-Save-image-without-a-shell.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 63e350e14229a69d2b20b806dada90a06dc9008b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= -Date: Tue, 1 Nov 2016 14:49:50 +0100 -Subject: [PATCH] Save image without a shell -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When saving into an image format, a shell meta-characters in a file -name could clash with a shell used to execute convert command. - -This patch replaces the system() calls with safert IPC::Run3 calls. - - - -Signed-off-by: Petr Písař ---- - Makefile.PL | 1 + - lib/Gscan2pdf/Document.pm | 44 +++++++++++++++++++++++++++++++++----------- - 2 files changed, 34 insertions(+), 11 deletions(-) - -diff --git a/Makefile.PL b/Makefile.PL -index 8214cc8..10d07ff 100644 ---- a/Makefile.PL -+++ b/Makefile.PL -@@ -49,6 +49,7 @@ WriteMakefile( - Gtk2::Ex::Simple::List => 0, - Gtk2::ImageView => 0, - Image::Magick => 0, -+ IPC::Run3 => 0, - Locale::gettext => 1.05, - Config::General => 2.40, - PDF::API2 => 0, -diff --git a/lib/Gscan2pdf/Document.pm b/lib/Gscan2pdf/Document.pm -index a190b1d..8cd55ac 100644 ---- a/lib/Gscan2pdf/Document.pm -+++ b/lib/Gscan2pdf/Document.pm -@@ -28,6 +28,7 @@ use Archive::Tar; # For session files - use Proc::Killfam; - use Locale::gettext 1.05; # For translations - use IPC::Open3 'open3'; -+use IPC::Run3 (); - use Symbol; # for gensym - use Try::Tiny; - use Set::IntSpan 1.10; # For size method for page numbering issues -@@ -3384,17 +3385,38 @@ sub _thread_rotate { - return; - } - -+sub _exec_command { -+ my ($pidfile, $command) = @_; -+ -+ open(my $fh, '>', $pidfile) or return -1; -+ $fh->print($PROCESS_ID); -+ close($fh) or return -1; -+ -+ $logger->info(join(' ', @$command)); -+ IPC::Run3::run3($command, undef, undef, undef, -+ { return_if_system_error => 1 }); -+ if ($? == 0) { -+ return 0; -+ } -+ -+ if ($? == -1) { -+ $logger->info("Could not execute the command: $!"); -+ } elsif ($? & 127) { -+ $logger->info("Command died with signal " . ($? & 127)); -+ } else { -+ $logger->info("Command failed with exit code " . ($? >> 8)); -+ } -+ return -1; -+} -+ - sub _thread_save_image { - my ( $self, $path, $list_of_pages, $pidfile, $uuid ) = @_; - -- # Escape quotes and spaces -- $path =~ s/(['" ])/\\$1/gxsm; -- - if ( @{$list_of_pages} == 1 ) { -- my $cmd = --"convert $list_of_pages->[0]{filename} -density $list_of_pages->[0]{resolution} $path"; -- $logger->info($cmd); -- my $status = system "echo $PROCESS_ID > $pidfile;$cmd"; -+ my $status = _exec_command($pidfile, -+ ['convert', $list_of_pages->[0]{filename}, '-density', -+ $list_of_pages->[0]{resolution}, $path] -+ ); - return if $_self->{cancel}; - if ($status) { - _thread_throw_error( $self, $uuid, $d->get('Error saving image') ); -@@ -3405,10 +3427,10 @@ sub _thread_save_image { - my $i = 1; - for ( @{$list_of_pages} ) { - $current_filename = sprintf $path, $i++; -- my $cmd = sprintf 'convert %s -density %d %s', -- $_->{filename}, $_->{resolution}, -- $current_filename; -- my $status = system "echo $PROCESS_ID > $pidfile;$cmd"; -+ my $status = _exec_command($pidfile, -+ ['convert', $_->{filename}, '-density', $_->{resolution}, -+ $current_filename] -+ ); - return if $_self->{cancel}; - if ($status) { - _thread_throw_error( $self, $uuid, --- -2.7.4 - diff --git a/gscan2pdf.spec b/gscan2pdf.spec index 3cc085d..ba1fc7a 100644 --- a/gscan2pdf.spec +++ b/gscan2pdf.spec @@ -5,8 +5,8 @@ %bcond_with test Name: gscan2pdf -Version: 1.5.5 -Release: 2%{?dist} +Version: 1.6.0 +Release: 1%{?dist} Summary: GUI for producing a multipage PDF from a scan Group: Applications/Publishing # icons/scanner.svg: GPLv2 @@ -17,9 +17,6 @@ Group: Applications/Publishing License: GPLv3 and GPLv2 and LGPLv2+ URL: http://gscan2pdf.sourceforge.net/ Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.xz -# Fix saving to an image with shell meta characters in a file name, -# bug #1390105, -Patch0: gscan2pdf-1.5.5-Save-image-without-a-shell.patch BuildArch: noarch BuildRequires: coreutils BuildRequires: desktop-file-utils @@ -39,6 +36,7 @@ BuildRequires: perl(Config::General) >= 2.40 BuildRequires: perl(Cwd) BuildRequires: perl(Data::Dumper) BuildRequires: perl(Data::UUID) +BuildRequires: perl(Date::Calc) BuildRequires: perl(Encode) BuildRequires: perl(English) BuildRequires: perl(Exporter) @@ -66,7 +64,6 @@ BuildRequires: perl(if) BuildRequires: perl(Image::Magick) BuildRequires: perl(IO::Handle) BuildRequires: perl(IPC::Open3) -BuildRequires: perl(IPC::Run3) BuildRequires: perl(JSON::PP) BuildRequires: perl(List::MoreUtils) BuildRequires: perl(Locale::gettext) >= 1.05 @@ -98,6 +95,7 @@ BuildRequires: unpaper # Tests: BuildRequires: font(:lang=en) BuildRequires: ImageMagick +BuildRequires: perl(File::stat) BuildRequires: perl(Scalar::Util) BuildRequires: perl(Sub::Override) BuildRequires: perl(Test::More) @@ -140,7 +138,6 @@ A GUI to ease the process of producing a multipage PDF from a scan. %prep %setup -q -%patch0 -p1 %build perl Makefile.PL INSTALLDIRS=vendor SHAREDIR=%{_datadir} @@ -196,18 +193,16 @@ rm t/175_open_session2.t xvfb-run -a make test %endif -# The installed icon file is %%{_datadir}/pixmaps/gscan2pdf.svg. The scriptlets -# are wrong probably. +# Do not call gtk-update-icon-cache because it's needed only for updating icon +# themata in %%{_datadir}/icon/*. This package installes icon into +# %%{_datadir}/pixmaps/gscan2pdf.svg. Pixmaps seems not to be subject of icon +# themata. %post -touch --no-create %{_datadir}/icons/hicolor || : -if [ -x %{_bindir}/gtk-update-icon-cache ]; then - %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || : -fi +touch --no-create %{_datadir}/pixmaps || : %postun -touch --no-create %{_datadir}/icons/hicolor || : -if [ -x %{_bindir}/gtk-update-icon-cache ]; then - %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || : +if [ $1 -eq 0 ] ; then + touch --no-create %{_datadir}/pixmaps || : fi %files -f %{name}.lang @@ -222,6 +217,9 @@ fi %{_mandir}/man1/*.1* %changelog +* Mon Dec 05 2016 Petr Pisar - 1.6.0-1 +- 1.6.0 bump + * Tue Nov 01 2016 Petr Pisar - 1.5.5-2 - Fix saving to an image with shell meta characters in a file name (bug #1390105) diff --git a/sources b/sources index d0b9042..d9fb711 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -6ffc0549db42831afc521246f38a4b21 gscan2pdf-1.5.5.tar.xz +b62e6b90cae10dcea4e2a0bb7a3f0020 gscan2pdf-1.6.0.tar.xz