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

Bug#694578: unblock (pre-approval): okular/4.8.4-3



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Please (pre-approve) unblock package okular
einclude/attach the debdiff against the package in testing)

This packages solves:

- #680946, severity important, avoiding different versions of libokularcore and
okular at the same time. The first 3 entries in the changelog are part of this
fix.

Three commits backported from upstream to solve:

- the extraction of the page bounding box, used by the trimming function;
- restore word detection in DVI documents;
- avoid a crash with broken fonts.

Diffstat:

 changelog                                                                   |   22 +
 control                                                                     |    3 
 patches/avoid_crash_with_broken_fonts.diff                                  |   31 ++
 patches/fix_word_detection_with_dvi_docs.diff                               |  153 ++++++++++
 patches/series                                                              |    3 
 patches/upstream_Call-Generator-signalPixmapRequestDone-_after_-savin.patch |   40 ++
 6 files changed, 251 insertions(+), 1 deletion(-)

Kinds regards, Lisandro.

unblock okular/4.8.4-3

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nru okular-4.8.4/debian/changelog okular-4.8.4/debian/changelog
--- okular-4.8.4/debian/changelog	2012-06-20 14:37:55.000000000 -0300
+++ okular-4.8.4/debian/changelog	2012-11-27 20:41:58.000000000 -0300
@@ -1,3 +1,25 @@
+okular (4:4.8.4-3) UNRELEASED; urgency=low
+
+  [ Pino Toscano ]
+  * Force okular to depend on the same version of libokularcore, as it uses
+    internal API of it.
+  * Make libokularcore break okular < 4.8, as with 4.8 a private symbol used
+    by the okularpart has been dropped.
+  * The two changes above will make sure to avoid different versions of
+    libokularcore and okular at the same time. (Closes: #680946)
+  * Backport upstream commit edbb4ef9f5aa8f120558b9d4f4b9f68970100c4b to fix
+    the extraction of the page bounding box, used by the trimming function;
+    patch upstream_Call-Generator-signalPixmapRequestDone-_after_-savin.patch.
+    (Closes: #686642)
+
+  [ Lisandro Damián Nicanor Pérez Meyer ]
+  * Backport upstream commit 91e46331fd7901705a69323c75de84e2467416dd to restore
+    word detection in DVI documents. Thanks Luigi Toscano.
+  * Backport upstream commit 823a84942df4d3604b041ef7878a9984b1f12b7f to avoid
+    a crash with broken fonts. Thanks Luigi Toscano.
+
+ -- Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>  Mon, 09 Jul 2012 15:24:28 +0200
+
 okular (4:4.8.4-2) unstable; urgency=low
 
   * Team upload.
diff -Nru okular-4.8.4/debian/control okular-4.8.4/debian/control
--- okular-4.8.4/debian/control	2012-06-20 14:06:57.000000000 -0300
+++ okular-4.8.4/debian/control	2012-11-27 20:41:58.000000000 -0300
@@ -29,6 +29,7 @@
 Section: libs
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}
+Breaks: okular (<< 4:4.8)
 Description: libraries for the Okular document viewer
  This package contains libraries used by the Okular document viewer.
  .
@@ -37,7 +38,7 @@
 Package: okular
 Section: graphics
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}, libokularcore1 (= ${binary:Version})
 Suggests: okular-extra-backends (= ${binary:Version}), texlive-binaries, unrar, poppler-data, ghostscript, jovie
 Provides: pdf-viewer, postscript-viewer
 Description: universal document viewer
