Bug#892548: dhelp: /usr/sbin/dhelp_parse broken with ruby 2.5

2018-04-04 Thread Коля Гурьев
tags 892548 - unreproducible
reassign 892548 libruby2.5
forcemerge 892099 892548
stop

It appears the bug with very similar issue was fixed in the libruby2.5
package so I merge these bugs. If your error still exists, let us know.



Bug#892548: dhelp: /usr/sbin/dhelp_parse broken with ruby 2.5

2018-04-03 Thread Коля Гурьев
Control: tag -1 unreproducible

Unfortunately, I can't reproduce this error. However, I've faced the
other error related to dhelp's cron script. It fails to build a document
index, and so search doesn't work. But at least the dhelp_parse utility
can rebuild its documentation directory, and a home page is still
available. It seems some of the next warnings aren't linked to dhelp.

But these issues are already reported, see Bug#803342 and Bug#889651.

(dhelp)root@barberry:/# sh -x /etc/cron.weekly/dhelp
+ [ -d /var/lib/dhelp ]
+ [ -x /usr/sbin/dhelp_parse ]
+ [ -x /usr/bin/index++ ]
+ rm --force /var/lib/dhelp/documents.index
+ /usr/sbin/dhelp_parse -r
/usr/lib/ruby/vendor_ruby/debian.rb:223: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:224: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:227: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:230: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:233: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:236: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:348: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:557: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:577: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:578: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:743: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:753: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:763: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:772: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:799: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:1004: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
+ /usr/sbin/dhelp_parse -i
/usr/lib/ruby/vendor_ruby/debian.rb:223: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:224: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:227: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:230: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:233: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:236: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:348: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:557: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:577: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:578: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:743: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:753: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:763: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:772: warning: parentheses after
method name is interpreted as an argument list, not a decomposed argument
/usr/lib/ruby/vendor_ruby/debian.rb:799: warning: pa

Bug#861410: dhelp: apache2-maintscript-helper invoked from a modified environment

2017-04-28 Thread Коля Гурьев

Control: tag -1 +pending

The fix of this error is already available in git[1]. It will be in the 
next version.


But right now, you can add return statement in the begin of 
try_chconf_apache2 function in /usr/share/dhelp/maint-scripts/httpd.sh 
file on line 139. And you have to manually enable dhelp.conf Apache 
configuration file.


[1] 
https://anonscm.debian.org/cgit/collab-maint/dhelp.git/commit/?id=f33acd31ac972c43c17f298d7671ae80ec9157a2




Bug#791770: dhelp: Depends on obsolete ruby-bdb

2017-04-24 Thread Коля Гурьев

Control: owner -1 !

Please don't remove this package. I already work on patch to fix this 
bug. I think I can perform migration from a module for Berkley DB to DBM 
class from the Ruby standard library. I'm attaching my current draft. 
Now I going to write migration scripts and test them.


By the way, can I check a previously installed version of the package in 
postinst script?
=== modified file 'debian/changelog'
--- debian/changelog	2014-12-12 22:02:20 +
+++ debian/changelog	2017-04-24 20:23:36 +
@@ -1,3 +1,10 @@
+dhelp (0.6.21+nmu6ubuntu1) UNRELEASED; urgency=medium
+
+  * Migrate to a module from the standard library
+- Remove ruby-bdb dependency
+
+ -- Nicholas Guriev   Mon, 24 Apr 2017 23:21:54 +0300
+
 dhelp (0.6.21+nmu6) unstable; urgency=medium
 
   * Non-maintainer upload.

=== modified file 'debian/control'
--- debian/control	2014-05-18 13:18:39 +
+++ debian/control	2017-04-24 20:20:58 +
@@ -11,7 +11,7 @@
 Package: dhelp
 Depends: perl-modules, libtemplate-perl, libhtml-parser-perl,
  liburi-perl, liblocale-gettext-perl, libdata-page-perl,
- ruby | ruby-interpreter, ruby-bdb, ruby-debian, ruby-gettext,
+ ruby | ruby-interpreter, ruby-debian, ruby-gettext,
  doc-base, swish++, pstotext, poppler-utils, ucf (>= 0.8),
  ${misc:Depends}
 Recommends: www-browser | html2text

=== modified file 'devtools/list-dirs.rb'
--- devtools/list-dirs.rb	2012-06-12 21:50:00 +
+++ devtools/list-dirs.rb	2017-04-24 19:50:51 +
@@ -2,7 +2,7 @@
 
 path = ARGV.shift || Dhelp::DOC_DIR_DATABASE
 puts "Opening #{path}"
-ddd = Dhelp::DocDirDatabase.open(BDB::RDONLY, path)
+ddd = Dhelp::DocDirDatabase.open(DBM::READER, path)
 ddd.each do |dir, doc_id, title|
   puts "#{dir} -> #{doc_id} (#{title})"
 end

=== modified file 'lib/dhelp.rb'
--- lib/dhelp.rb	2014-05-18 13:18:39 +
+++ lib/dhelp.rb	2017-04-24 19:57:08 +
@@ -18,7 +18,7 @@
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 =end
 
-require 'bdb'
+require 'dbm'
 require 'pathname'
 require 'fileutils'
 
@@ -239,23 +239,18 @@
 
   # Database for doc-base directories. It contains base directories associated
   # with the corresponding doc-base doc id and the document title.
-  class DocDirDatabase < BDB::Hash
-def self.open(flags   = BDB::RDONLY,
+  class DocDirDatabase < DBM
+def self.open(flags   = DBM::READER,
   name= DOC_DIR_DATABASE,
   options = {},
   mode= 0644)
-  default_options = {"ffactor"   => 8,
- "nelem" => 1,
- "cachesize" => 5000,
- "hash"  => nil,
- "lorder"=> 0}
-  super(name, nil, flags, mode, default_options.merge(options))
+  super(name, mode, flags)
 end
 
 # Traverse entire BD, passing directory, doc_id and title of each item to
 # the block
 def each
-  super do |k,v|
+  each_pair do |k,v|
 value = DocDirDatabaseValue.new(v)
 yield DocDirDatabaseKey.new(k).dir, value.doc_id, value.title
   end
@@ -266,19 +261,19 @@
 def add(dir, doc_id, title)
   key = DocDirDatabaseKey.new(:dir => dir)
   value = DocDirDatabaseValue.new(:doc_id => doc_id, :title => title)
-  put(key.to_raw_data, value.to_raw_data)
+  self[key.to_raw_data] = value.to_raw_data
 end
 
 def include?(dir)
   key = DocDirDatabaseKey.new(:dir => dir)
-  return super(key.to_raw_data)
+  return has_key?(key.to_raw_data)
 end
 
 # Returns an array with two elements, doc_id and title, for the registered
 # doc-base document in the given directory
 def info_for_path(dir)
   key = DocDirDatabaseKey.new(:dir => dir)
-  raw_value = get(key.to_raw_data)
+  raw_value = self[key.to_raw_data]
   if raw_value.nil?
 raise KeyNotFoundError, "Can't find information for path #{dir}"
   end
@@ -448,10 +443,11 @@
 # Registers a list of doc-base documents as part of Dhelp
 def _register_docs(doc_list, user_opts={})
   register_opts = {:regenerate_index => false}.merge(user_opts)
-  open_flag = register_opts[:regenerate_index] ? (BDB::CREATE|
-  BDB::TRUNCATE) :
- BDB::CREATE
-  doc_dir_db = DocDirDatabase.open(open_flag, @doc_dir_database)
+  if register_opts[:regenerate_index]
+doc_dir_db = DocDirDatabase.open(DBM::NEWDB, @doc_dir_database)
+  else
+doc_dir_db = DocDirDatabase.open(DBM::WRCREAT, @doc_dir_database)
+  end
   index_paths = []
   doc_list.each do |doc|
 doc.formats.each do |format|

=== modified file 'test/tc_dhelpdocumentpool.rb'
--- test/tc_dhelpdocumentpool.rb	2014-05-18 13:18:39 +
+++ test/tc_dhelpdocumentpool.rb	2017-04-24 20:19:29 +
@@ -1,6 +1,7 @@
 require 'test/unit'
 require 'dhelp'
 require 'fileutils'
+require 'set'
 
 class TC_Dhelp