Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 21627 - imagemagick ebuild hangs. pdfwriter (ghostscript) patch to use urandom
Summary: imagemagick ebuild hangs. pdfwriter (ghostscript) patch to use urandom
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Printing (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Printing Team
URL: http://www.ghostscript.com/pipermail/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-24 13:51 UTC by Aric LeDell
Modified: 2003-07-16 07:06 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
one liner to use /dev/urandom against ghostscript-7.05.5 Should apply to all versions (urandom-simple.patch,478 bytes, patch)
2003-05-24 15:40 UTC, Aric LeDell
Details | Diff
The other attachment should apply to all ghostscript-7* trees (ghostscript-7.05.5.ebuild-patch,337 bytes, patch)
2003-05-24 15:45 UTC, Aric LeDell
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Aric LeDell 2003-05-24 13:51:28 UTC
The ImageMagick ebuild probes for a pdfwriter during ./configure.
The ghostscript command used to probe for pdfwriter is:
  gs -q -dBATCH -sDEVICE=pdfwrite -sOutputFile=/dev/null
This hangs if /dev/random does not have enough entropy.

This patch makes gs use /dev/urandom during pdf generation

Reproducible: Sometimes
Steps to Reproduce:
1.
2.
3.




--- src/gdevpdf.c-dist  2003-05-24 13:20:16.000000000 -0400
+++ src/gdevpdf.c       2003-05-24 13:35:35.000000000 -0400
@@ -503,8 +503,17 @@
        /*
          * If we're on a system that provides /dev/random, that's the best
          * source of random bits.
+        *
+         * prefer /dev/urandom to /dev/random for generating font subset id
+         * prefixes. The former is less random and less commonly implemented
than the
+         * former, however /dev/random can block for long times while entropy
accumulates,
+         * slowing down applications that make frequent invocations. Our
requirements
+         * for randomness here aren't particularly stringent.
+        *
+         * Patch idea from: Ralph Giles <giles@casper.ghostscript.com>
+         * http://www.ghostscript.com/pipermail/gs-cvs/2003-January/002812.html
         */
-       FILE *rfile = fopen("/dev/random", "rb");
+       FILE *rfile = fopen("/dev/urandom", "rb");

        if (rfile && fread(&pdev->random_offset, sizeof(pdev->random_offset),
                           1, rfile) == sizeof(pdev->random_offset)
Comment 1 Aric LeDell 2003-05-24 15:40:42 UTC
Created attachment 12369 [details, diff]
one liner to use /dev/urandom against ghostscript-7.05.5  Should apply to all versions

I'm not quite sure how to make epatch work independent of ${P}
Comment 2 Aric LeDell 2003-05-24 15:45:43 UTC
Created attachment 12370 [details, diff]
The other attachment should apply to all ghostscript-7* trees

Patch to 7.05.5.ebuild	Should be easy to stick into other ebuilds
Comment 3 Aric LeDell 2003-05-26 15:25:31 UTC
Obviously, the bigger concern is why my /dev/random is starved. 
Indeed, /proc/sys/kernel/random/entropy_avail reports 0 
Comment 4 Thomas Raschbacher gentoo-dev 2003-06-19 04:03:46 UTC
will have a look .. sorry for the delay there was a problem with the mail alias so i didn't get the Bugzilla mails
Comment 5 Heinrich Wendel (RETIRED) gentoo-dev 2003-07-16 07:06:23 UTC
ghostscript-7.05.6-r3 now in portage ...