Às 19:37 de 21/09/23, Mike Gabriel escreveu:
HI Rui,

thanks for reporting the below issue.

[...]>
However, we can tweak cups-x2go [1]. It would be nice if you could experiment with that a little and move the "$ENV{TMPDIR}="/tmp";" statement that is part of the script to the very top of the script (after all the "use ...;" statements.

When done, remove your hack again (which brings back more security into your CUPS daemon) and re-test cups-x2go. Let me know if that works for you. If so, please send your patch.

Thanks,
Mike

Hello Mike

Thank you for your fast response and sorry for my slow one.

It wasn't that, but your tip showed me the way.
The answer begins here:

https://git.ghostscript.com/?p=ghostpdl.git&a=search&h=HEAD&st=commit&s=setpdfwrite

Ghostscript deprecated 'setpdfwrite' in 2019 and removed it in 2021, or version 9.54.
To solve this, I edited /etc/cups/cups-x2go.conf:

ps2pdf = /usr/bin/gs -q -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile=- -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -dDoNumCopies -f \"%s\"

This alone should've solved my problem... yet it wasn't working :(
After many hours of self commiseration, I found that the culprit to be a leading space in the command, in this line

my $gs_pid = open2 ($gs_out, $gs_in, $ps2pdf_cmd, @ps2pdf_args);

where $ps2pdf_cmd would translate to ' /usr/bin/gs'.

So, I had to learn just enough Perl to correct this:

if($option eq "ps2pdf")
{
        $ps2pdf=$value;
        $ps2pdf=~s/^\s+//; <-------- my solution
}

Now, about sending patches... I've never done it before.

I'm not sure if just changing the default ghostscript command line, hardcoded in the Perl script and the .conf file, is the best solution for everyone. And I'm not sure if the way I found to trim that leading whitespace is the best solution.

I'm too uncertain.

Regards,
Rui Ferreira
_______________________________________________
x2go-user mailing list
x2go-user@lists.x2go.org
https://lists.x2go.org/listinfo/x2go-user

Reply via email to