[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#803342: dhelp: Weekly cron job terminates, doesn't create 'documents.index'



Package: swish++
Followup-For: Bug #803342

Dear Maintainer,

Attached is a patch to copy file_name returned by the previous filter substitute method.
So as it not getting invalidated with its filter container.
This fix indexing when files which have multiple filters applied are
processed (here <filename>.pdf.gz)


When index++ adds a second filter to filter_list in do_file (do_file.c) its
previous entry is invalidated.
This also invalidate the c_str returned from the call so the previous
filter::substute.
Thus after filter_list.push_back(*f) on the second iteration file_name
becomes an empty string.
When we send this emtpy string file_name to the second filter substitute
method the error is:

sudo LC_ALL=C /usr/bin/index++ --config-file /usr/share/dhelp/config/swish++.conf -v 4 --index-file /var/lib/dhelp/documents.index --follow-links /usr/share/doc/gnucash-docs/gnucash-guide-it.pdf.gz
  gnucash-guide-it.pdf.gzterminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::erase: __pos (which is 18446744073709551615) > this->size() (which is 0)
Abandon


Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51	../sysdeps/unix/sysv/linux/raise.c: Aucun fichier ou dossier de ce type.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff6fb642a in __GI_abort () at abort.c:89
#2  0x00007ffff76b4b85 in gnu_cxx::verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff76b2956 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff76b29a1 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff76b2be4 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff76db275 in std::__throw_out_of_range_fmt(char const*, ...) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00007ffff77426f8 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::erase(unsigned long, unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#8  0x000055555556c778 in filter::substitute (this=0x5555557d46a8, file_name=0x5555557d4630 "") at filter.c:205
#9  0x0000555555578089 in do_file (file_name=0x5555557d4630 "", dir_index=0) at do_file.c:129
#10 0x0000555555578617 in do_check_add_file (file_name=0x7fffffffe79c "a.pdf.gz") at directory.c:132
#11 0x0000555555579729 in main (argc=1, argv=0x7fffffffe4e8) at index.c:525



Best regards
Alban

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

Kernel: Linux 4.13.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages swish++ depends on:
ii  libc6       2.24-17
ii  libstdc++6  7.2.0-12
ii  perl        5.26.1-2
ii  zlib1g      1:1.2.8.dfsg-5

swish++ recommends no packages.

Versions of packages swish++ suggests:
pn  antiword                    <none>
ii  poppler-utils [xpdf-utils]  0.57.0-2

-- no debconf information
Description: Fix filter_list growing discards c_str from its invalidated filters
Author: Alban Browaeys <prahal@yahoo.com>
Bug-Debian: https://bugs.debian.org/803342
Last-Update: 2017-10-29
--- a/do_file.c
+++ b/do_file.c
@@ -126,7 +126,7 @@
         if ( !f )
             break;
         filter_list.push_back( *f );
-        file_name = filter_list.back().substitute( file_name );
+        file_name = new_strdup( filter_list.back().substitute( file_name ) );
     }
     char const *const base_name = pjl_basename( file_name );
 

Reply to: