You are not logged in.

#26 2010-12-11 15:20:24

taavi
Member
From: Tartu, Estonia
Registered: 2010-10-10
Posts: 50
Website

Re: PDF segfaults evince

Hm, I installed this new PKGBUILD, but for me evince is still crashing.

Offline

#27 2010-12-11 15:28:35

jib2
Member
From: Paris, France
Registered: 2009-08-13
Posts: 93

Re: PDF segfaults evince

Did you logout/login ?

Offline

#28 2010-12-11 15:32:10

taavi
Member
From: Tartu, Estonia
Registered: 2010-10-10
Posts: 50
Website

Re: PDF segfaults evince

Ow. OK, works now smile

Offline

#29 2010-12-11 15:48:16

jib2
Member
From: Paris, France
Registered: 2009-08-13
Posts: 93

Re: PDF segfaults evince

Libreoffice still crashes when "embolding" a font that doesn't have a bold typeface.
See http://www.infinality.net/forum/viewtopic.php?f=2&t=48

But it's a minor bug and anyway it did already with previous packages.

Offline

#30 2010-12-11 17:00:49

jxy
Member
Registered: 2008-12-03
Posts: 133

Re: PDF segfaults evince

The patch, freetype-2.4.3-20101114-infinality-apply-env-defaults.patch, forcefully apply recommended settings, and in addition to that, you recommend that the environment variables should not be used.  I cannot see the relation between that and the crash, except there are some errors in parsing the variables.  And what happens if you change some of the environment variables with the original PKGBUILD.  Does it still crash?

Can you try with only the system zlib, by only adding the sed line to the original PKGBUILD?

Do you guys actually have a back-trace of the crash?

I am sorry that I am asking a lot, but I am not content without finding out the true culprit.

Offline

#31 2010-12-11 17:15:32

frabjous
Member
Registered: 2010-07-13
Posts: 367

Re: PDF segfaults evince

OK, I just tried it with the just the sed line for zlib and without breb's patch, and that alone seems to fix the problem.

Thanks for suggesting it. I wouldn't have been happy with having any settings forced on me.

The PKGBUILD I used was this:

# Contributor: JIN Xiao-Yong <jinxiaoyong@gmail.com>
# Contributor: jib <jbc.as (AT) free.fr>

pkgname=freetype2-infinality
pkgver=2.4.4
pkgrel=3
pkgdesc="TrueType font rendering library with infinality patch"
arch=(i686 x86_64)
license=('GPL')
url="http://freetype.sourceforge.net"
depends=('zlib')
conflicts=('freetype2')
provides=("freetype2=$pkgver")
options=('!libtool')
source=(http://downloads.sourceforge.net/sourceforge/freetype/freetype-${pkgver}.tar.bz2
        http://perso.orange.fr/jbco/dl/freetype-2.2.1-enable-valid.patch
        http://www.infinality.net/files/freetype-add-subpixel-hinting-infinality-20101114-1.patch
        http://www.infinality.net/files/freetype-enable-subpixel-hinting-infinality-20100909-1.patch
        http://www.infinality.net/files/freetype-entire-infinality-patchset-20101114-1.patch)

build() {
  cd "${srcdir}/freetype-${pkgver}"
  local patch_file
  for patch_file in "${source[@]:2}"; do
      patch -Np1 -i "${srcdir}/${patch_file##*/}"
  done
  sed -i -r 's:.*(#.*SYSTEM_ZLIB.*) .*:\1:' ${srcdir}/freetype-2.4.4/include/freetype/config/ftoption.h

  ./configure --prefix=/usr
  make
}

package() {
  cd "${srcdir}/freetype-${pkgver}"

  make DESTDIR="${pkgdir}" install
}

md5sums=('b3e2b6e2f1c3e0dffa1fd2a0f848b671'
         '214119610444c9b02766ccee5e220680'
         '799a2d229c2997a5bb2d5b7c9f92fdba'
         'a88b1a66da44a90c1fdcdeaa39a2dc09'
         '6725774b17820f5413cb6a3cf7547f53')

I assume that's what you meant, right?

Last edited by frabjous (2010-12-11 17:19:17)

Offline

#32 2010-12-11 19:46:58

jib2
Member
From: Paris, France
Registered: 2009-08-13
Posts: 93

Re: PDF segfaults evince

@frabjous: You omitted infinality-settings.sh; then you can't change the settings...

With infinality-settings.sh and sed line for zlib, evince still crashes on some pdfs.

Offline

#33 2010-12-11 20:16:44

goddesse
Member
Registered: 2009-08-03
Posts: 13

Re: PDF segfaults evince

jxy wrote:

The patch, freetype-2.4.3-20101114-infinality-apply-env-defaults.patch, forcefully apply recommended settings, and in addition to that, you recommend that the environment variables should not be used.  I cannot see the relation between that and the crash, except there are some errors in parsing the variables.  And what happens if you change some of the environment variables with the original PKGBUILD.  Does it still crash?

Using system zlib has no effect on the crash. The minimum change required to eliminate the crash (i.e. using the original PKGBUILD you provided in the aur) is to remove infinality_settings.sh. Going further through the process of elimination, the environment variable that's triggering the segmentation fault is INFINALITY_FT_STEM_ALIGNMENT_TYPE. So when this environment variable is getting read, that's where the crash happens.

Do you guys actually have a back-trace of the crash?

$ gdb --args zathura calendario_escolar_10-11_final.pdf 
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/zathura...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/zathura calendario_escolar_10-11_final.pdf
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b03184 in strcasestr () from /lib/libc.so.6
(gdb) generate-core-file
Saved corefile core.4305
(gdb) backtrace
#0  0x00007ffff7b03184 in strcasestr () from /lib/libc.so.6
#1  0x00007ffff38e286b in ?? () from /usr/lib/libfreetype.so.6
#2  0x00007ffff3925583 in ?? () from /usr/lib/libfreetype.so.6
#3  0x00007ffff38dd6cd in FT_Render_Glyph_Internal () from /usr/lib/libfreetype.so.6
#4  0x00007ffff65495d4 in ?? () from /usr/lib/libcairo.so.2
#5  0x00007ffff651c1f0 in ?? () from /usr/lib/libcairo.so.2
#6  0x00007ffff6501026 in ?? () from /usr/lib/libcairo.so.2
#7  0x00007ffff65023bc in ?? () from /usr/lib/libcairo.so.2
#8  0x00007ffff650299e in ?? () from /usr/lib/libcairo.so.2
#9  0x00007ffff652284d in ?? () from /usr/lib/libcairo.so.2
#10 0x00007ffff64fc2a6 in ?? () from /usr/lib/libcairo.so.2
#11 0x00007ffff64f2aa0 in cairo_show_glyphs () from /usr/lib/libcairo.so.2
#12 0x00007ffff6f26efc in CairoOutputDev::endString(GfxState*) () from /usr/lib/libpoppler-glib.so.5
#13 0x00007ffff27002cf in Gfx::doShowText(GooString*) () from /usr/lib/libpoppler.so.7
#14 0x00007ffff2700615 in Gfx::opShowSpaceText(Object*, int) () from /usr/lib/libpoppler.so.7
#15 0x00007ffff26f8a90 in Gfx::go(int) () from /usr/lib/libpoppler.so.7
#16 0x00007ffff26f8eb4 in Gfx::display(Object*, int) () from /usr/lib/libpoppler.so.7
#17 0x00007ffff2730710 in Page::displaySlice(OutputDev*, double, double, int, int, int, int, int, int, int, int, Catalog*, int (*)(void*), void*, int (*)(Annot*, void*), void*) () from /usr/lib/libpoppler.so.7
#18 0x00007ffff6f1e7b7 in ?? () from /usr/lib/libpoppler-glib.so.5
#19 0x0000000000407ae3 in ?? ()
#20 0x000000000040bed2 in ?? ()
#21 0x000000000040e9f2 in ?? ()
#22 0x0000000000410535 in ?? ()
#23 0x00007ffff7aa0c4d in __libc_start_main () from /lib/libc.so.6
#24 0x0000000000405e99 in ?? ()
#25 0x00007fffffffe7c8 in ?? ()
#26 0x000000000000001c in ?? ()
#27 0x0000000000000002 in ?? ()
#28 0x00007fffffffeaaa in ?? ()
#29 0x00007fffffffeabb in ?? ()
#30 0x0000000000000000 in ?? ()

So strcasestr is causing the segmentation fault. If you patch the file src/base/ftlcdfil.c around 180 or so to remove the calls to strcasestr, the segmentation fault goes away. I can't immediately see any anything wrong with how the author called strcasestr itself, so it seems how FT_GlyphSlot is accessed is the true culprit.

EDIT:
Further debugging reveals that slot->face->style_name can be NULL so there just needs to be a check before any attempts to call strcasestr like wrapping the entire section of _lcd_stem_align that calls strcasestr with:

        if( slot->face->style_name )
        {

        if ( /*strstr(slot.metrics->root.scaler.face->style_name, "Regular")
          || strstr(slot.metrics->root.scaler.face->style_name, "Book")
          || strstr(slot.metrics->root.scaler.face->style_name, "Medium")
          || */strcasestr(slot->face->style_name, "Italic")
          || strcasestr(slot->face->style_name, "Oblique") )
          alignment_type = 0;
        if ( strcasestr(slot->face->style_name, "Bold") )
          alignment_type = 0;
        }

Last edited by goddesse (2010-12-11 21:12:55)

Offline

#34 2010-12-11 23:59:06

frabjous
Member
Registered: 2010-07-13
Posts: 367

Re: PDF segfaults evince

jib2 wrote:

@frabjous: You omitted infinality-settings.sh; then you can't change the settings...

With infinality-settings.sh and sed line for zlib, evince still crashes on some pdfs.

This is your package build. All I did was take out breb's patch. If infinality-settings.sh was removed, it was you who did it, not I!

Offline

#35 2010-12-12 02:36:01

jxy
Member
Registered: 2008-12-03
Posts: 133

Re: PDF segfaults evince

Great job, goddesse!  Let me make a patch and I'll upload the new PKGBUILD shortly.

Offline

#36 2010-12-12 02:45:37

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: PDF segfaults evince

jxy wrote:

The patch, freetype-2.4.3-20101114-infinality-apply-env-defaults.patch, forcefully apply recommended settings

"Forcefully?"  Wrong. It sets sane *defaults* for good-looking fonts, which can be overridden by "export" commands.

Offline

#37 2010-12-12 02:49:08

frabjous
Member
Registered: 2010-07-13
Posts: 367

Re: PDF segfaults evince

brebs wrote:
jxy wrote:

The patch, freetype-2.4.3-20101114-infinality-apply-env-defaults.patch, forcefully apply recommended settings

"Forcefully?"  Wrong. It sets sane *defaults* for good-looking fonts, which can be overridden by "export" commands.

You do realize that such things are subjective? I have, for example, tried your .fonts.conf, but much prefer my own much more minimal one.

Offline

#38 2010-12-12 03:08:18

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: PDF segfaults evince

frabjous, you have contributed a lot of nonsense to this thread - kindly remove your hands from the keyboard and step away slowly. A default can be overriden by the exports. It's just a default. And, on the totally different subject which I'm amazed you're throwing into this - ~/.fonts.conf can be customized to your heart's content, that's the point of it, it's yours.

And it's tedious to have to explain these obvious things.

Offline

#39 2010-12-12 03:18:37

frabjous
Member
Registered: 2010-07-13
Posts: 367

Re: PDF segfaults evince

You have a very odd grasp of the situation, my friend. I never said anything couldn't be overridden. I cannot fathom what other nonsense you think I've contributed. If you read the thread, I think you'll see that (1) I was the person who identified what package was causing the trouble, (2) I, unlike you, at least tried to contribute to a solution empirically, even if my efforts were not the end of the story. But I really have no interest in arguing with you.

Offline

#40 2010-12-12 04:19:29

goddesse
Member
Registered: 2009-08-03
Posts: 13

Re: PDF segfaults evince

frabjous wrote:

(2) I, unlike you, at least tried to contribute to a solution empirically, even if my efforts were not the end of the story.

That's really not true. Paul's patch made it apparent that something was wrong with the envvar settings in the first place and he's been kind enough to cross-post various forms of help to the Arch board when he doesn't even use this distribution anymore. I think that's awesome of him and I really appreciate it.

Offline

#41 2010-12-12 04:27:14

frabjous
Member
Registered: 2010-07-13
Posts: 367

Re: PDF segfaults evince

OK, but he doesn't have to act all trollish towards people trying to help who maybe don't have as much experience as he does.

Offline

#42 2010-12-12 07:17:46

jib2
Member
From: Paris, France
Registered: 2009-08-13
Posts: 93

Re: PDF segfaults evince

frabjous wrote:
jib2 wrote:

@frabjous: You omitted infinality-settings.sh; then you can't change the settings...

With infinality-settings.sh and sed line for zlib, evince still crashes on some pdfs.

This is your package build. All I did was take out breb's patch. If infinality-settings.sh was removed, it was you who did it, not I!

Just FYI, I did that because i added brebs patch which set built-in default values.
If you remove infinality-settings and don't add this patch, you have no settings at all.

Offline

#43 2010-12-12 19:25:19

goddesse
Member
Registered: 2009-08-03
Posts: 13

Re: PDF segfaults evince

I was trying to figure out why libreoffice was crashing when a font without a built-in bold face was used and it turns out it's an analogous situation to the previous poppler crash. Sometimes the struct member face (FT_GlyphSlot) or one of its constituents don't always get initialized and they too have to be checked for NULL before using them. This is a patch which supersedes (meaning it should be used in place of) the current patch that jxy kindly made for the AUR.

diff -Naur freetype-2.4.4/src/base/ftlcdfil.c freetype-2.4.4.new/src/base/ftlcdfil.c
--- freetype-2.4.4/src/base/ftlcdfil.c    2010-12-12 12:05:21.606671258 -0600
+++ freetype-2.4.4.new/src/base/ftlcdfil.c    2010-12-12 12:08:17.726671242 -0600
@@ -180,14 +180,17 @@
         else if (strcasecmp(alignment_type_env, "infinality1") == 0) alignment_type = 6;
         else alignment_type = 0;
 
-        if ( /*strstr(slot.metrics->root.scaler.face->style_name, "Regular")
-          || strstr(slot.metrics->root.scaler.face->style_name, "Book")
-          || strstr(slot.metrics->root.scaler.face->style_name, "Medium")
-          ||*/ strcasestr(slot->face->style_name, "Italic")
-          || strcasestr(slot->face->style_name, "Oblique") )
-          alignment_type = 0;
-        if ( strcasestr(slot->face->style_name, "Bold") )
-          alignment_type = 0;
+        if ( slot->face != NULL && slot->face->style_name != NULL )
+        {
+          if ( /*strstr(slot.metrics->root.scaler.face->style_name, "Regular")
+            || strstr(slot.metrics->root.scaler.face->style_name, "Book")
+            || strstr(slot.metrics->root.scaler.face->style_name, "Medium")
+            ||*/ strcasestr(slot->face->style_name, "Italic")
+            || strcasestr(slot->face->style_name, "Oblique") )
+            alignment_type = 0;
+          if ( strcasestr(slot->face->style_name, "Bold") )
+            alignment_type = 0;
+        }
       }
       checked_alignment_type = 1;
     }
