Bug#926634: Delays opening dialogs, possibly related to defunct fc-list process

2019-04-25 Thread martin f krafft
Hey, sorry for the lack of engagement on my part. I've been 
travelling and on family holidays. I won't be back to the machine 
that had the problem until July, but I've made a note to 
specifically verify this bug fix then.


Thanks a lot — as always — for your fast turnaround!

--
.''`.   martin f. krafft  @martinkrafft
: :'  :  proud Debian developer
`. `'`   http://people.debian.org/~madduck
 `-  Debian - when you have better things to do than fixing systems

"being shot is not as bad as i always thought it might be.
as long as you can keep the fear from your mind."
   -- special agent dale cooper


digital_signature_gpg.asc
Description: Digital GPG signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)


Bug#926634: Delays opening dialogs, possibly related to defunct fc-list process

2019-04-16 Thread Jeff
Please also apply this patch, as otherwise the sub-process will hang if
the output is larger than 65kb.

I'm guessing that this was the source of the bug - that waitpid() did
not catch the process as the output was large.
diff --git a/lib/Gscan2pdf/Document.pm b/lib/Gscan2pdf/Document.pm
index 3e3e76ae..35b6f37a 100644
--- a/lib/Gscan2pdf/Document.pm
+++ b/lib/Gscan2pdf/Document.pm
@@ -1980,11 +1980,16 @@ sub exec_command {
 close $fh or return $PROCESS_FAILED;
 }
 
+# slurping these before waitpid, as if the output is larger than 65535,
+# waitpid hangs forever.
+$reader = slurp($reader);
+$err= slurp($err);
+
 # Using 0 for flags, rather than WNOHANG to ensure that we wait for the
 # process to finish and not leave a zombie
-waitpid $ALL_PENDING_ZOMBIE_PROCESSES, 0;
+waitpid $pid, 0;
 my $child_exit_status = $CHILD_ERROR >> $BITS_PER_BYTE;
-return $child_exit_status, slurp($reader), slurp($err);
+return $child_exit_status, $reader, $err;
 }
 
 # wrapper for _program_version below
-- 
2.20.1



signature.asc
Description: OpenPGP digital signature


Bug#926634: Delays opening dialogs, possibly related to defunct fc-list process

2019-04-10 Thread Jeff
Please apply these two patches, which should fix the UTF-8 characters in
the font names, and prevent the zombie process, and let me know if the
problem with the delay still occurs.

Regards

Jeff
diff --git a/lib/Gscan2pdf/Dialog/Save.pm b/lib/Gscan2pdf/Dialog/Save.pm
index 04fac57b..e4ee5def 100644
--- a/lib/Gscan2pdf/Dialog/Save.pm
+++ b/lib/Gscan2pdf/Dialog/Save.pm
@@ -11,6 +11,7 @@ use Gscan2pdf::EntryCompletion;
 use Gscan2pdf::Translation '__';# easier to extract strings with xgettext
 use Date::Calc qw(Today Today_and_Now);
 no if $] >= 5.018, warnings => 'experimental::smartmatch';
+use Encode;
 use Readonly;
 Readonly my $ENTRY_WIDTH_DATE => 10;
 Readonly my $ENTRY_WIDTH_DATETIME => 19;
@@ -809,6 +810,7 @@ sub add_pdf_options {
 my @fonts;
 my ( undef, $stdout ) =
   Gscan2pdf::Document::exec_command( ['fc-list : family style file'] );
+$stdout = Encode::decode_utf8($stdout);
 
 my $font = $self->get('pdf-font');
 for ( split /\n/sm, $stdout ) {
-- 
2.17.1

diff --git a/lib/Gscan2pdf/Document.pm b/lib/Gscan2pdf/Document.pm
index cc77f491..3e3e76ae 100644
--- a/lib/Gscan2pdf/Document.pm
+++ b/lib/Gscan2pdf/Document.pm
@@ -1980,7 +1980,9 @@ sub exec_command {
 close $fh or return $PROCESS_FAILED;
 }
 
-waitpid $ALL_PENDING_ZOMBIE_PROCESSES, WNOHANG;
+# Using 0 for flags, rather than WNOHANG to ensure that we wait for the
+# process to finish and not leave a zombie
+waitpid $ALL_PENDING_ZOMBIE_PROCESSES, 0;
 my $child_exit_status = $CHILD_ERROR >> $BITS_PER_BYTE;
 return $child_exit_status, slurp($reader), slurp($err);
 }
-- 
2.17.1



signature.asc
Description: OpenPGP digital signature


Bug#926634: Delays opening dialogs, possibly related to defunct fc-list process

2019-04-08 Thread martin f krafft

Package: gscan2pdf
Version: 2.5.1-1
Severity: normal

When I open a session, then select a few pages and hit "save", the 
dialog takes about 8 seconds to show up.


At the same time, in the debug log, I see:

 INFO - fc-list : family style file
 INFO - Spawned PID 7825

and then am left with

 madduck   7825  1.2  0.0  0 0 ?Z11:28   0:00 [fc-list] 


in the process table.

Given that fc-list is a fontconfig tool, I find it relevant that the 
"Font for non-ASCII text" in the save dialog box only contains one 
font, and specifically one with Unicode characters in its name, 
which aren't properly rendered (see screenshot attached).


The corresponding setting is

  "pdf font" : "/usr/share/fonts/truetype/aenigma/aescrawl.ttf",

and I have to change that in the file to

  "pdf font" : 
"/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf",

to configure a more sensible font.

But the dialog still takes 8 seconds to show up, and the defunct 
process is still being left behind.


--
System Information:
Debian Release: buster/sid
 APT prefers unstable
 APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.19.0-4-amd64 (SMP w/8 CPU cores)
Kernel taint flags: TAINT_FIRMWARE_WORKAROUND
Locale: LANG=en_NZ, LC_CTYPE=en_NZ.UTF-8 (charmap=UTF-8), LANGUAGE=en_NZ:en 
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages gscan2pdf depends on:
ii  imagemagick8:6.9.10.23+dfsg-2
ii  imagemagick-6.q16 [imagemagick]8:6.9.10.23+dfsg-2
ii  libconfig-general-perl 2.63-1
ii  libdate-calc-perl  6.4-1
ii  libfilesys-df-perl 0.92-6+b4
ii  libgoocanvas2-perl 0.06-1
ii  libgtk3-perl   0.034-2
ii  libgtk3-simplelist-perl0.18-1
ii  libhtml-parser-perl3.72-3+b3
ii  libimage-magick-perl   8:6.9.10.23+dfsg-2
ii  libimage-sane-perl 0.14-1+b3
ii  liblist-moreutils-perl 0.416-1+b4
ii  liblocale-gettext-perl 1.07-3+b4
ii  liblog-log4perl-perl   1.49-1
ii  libossp-uuid-perl [libdata-uuid-perl]  1.6.2-1.5+b7
ii  libpdf-api2-perl   2.033-1
ii  libproc-processtable-perl  0.56-1
ii  libreadonly-perl   2.050-1
ii  librsvg2-common2.44.10-1
ii  libset-intspan-perl1.19-1
ii  libtiff-tools  4.0.10-4
ii  libtry-tiny-perl   0.30-1
ii  sane-utils 1.0.27-3.2

Versions of packages gscan2pdf recommends:
ii  djvulibre-bin   3.5.27.1-10
ii  pdftk   2.02-5
ii  pdftk-java [pdftk]  3.0.2-2
ii  sane1.0.14-13+b1
ii  tesseract-ocr   4.0.0-2
ii  unpaper 6.1-2+b2
ii  xdg-utils   1.1.3-1

gscan2pdf suggests no packages.

--
debconf-show failed


--
.''`.   martin f. krafft  @martinkrafft
: :'  :  proud Debian developer
`. `'`   http://people.debian.org/~madduck
 `-  Debian - when you have better things to do than fixing systems


digital_signature_gpg.asc
Description: Digital GPG signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)