This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository cups-x2go. from f1f6a29 cups-x2go: fix print call... new c9fbdad cups-x2go: add correct :raw layer to binmode calls. new 9890adf cups-x2go: fix tiny typo. new 6cdc59f cups-x2go: read data from GS and STDIN in chunks of 8 kbytes, instead of everything at once. new 59673d6 cups-x2go: add parentheses to close() calls. new f1afed2 cups-x2go: delete PDF and title temporary files automatically. new 715dce0 cups-x2go: unlink PS temporary file on-demand in END block. new d2b4c32 cups-x2go: don't use unlink() explicitly. The 7 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: cups-x2go | 87 ++++++++++++++++++++++++++++++++++++++++++------------ debian/changelog | 11 +++++++ 2 files changed, 79 insertions(+), 19 deletions(-) -- Alioth's /srv/git/code.x2go.org/cups-x2go.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/cups-x2go.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository cups-x2go. commit c9fbdad5366a8d6910c28039cfa64f508d7e405b Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Jun 17 17:48:07 2015 +0200 cups-x2go: add correct :raw layer to binmode calls. --- cups-x2go | 7 ++++++- debian/changelog | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cups-x2go b/cups-x2go index f2fe3c0..73f7c20 100755 --- a/cups-x2go +++ b/cups-x2go @@ -205,6 +205,10 @@ if (!$psFile) { my ($tfh, $tempFile) = tempfile ($ps_template, TMPDIR => 1); syslog('info', "Print job comes from STDIN, writing incoming job to temp file $tempFile\n"); + + binmode ($tfh, ":raw"); + binmode (STDIN, ":raw"); + while(<STDIN>) { print $tfh $_; @@ -231,7 +235,8 @@ $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); +binmode ($gs_out, ":raw"); +binmode ($pdf_fh, ":raw"); close ($gs_in); diff --git a/debian/changelog b/debian/changelog index 930a86d..f4e35da 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,7 @@ cups-x2go (3.0.1.3-0x2go1) UNRELEASED; urgency=low - cups-x2go: fix binmode() call, :raw layer is implicit. - cups-x2go: fix print call... Does not allow to separate parameters with a comma. + - cups-x2go: add correct :raw layer to binmode calls. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository cups-x2go. commit 9890adfe0bc0094e8a3cd0faa77ad260a0ff0afa Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Jun 17 19:19:58 2015 +0200 cups-x2go: fix tiny typo. --- cups-x2go | 2 +- debian/changelog | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cups-x2go b/cups-x2go index 73f7c20..ec3d813 100755 --- a/cups-x2go +++ b/cups-x2go @@ -262,7 +262,7 @@ elsif ($wait_ret & 127) { } else { if (0 != $real_ret) { - syslog('err', "ERROR: ps2pdf conversion program failed to convert $psFile: failed with exit code$real_ret"); + syslog('err', "ERROR: ps2pdf conversion program failed to convert $psFile: failed with exit code $real_ret"); $conv_fail = 1; } } diff --git a/debian/changelog b/debian/changelog index f4e35da..ffba160 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,7 @@ cups-x2go (3.0.1.3-0x2go1) UNRELEASED; urgency=low - cups-x2go: fix print call... Does not allow to separate parameters with a comma. - cups-x2go: add correct :raw layer to binmode calls. + - cups-x2go: fix tiny typo. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository cups-x2go. commit 6cdc59f5faebca238f9f1aa706a223715dd0a039 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Jun 17 19:22:56 2015 +0200 cups-x2go: read data from GS and STDIN in chunks of 8 kbytes, instead of everything at once. Handles large print jobs gracefully. --- cups-x2go | 46 +++++++++++++++++++++++++++++++++++++++------- debian/changelog | 2 ++ 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/cups-x2go b/cups-x2go index ec3d813..ae26dd5 100755 --- a/cups-x2go +++ b/cups-x2go @@ -25,6 +25,7 @@ use File::Copy; use File::Temp qw( tempfile ); use IPC::Open2; use Text::ParseWords; +use Errno qw( EINTR EIO :POSIX ); use strict; openlog($0,'cons,pid','user'); @@ -209,9 +210,25 @@ if (!$psFile) binmode ($tfh, ":raw"); binmode (STDIN, ":raw"); - while(<STDIN>) + # Get all input from CUPS. { - print $tfh $_; + # Force readline to not read "lines", but raw data, 8192 bytes at a time. + local $/ = \8192; + + while (!eof (STDIN)) { + if (defined (my $stdin_data = readline (*STDIN))) { + print $tfh $stdin_data; + } + else { + if ($!{EAGAIN} || $!{EWOULDBLOCK} || $!{EINTR}) { + continue; + } + else { + syslog ('err', "Error while reading data from stdin: $!\n"); + die ("Error while reading data from stdin: $!\n"); + } + } + } } close $tfh; @@ -240,8 +257,26 @@ binmode ($pdf_fh, ":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) }; +# Get all input from GS. +{ + # Force readline to not read "lines", but raw data, 8192 bytes at a time. + local $/ = \8192; + + while (!eof ($gs_out)) { + if (defined (my $gs_out_data = readline ($gs_out))) { + print $pdf_fh $gs_out_data; + } + else { + if ($!{EAGAIN} || $!{EWOULDBLOCK} || $!{EINTR}) { + continue; + } + else { + syslog ('err', "ERROR: reading data from ps2pdf program failed: $!\n"); + die ("$0: Error reading data from ps2pdf program failed: $!\n"); + } + } + } +} close ($gs_out); @@ -274,9 +309,6 @@ if ($conv_fail) { syslog('debug', "cups-x2go processed postscript file $psFile to $pdfFile"); -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 unlink ($psFile); diff --git a/debian/changelog b/debian/changelog index ffba160..2f97415 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,6 +16,8 @@ cups-x2go (3.0.1.3-0x2go1) UNRELEASED; urgency=low a comma. - cups-x2go: add correct :raw layer to binmode calls. - cups-x2go: fix tiny typo. + - cups-x2go: read data from GS and STDIN in chunks of 8 kbytes, instead of + everything at once. Handles large print jobs gracefully. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository cups-x2go. commit 59673d6d6e19cae2ab25426524d775512b7a681e Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Jun 17 19:23:51 2015 +0200 cups-x2go: add parentheses to close() calls. --- cups-x2go | 3 ++- debian/changelog | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cups-x2go b/cups-x2go index ae26dd5..db2043b 100755 --- a/cups-x2go +++ b/cups-x2go @@ -230,7 +230,8 @@ if (!$psFile) } } } - close $tfh; + + close ($tfh); $psFile = $tempFile; } diff --git a/debian/changelog b/debian/changelog index 2f97415..aabb3a0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,7 @@ cups-x2go (3.0.1.3-0x2go1) UNRELEASED; urgency=low - cups-x2go: fix tiny typo. - cups-x2go: read data from GS and STDIN in chunks of 8 kbytes, instead of everything at once. Handles large print jobs gracefully. + - cups-x2go: add parentheses to close() calls. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository cups-x2go. commit f1afed2f68508663c8c202a7cd31f356d6a63fe1 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Jun 17 19:50:58 2015 +0200 cups-x2go: delete PDF and title temporary files automatically. --- cups-x2go | 4 ++-- debian/changelog | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cups-x2go b/cups-x2go index db2043b..ff0cee5 100755 --- a/cups-x2go +++ b/cups-x2go @@ -246,7 +246,7 @@ for (my $i = 0; $i < @ps2pdf_args; ++$i) { syslog('info', "Converting printjob with command: $ps2pdf_cmd " . join (" ", @ps2pdf_args) . "\n"); -my ($pdf_fh, $pdfFile) = tempfile ($pdf_template, TMPDIR => 1); +my ($pdf_fh, $pdfFile) = tempfile ($pdf_template, UNLINK => 1, TMPDIR => 1); # the TMPDIR env var is needed for ghostscript... $ENV{TMPDIR}="/tmp"; @@ -313,7 +313,7 @@ syslog('debug', "cups-x2go processed postscript file $psFile to $pdfFile"); # after we have created the PDF from CUPS's PS file, we can drop the PS file unlink ($psFile); -my ($title_fh, $titleFile) = tempfile ($title_template, TMPDIR => 1); +my ($title_fh, $titleFile) = tempfile ($title_template, UNLINK => 1, TMPDIR => 1); print $title_fh $jobTitle; close ($title_fh); diff --git a/debian/changelog b/debian/changelog index aabb3a0..52caaa7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,6 +19,7 @@ cups-x2go (3.0.1.3-0x2go1) UNRELEASED; urgency=low - cups-x2go: read data from GS and STDIN in chunks of 8 kbytes, instead of everything at once. Handles large print jobs gracefully. - cups-x2go: add parentheses to close() calls. + - cups-x2go: delete PDF and title temporary files automatically. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository cups-x2go. commit 715dce02a361c9f12af10af5858789cfdcfafdae Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Jun 17 19:54:48 2015 +0200 cups-x2go: unlink PS temporary file on-demand in END block. Also move closelog to END block, because we want to print diagnosis messages in the END block. --- cups-x2go | 14 +++++++++++--- debian/changelog | 3 +++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cups-x2go b/cups-x2go index ff0cee5..2b8e492 100755 --- a/cups-x2go +++ b/cups-x2go @@ -202,9 +202,11 @@ my $template = "$jid-$uid-cupsjob$$"; my $ps_template = $template . "X" x 16; my $pdf_template = $template . ".pdf" . "X" x 16; my $title_template = $template . ".pdf.title" . "X" x 16; +my $need_ps_file_cleanup = 0; if (!$psFile) { - my ($tfh, $tempFile) = tempfile ($ps_template, TMPDIR => 1); + $need_ps_file_cleanup = 1; + my ($tfh, $tempFile) = tempfile ($ps_template, UNLINK => 0, TMPDIR => 1); syslog('info', "Print job comes from STDIN, writing incoming job to temp file $tempFile\n"); binmode ($tfh, ":raw"); @@ -333,5 +335,11 @@ for(my $i=0; $i<scalar(@sessions);$i++ ) unlink ($pdfFile); unlink ($titleFile); -# closing syslog -closelog; +END { + if ($need_ps_file_cleanup) { + unlink $psFile or syslog ('warning', "WARNING: cups-x2go: unable to delete temporary postscript file $psFile\n"); + } + + # closing syslog + closelog; +} diff --git a/debian/changelog b/debian/changelog index 52caaa7..3f307fb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -20,6 +20,9 @@ cups-x2go (3.0.1.3-0x2go1) UNRELEASED; urgency=low everything at once. Handles large print jobs gracefully. - cups-x2go: add parentheses to close() calls. - cups-x2go: delete PDF and title temporary files automatically. + - cups-x2go: unlink PS temporary file on-demand in END block. Also move + closelog to END block, because we want to print diagnosis messages in + the END block. * 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository cups-x2go. commit d2b4c322092dd56b4f5eb9c9c810c413868b1722 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Jun 17 20:08:16 2015 +0200 cups-x2go: don't use unlink() explicitly. Trust File::Temp and our END block to clean up correctly. --- cups-x2go | 11 +++++++---- debian/changelog | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cups-x2go b/cups-x2go index 2b8e492..404d96f 100755 --- a/cups-x2go +++ b/cups-x2go @@ -206,6 +206,7 @@ my $need_ps_file_cleanup = 0; if (!$psFile) { $need_ps_file_cleanup = 1; + my ($tfh, $tempFile) = tempfile ($ps_template, UNLINK => 0, TMPDIR => 1); syslog('info', "Print job comes from STDIN, writing incoming job to temp file $tempFile\n"); @@ -312,8 +313,11 @@ if ($conv_fail) { syslog('debug', "cups-x2go processed postscript file $psFile to $pdfFile"); -# after we have created the PDF from CUPS's PS file, we can drop the PS file -unlink ($psFile); +# After we have created the PDF from CUPS's PS file, we can drop the PS file. +# If we read data from STDIN, though, let the END block handle this cleanup. +if (!$need_ps_file_cleanup) { + unlink ($psFile); +} my ($title_fh, $titleFile) = tempfile ($title_template, UNLINK => 1, TMPDIR => 1); print $title_fh $jobTitle; @@ -332,8 +336,7 @@ for(my $i=0; $i<scalar(@sessions);$i++ ) } } -unlink ($pdfFile); -unlink ($titleFile); +# Temporary file cleanup is hopefully handled correctly by File::Temp. END { if ($need_ps_file_cleanup) { diff --git a/debian/changelog b/debian/changelog index 3f307fb..c756d05 100644 --- a/debian/changelog +++ b/debian/changelog @@ -23,6 +23,8 @@ cups-x2go (3.0.1.3-0x2go1) UNRELEASED; urgency=low - cups-x2go: unlink PS temporary file on-demand in END block. Also move closelog to END block, because we want to print diagnosis messages in the END block. + - cups-x2go: don't use unlink() explicitly. Trust File::Temp and our END + block to clean up correctly. * 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