diff -Nru okular-4.8.4/debian/patches/avoid_crash_with_broken_fonts.diff okular-4.8.4/debian/patches/avoid_crash_with_broken_fonts.diff
--- okular-4.8.4/debian/patches/avoid_crash_with_broken_fonts.diff	1969-12-31 21:00:00.000000000 -0300
+++ okular-4.8.4/debian/patches/avoid_crash_with_broken_fonts.diff	2012-11-27 20:41:58.000000000 -0300
@@ -0,0 +1,31 @@
+commit 823a84942df4d3604b041ef7878a9984b1f12b7f
+Author: Luigi Toscano <luigi.toscano@tiscali.it>
+Date:   Sun Jul 15 21:15:43 2012 +0200
+
+    Avoid crash when the font is broken.
+    
+    The call to FT_New_Face takes the address of the 'face' variable, whose type is a
+    typedef *something TF_Face;
+    The value of TF_Face (so a pointer to the properly filled font structure) s then
+    replaced inside the call of TF_New_Face; but when the latter function fails,
+    the value of 'face' is not reset and this leads to a crash in the distructor of
+    TeXFont_PFB.
+    So properly initialize TF_Face to 0, its address is valid, and the code works.
+    
+    BUG: 303472
+    FIXED-IN: 4.8.5
+    (cherry picked from commit 99c4da2f9ef86e345ee02cecb10e0df8f5e5b2e2)
+
+diff --git a/generators/dvi/TeXFont_PFB.cpp b/generators/dvi/TeXFont_PFB.cpp
+index cc86631..6b27093 100644
+--- a/generators/dvi/TeXFont_PFB.cpp
++++ b/generators/dvi/TeXFont_PFB.cpp
+@@ -25,7 +25,7 @@
+ 
+ 
+ TeXFont_PFB::TeXFont_PFB(TeXFontDefinition *parent, fontEncoding *enc, double slant)
+-  : TeXFont(parent)
++  : TeXFont(parent), face(0)
+ {
+ #ifdef DEBUG_PFB
+   if (enc != 0)
diff -Nru okular-4.8.4/debian/patches/fix_word_detection_with_dvi_docs.diff okular-4.8.4/debian/patches/fix_word_detection_with_dvi_docs.diff
--- okular-4.8.4/debian/patches/fix_word_detection_with_dvi_docs.diff	1969-12-31 21:00:00.000000000 -0300
+++ okular-4.8.4/debian/patches/fix_word_detection_with_dvi_docs.diff	2012-11-27 20:41:58.000000000 -0300
@@ -0,0 +1,153 @@
+commit 91e46331fd7901705a69323c75de84e2467416dd
+Author: Luigi Toscano <luigi.toscano@tiscali.it>
+Date:   Tue Nov 27 00:59:57 2012 +0100
+
+    Fix word detection for DVI documents
+    
+    This patch attempts to restore the functionalities broken by some changes
+    (maybe the text column selection code, it was broken also in 4.7).
+    
+    Text search and text selection work (almost) properly again.
+    
+    It uses a bit of heuristics to identify the end of a word and merge the
+    boxes which enclose each character of a word (so that
+    char_x.right==char_{x+1}.left).
+    It also tries to recognize if there is a newline ("after_space") after
+    that a space is found.
+    
+    BUG: 302004
+    REVIEW: 107429
+    FIXED-IN: 4.9.4
+
+diff --git a/generators/dvi/dviRenderer_draw.cpp b/generators/dvi/dviRenderer_draw.cpp
+index b816353..b622e79 100644
+--- a/generators/dvi/dviRenderer_draw.cpp
++++ b/generators/dvi/dviRenderer_draw.cpp
+@@ -275,7 +275,11 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
+   currinf.fontp        = NULL;
+   currinf.set_char_p   = &dviRenderer::set_no_char;
+ 
++  int last_space_index = 0;
++  bool space_encountered = false;
++  bool after_space = false;
+   for (;;) {
++    space_encountered = false;
+     ch = readUINT8();
+     if (ch <= (unsigned char) (SETCHAR0 + 127)) {
+       (this->*currinf.set_char_p)(ch, ch);
+@@ -404,8 +408,10 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
+           if ((is_vfmacro == false) &&
+               (currinf.fontp != 0) &&
+               ((RRtmp >= currinf.fontp->scaled_size_in_DVI_units/6) || (RRtmp <= -4*(currinf.fontp->scaled_size_in_DVI_units/6))) &&
+-              (currentlyDrawnPage->textBoxList.size() > 0))
+-            currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += ' ';
++              (currentlyDrawnPage->textBoxList.size() > 0)) {
++            //currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += ' ';
++            space_encountered = true;
++          }
+           currinf.data.dvi_h += ((long) (RRtmp *  current_dimconv));
+           break;
+ 
+@@ -419,8 +425,10 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
+           if ((is_vfmacro == false) &&
+               (currinf.fontp != 0) &&
+               ((WWtmp >= currinf.fontp->scaled_size_in_DVI_units/6) || (WWtmp <= -4*(currinf.fontp->scaled_size_in_DVI_units/6))) &&
+-              (currentlyDrawnPage->textBoxList.size() > 0) )
+-            currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += ' ';
++              (currentlyDrawnPage->textBoxList.size() > 0) ) {
++            //currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += ' ';
++            space_encountered = true;
++          }
+           currinf.data.dvi_h += currinf.data.w;
+           break;
+ 
+@@ -434,8 +442,10 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
+           if ((is_vfmacro == false)  &&
+               (currinf.fontp != 0) &&
+               ((XXtmp >= currinf.fontp->scaled_size_in_DVI_units/6) || (XXtmp <= -4*(currinf.fontp->scaled_size_in_DVI_units/6))) &&
+-              (currentlyDrawnPage->textBoxList.size() > 0))
+-            currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += ' ';
++              (currentlyDrawnPage->textBoxList.size() > 0)) {
++            //currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += ' ';
++            space_encountered = true;
++          }
+           currinf.data.dvi_h += currinf.data.x;
+           break;
+ 
+@@ -451,6 +461,7 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
+                 (currentlyDrawnPage->textBoxList.size() > 0)) {
+               word_boundary_encountered = true;
+               line_boundary_encountered = true;
++              space_encountered = true;
+               if (abs(DDtmp) >= 10*(currinf.fontp->scaled_size_in_DVI_units/6))
+                 currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += '\n';
+             }
+@@ -472,6 +483,7 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
+               (currentlyDrawnPage->textBoxList.size() > 0)) {
+             word_boundary_encountered = true;
+             line_boundary_encountered = true;
++            space_encountered = true;
+             if (abs(YYtmp) >= 10*(currinf.fontp->scaled_size_in_DVI_units/6))
+               currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += '\n';
+           }
+@@ -492,6 +504,7 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
+               (currentlyDrawnPage->textBoxList.size() > 0)) {
+             word_boundary_encountered = true;
+             line_boundary_encountered = true;
++            space_encountered = true;
+             if (abs(ZZtmp) >= 10*(currinf.fontp->scaled_size_in_DVI_units/6))
+               currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += '\n';
+           }
+@@ -526,6 +539,7 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
+           if (is_vfmacro == false) {
+             word_boundary_encountered = true;
+             line_boundary_encountered = true;
++            space_encountered = true;
+           }
+           a = readUINT(ch - XXX1 + 1);
+           if (a > 0) {
+@@ -562,6 +576,44 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
+           return;
+         } /* end switch*/
+       } /* end else (ch not a SETCHAR or FNTNUM) */
++
++#ifdef DEBUG_RENDER
++    if (currentlyDrawnPage->textBoxList.size() > 0)
++      kDebug(kvs::dvi) << "Element:"
++                       << currentlyDrawnPage->textBoxList.last().box
++                       << currentlyDrawnPage->textBoxList.last().text
++                       << " ? s:" << space_encountered
++                       << " / nl:" << line_boundary_encountered
++                       << " / w:" << word_boundary_encountered
++                       << ", " << last_space_index << "/"
++                       << currentlyDrawnPage->textBoxList.size();
++#endif
++
++    /* heuristic to properly detect newlines; a space is needed */
++    if (after_space &&
++        line_boundary_encountered && word_boundary_encountered) {
++      if (currentlyDrawnPage->textBoxList.last().text.endsWith('\n'))
++         currentlyDrawnPage->textBoxList.last().text.chop(1);
++      currentlyDrawnPage->textBoxList.last().text += " \n";
++      after_space = false;
++    }
++
++    /* a "space" has been found and there is some (new) character
++       in the array */
++    if (space_encountered &&
++        (currentlyDrawnPage->textBoxList.size() > last_space_index)) {
++      QString lastword(currentlyDrawnPage->textBoxList[last_space_index].text);
++      for (int lidx = last_space_index+1; lidx<currentlyDrawnPage->textBoxList.size(); ++lidx) {
++        // merge two adjacent boxes which are part of the same word
++        lastword += currentlyDrawnPage->textBoxList[lidx].text;
++        currentlyDrawnPage->textBoxList[lidx-1].box.setRight(currentlyDrawnPage->textBoxList[lidx].box.x());
++      }
++#ifdef DEBUG_RENDER
++      kDebug(kvs::dvi) << "space encountered: '" << lastword << "'";
++#endif
++      last_space_index = currentlyDrawnPage->textBoxList.size();
++      after_space = true;
++    }
+   } /* end for */
+ }
+ 
diff -Nru okular-4.8.4/debian/patches/series okular-4.8.4/debian/patches/series
--- okular-4.8.4/debian/patches/series	2012-06-20 14:06:57.000000000 -0300
+++ okular-4.8.4/debian/patches/series	2012-11-27 20:41:58.000000000 -0300
@@ -0,0 +1,3 @@
+upstream_Call-Generator-signalPixmapRequestDone-_after_-savin.patch
+fix_word_detection_with_dvi_docs.diff
+avoid_crash_with_broken_fonts.diff
diff -Nru okular-4.8.4/debian/patches/upstream_Call-Generator-signalPixmapRequestDone-_after_-savin.patch okular-4.8.4/debian/patches/upstream_Call-Generator-signalPixmapRequestDone-_after_-savin.patch
--- okular-4.8.4/debian/patches/upstream_Call-Generator-signalPixmapRequestDone-_after_-savin.patch	1969-12-31 21:00:00.000000000 -0300
+++ okular-4.8.4/debian/patches/upstream_Call-Generator-signalPixmapRequestDone-_after_-savin.patch	2012-11-27 20:41:58.000000000 -0300
@@ -0,0 +1,40 @@
+From edbb4ef9f5aa8f120558b9d4f4b9f68970100c4b Mon Sep 17 00:00:00 2001
+From: Fabio D'Urso <fabiodurso@hotmail.it>
+Date: Tue, 17 Jul 2012 20:35:54 +0200
+Subject: [PATCH] Call Generator::signalPixmapRequestDone _after_ saving the
+ calculated bounding box
+
+Fixes a bug that causes the extraction of a wrong bounding box:
+
+If the request queue is not empty, signalPixmapRequestDone causes a new
+pixmap request to be started, thus overwriting mPixmapGenerationThread's
+mCalcBoundingBox before it is read by the if in the next line.
+
+Now signalPixmapRequestDone is called after the bounding box is saved,
+so that new requests are started only after all data from
+mPixmapGenerationThread have been saved.
+
+BUG: 257370
+REVIEW: 105600
+---
+ core/generator.cpp |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/core/generator.cpp b/core/generator.cpp
+index 0073943..72993c0 100644
+--- a/core/generator.cpp
++++ b/core/generator.cpp
+@@ -102,9 +102,9 @@ void GeneratorPrivate::pixmapGenerationFinished()
+     request->page()->setPixmap( request->id(), new QPixmap( QPixmap::fromImage( img ) ) );
+     const int pageNumber = request->page()->number();
+ 
+-    q->signalPixmapRequestDone( request );
+     if ( mPixmapGenerationThread->calcBoundingBox() )
+         q->updatePageBoundingBox( pageNumber, mPixmapGenerationThread->boundingBox() );
++    q->signalPixmapRequestDone( request );
+ }
+ 
+ void GeneratorPrivate::textpageGenerationFinished()
+-- 
+1.7.10.4
+

Reply to: