[X2Go-Commits] [cups-x2go] 02/04: cups-x2go: read output from ghostscript, don't write a filehandle to the temporary file.

git-admin at x2go.org git-admin at x2go.org
Tue Jun 16 02:29:57 CEST 2015


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository cups-x2go.

commit 6bb95f9fa18769d1b69ae7b9e93dc268ae977345
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Tue Jun 16 02:12:19 2015 +0200

    cups-x2go: read output from ghostscript, don't write a filehandle to the temporary file.
    
    Fixes a hanging ghostscript call and... well... random junk, instead of a "real" PDF file.
---
 cups-x2go        |   12 +++++++++++-
 debian/changelog |    3 +++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/cups-x2go b/cups-x2go
index 3161578..76f6bdb 100755
--- a/cups-x2go
+++ b/cups-x2go
@@ -230,6 +230,16 @@ my ($pdf_fh, $pdfFile) = tempfile ($pdf_template, TMPDIR => 1);
 $ENV{TMPDIR}="/tmp";
 my ($gs_out, $gs_in, $wait_ret, $real_ret);
 my $gs_pid = open2 ($gs_out, $gs_in, $ps2pdf_cmd, @ps2pdf_args);
+
+binmode $gs_out :raw;
+
+close $gs_in;
+
+# Force readline to not read "lines", but raw data. Get all output from ghostscript.
+my $gs_out_data = do { local $/; readline ($gs_out) };
+
+close $gs_out;
+
 waitpid ($gs_pid, 0);
 
 $wait_ret = $?;
@@ -259,7 +269,7 @@ if ($conv_fail) {
 
 syslog('debug', "cups-x2go processed postscript file $psFile to $pdfFile");
 
-print $pdf_fh $gs_out;
+print $pdf_fh $gs_out_data;
 close ($pdf_fh);
 
 # after we have created the PDF from CUPS's PS file, we can drop the PS file
diff --git a/debian/changelog b/debian/changelog
index 0c67388..64fe153 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,9 @@ cups-x2go (3.0.1.3-0x2go1) UNRELEASED; urgency=low
       like.)
     - cups-x2go: actually print "real" executed command instead of the
       "original" one with placeholders.
+    - cups-x2go: read output from ghostscript, don't write a filehandle to the
+      temporary file. Fixes a hanging ghostscript call and... well... random
+      junk, instead of a "real" PDF file.
   * debian/control:
     - Add dependencies on perl-modules for core modules and ${perl:Depends}
       for perl itself.

--
Alioth's /srv/git/code.x2go.org/cups-x2go.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/cups-x2go.git


More information about the x2go-commits mailing list