@@ -214,16 +217,19 @@
     /*printf("%s,%s ", slot->face->family_name, slot->face->style_name);*/
     /*printf("%d ", slot->face->size->metrics.x_ppem);*/
 
-    /* set gamma value to 1 if out of range */
-    if ( slot->face->size->metrics.x_ppem >= pseudo_gamma_lt )
+    if ( slot->face && slot->face->size )
     {
-      pseudo_gamma_value = 1;
-    }
+        /* set gamma value to 1 if out of range */
+        if ( slot->face->size->metrics.x_ppem >= pseudo_gamma_lt )
+        {
+          pseudo_gamma_value = 1;
+        }
 
-    /* don't do alignment for < 10 */
-    if ( slot->face->size->metrics.x_ppem < 10 )
-    {
-      alignment_type = 0;
+        /* don't do alignment for < 10 */
+        if ( slot->face->size->metrics.x_ppem < 10 )
+        {
+          alignment_type = 0;
+        }
     }
 
     if ( mode == FT_RENDER_MODE_LCD )
@@ -642,7 +648,9 @@
       if ( pseudo_gamma_value != 1 )
       {
         FT_Byte*  line = bitmap->buffer;
-        float ppem = (float)slot->face->size->metrics.x_ppem;
+        float ppem = 0;
+        if ( slot->face && slot->face->size )
+            ppem = (float)slot->face->size->metrics.x_ppem;
 
         if (ppem >= 5 )
         for (height = (FT_UInt)bitmap->rows; height > 0; height--, line += bitmap->pitch )

Caveat:
Now that you can use those fonts that used to crash, you might notice that the cursor and selection box on sizes that are a multiple of 3 don't display correctly. This has nothing to do with my patch, but rather the behavior of freetype-infinality in conjunction with INFINALITY_FT_EMBOLDEN_MAINTAIN_WIDTH=true. Comment that variable out or set it to false to get the correct behavior.

Last edited by goddesse (2010-12-12 19:27:02)

Offline

#44 2010-12-12 21:08:09

jib2
Member
From: Paris, France
Registered: 2009-08-13
Posts: 93

Re: PDF segfaults evince

With this new patch, Libreoffice doesn't crash anymore with fake bold fonts (although i don't see a reason to use these since they look quite ugly).

You fixed these 2 annoying bugs. Great job, goddesse!

Offline

#45 2010-12-12 23:21:44

jxy
Member
Registered: 2008-12-03
Posts: 133

Re: PDF segfaults evince

Well done, goddesse!  Thanks a lot!

Offline

Board footer

Powered by FluxBB