Package: rubber
Version: 1.1+20100306-2
Severity: normal

When loading a directives file with -r, rubber crashes with:

        Traceback (most recent call last):
          File "/home/iouri/.local/bin/rubber", line 4, in <module>
            sys.exit(Main()(sys.argv[1:]))
          File "/usr/lib/pymodules/python2.7/rubber/cmdline.py", line 319, in 
__call__
            return self.main(cmdline)
          File "/usr/lib/pymodules/python2.7/rubber/cmdline.py", line 244, in 
main
            env.main.command(cmd[0], cmd[1:], {'file': 'command line'})
          File "/usr/lib/pymodules/python2.7/rubber/converters/latex.py", line 
830, in command
            getattr(self, "do_" + cmd)(*args)
          File "/usr/lib/pymodules/python2.7/rubber/converters/latex.py", line 
887, in do_read
            self.push_vars(file=path, line=None)
        AttributeError: 'LaTeXDep' object has no attribute 'push_vars'

The contents of the directives file does not matter, it is not even read.

I traced back the origin of this bug to revision 391 in upstream Launchpad
(lp:rubber): this revision introduced the class `util.Variables` to manage
stacks of environments, which obsoleted the previous `push_vars`/`pop_vars`
mechanism. The problem is that methods `LaTeXDep.{push,pop}_vars` are still
called in `LaTeXDep.do_read`.

Attached is a patch that replaces the calls to `LaTeXDep.{push,pop}_vars` with
the appropriate scheme based on locally saving `self.vars` (similar to what was
done in revision 391 for, e.g., `LaTeXDep.process`).

This might be considered as a duplicate of 374908, but I’m not sure.  The piece
of code that caused the error mentionned in 374908 was actually removed in
revision 391: I guess this “fixed” 374908.

I hope this helps,
iouri.

-- System Information:
Debian Release: 7.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages rubber depends on:
ii  dpkg                1.16.9
ii  install-info        4.13a.dfsg.1-10
ii  python              2.7.3-4
ii  python-support      1.0.15
ii  texlive-latex-base  2012.20120611-5

rubber recommends no packages.

Versions of packages rubber suggests:
ii  imagemagick  8:6.7.7.10-5
pn  sam2p        <none>
pn  transfig     <none>

-- no debconf information
diff -u rubber-1.1+20100306/src/converters/latex.py rubber-1.1+fix/src/converters/latex.py
--- rubber-1.1+20100306/src/converters/latex.py	2010-08-12 15:46:10.000000000 +0200
+++ rubber-1.1+fix/src/converters/latex.py	2013-02-28 16:45:49.984374543 +0100
@@ -562,7 +562,6 @@
 			"ext": None,
 			"job": None,
 			"graphics_suffixes" : [] })
-		self.vars_stack = []
 
 		self.cmdline = ["\\nonstopmode", "\\input{%s}"]
 
@@ -884,8 +883,10 @@
 
 	def do_read (self, name):
 		path = self.abspath(name)
-		self.push_vars(file=path, line=None)
+		saved_vars = self.vars
 		try:
+			self.vars = Variables(self.vars,
+					{'file':path, 'line':None})
 			file = open(path)
 			lineno = 0
 			for line in file.readlines():
@@ -899,7 +900,8 @@
 			file.close()
 		except IOError:
 			msg.warn(_("cannot read option file %s") % name, **self.vars)
-		self.pop_vars()
+		finally:
+			self.vars = saved_vars
 
 	def do_rules (self, file):
 		name = self.env.find_file(file)

Reply via email to