Bug#961909: ghostscript: PDFA_def.ps references srgb.icc with relative path

2020-06-09 Thread Johannes Schauer
Hi,

Quoting Jonas Smedegaard (2020-06-09 14:20:34)
> Quoting Johannes 'josch' Schauer (2020-05-31 11:48:01)
> > using /usr/share/ghostscript/9.27/lib/PDFA_def.ps I can convert a PDF
> > into PDF/A-1b like so:
> > 
> > $ env --chdir=/usr/share/color/icc/ghostscript/ gs -dBATCH -dNOPAUSE \
> > > -dSAFEGR -dPDFA=1 -sProcessColorModel=DeviceRGB 
> > -dPDFACompatibilityPolicy=1
> > > -sDEVICE=pdfwrite -sOutputFile=/tmp/out.pdf \
> > > /usr/share/ghostscript/9.27/lib/PDFA_def.ps \
> > > in.pdf
> > 
> > Using "env --chdir" as well as using an absolute path for OutputFile is
> > necessary because PDFA_def.ps references srgb.icc with a relative path
> > in /usr/share/color/icc/ghostscript/ -- this means that unless the
> > command is executed in /usr/share/color/icc/ghostscript/, PDFA_def.ps is
> > useless and must be edited to contain the right absolute path to
> > srgb.icc.
> > 
> > I propose to either:
> > 
> >  - move PDFA_def.ps to /usr/share/doc/*/examples because it's a file
> >that cannot be used immediately but has to be edited first
> > 
> >  - patch PDFA_def.ps to include the full path to
> >/usr/share/color/icc/ghostscript/srgb.icc so that it can be used from
> >any directory
> 
> Good catch!
> 
> Indeed libgs9 ships with a few files arguably usable only as examples:
> 
> /usr/share/ghostscript/9.27/lib/PDFA_def.ps
> /usr/share/ghostscript/9.27/lib/PDFX_def.ps
> 
> The files document both inline and in VectorDevices.htm that they should 
> be edited before use.
> 
> I am hesitant to moving or patching those files, though, because (as you 
> demonstrate above) it _is_ possible with some path juggling to use those 
> files as-is, and both upstream and consuming code might rely on the 
> files.  Even if never used for anything as examples, I see no harm in 
> leaving the files where they are just to be on the safe side.
> 
> More sensible to me would be to symlink the files to 
> .../doc/libgs9/examples to advertise them as usable as such.
> 
> How do you think about my alternative approach?

that sounds good, thanks!

cheers, josch

signature.asc
Description: signature


Bug#961909: ghostscript: PDFA_def.ps references srgb.icc with relative path

2020-06-09 Thread Jonas Smedegaard
Hi Josch,

Quoting Johannes 'josch' Schauer (2020-05-31 11:48:01)
> using /usr/share/ghostscript/9.27/lib/PDFA_def.ps I can convert a PDF
> into PDF/A-1b like so:
> 
> $ env --chdir=/usr/share/color/icc/ghostscript/ gs -dBATCH -dNOPAUSE \
> > -dSAFEGR -dPDFA=1 -sProcessColorModel=DeviceRGB 
> -dPDFACompatibilityPolicy=1
> > -sDEVICE=pdfwrite -sOutputFile=/tmp/out.pdf \
> > /usr/share/ghostscript/9.27/lib/PDFA_def.ps \
> > in.pdf
> 
> Using "env --chdir" as well as using an absolute path for OutputFile is
> necessary because PDFA_def.ps references srgb.icc with a relative path
> in /usr/share/color/icc/ghostscript/ -- this means that unless the
> command is executed in /usr/share/color/icc/ghostscript/, PDFA_def.ps is
> useless and must be edited to contain the right absolute path to
> srgb.icc.
> 
> I propose to either:
> 
>  - move PDFA_def.ps to /usr/share/doc/*/examples because it's a file
>that cannot be used immediately but has to be edited first
> 
>  - patch PDFA_def.ps to include the full path to
>/usr/share/color/icc/ghostscript/srgb.icc so that it can be used from
>any directory

Good catch!

Indeed libgs9 ships with a few files arguably usable only as examples:

/usr/share/ghostscript/9.27/lib/PDFA_def.ps
/usr/share/ghostscript/9.27/lib/PDFX_def.ps

The files document both inline and in VectorDevices.htm that they should 
be edited before use.

I am hesitant to moving or patching those files, though, because (as you 
demonstrate above) it _is_ possible with some path juggling to use those 
files as-is, and both upstream and consuming code might rely on the 
files.  Even if never used for anything as examples, I see no harm in 
leaving the files where they are just to be on the safe side.

More sensible to me would be to symlink the files to 
.../doc/libgs9/examples to advertise them as usable as such.

How do you think about my alternative approach?


Kind regards,

 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private

signature.asc
Description: signature


Bug#961909: ghostscript: PDFA_def.ps references srgb.icc with relative path

2020-05-31 Thread Johannes 'josch' Schauer
Package: ghostscript
Version: 9.27~dfsg-2+deb10u3
Severity: normal

Hi,

using /usr/share/ghostscript/9.27/lib/PDFA_def.ps I can convert a PDF
into PDF/A-1b like so:

$ env --chdir=/usr/share/color/icc/ghostscript/ gs -dBATCH -dNOPAUSE \
> -dSAFEGR -dPDFA=1 -sProcessColorModel=DeviceRGB 
-dPDFACompatibilityPolicy=1
> -sDEVICE=pdfwrite -sOutputFile=/tmp/out.pdf \
> /usr/share/ghostscript/9.27/lib/PDFA_def.ps \
> in.pdf

Using "env --chdir" as well as using an absolute path for OutputFile is
necessary because PDFA_def.ps references srgb.icc with a relative path
in /usr/share/color/icc/ghostscript/ -- this means that unless the
command is executed in /usr/share/color/icc/ghostscript/, PDFA_def.ps is
useless and must be edited to contain the right absolute path to
srgb.icc.

I propose to either:

 - move PDFA_def.ps to /usr/share/doc/*/examples because it's a file
   that cannot be used immediately but has to be edited first

 - patch PDFA_def.ps to include the full path to
   /usr/share/color/icc/ghostscript/srgb.icc so that it can be used from
   any directory

Thanks!

cheers, josch