Bug 692328

Summary: sed pstopxl.in is using perl regex which is not portable (not standard or posix)
Product: Ghostscript Reporter: jirib <jirib>
Component: CUPS driverAssignee: Henry Stiles <henry.stiles>
Status: RESOLVED FIXED    
Severity: normal CC: henry.stiles, htl10, mike, till.kamppeter, twaugh
Priority: P4    
Version: master   
Hardware: PC   
OS: All   
Customer: Word Size: ---
Attachments: patch for pstopxl.in

Description jirib 2011-07-07 10:06:24 UTC
Created attachment 7649 [details]
patch for pstopxl.in

Hello,

sed pstopxl.in is using perl regex which is not portable (not standard  or posix), this works only with GNU sed but there's not need to be tied with this specific sed implementation (for example BSD people do usually not want to have another sed [GNU] installed; and there's no need usually), all \s or \S could have posix syntax - [[:space:]] or [^[:space:]].

Attached diff is just replacement of all occurrences of \s and \S with [[:space:]] and [^[:space:]].

The filter itself hasn't been tested yet.

jirib
Comment 1 Henry Stiles 2011-07-07 16:04:28 UTC
Hi Till thought you could have a look at this one, but if you don't have time send it back to me.
Comment 2 Hin-Tak Leung 2011-07-27 03:11:59 UTC
(In reply to comment #0)
> Created an attachment (id=7649) [details]
> patch for pstopxl.in

> The filter itself hasn't been tested yet.

That's somewhat wrong.

See also previous discussion in bug 691292 regarding essentially the same issue. The current code is supposed to cover both gnu sed and bsd sed (which covers most of the modern platforms), I think. pure posix sed is rare to find.
Comment 3 jirib 2011-07-27 06:40:43 UTC
detection if using GNU sed or "other" sed is OK, my complain is that you use perl regex style which is not covered in every "other" sed programs. That's it.

So as most "other" sed programs are POSIX compatible I created this diff to replace perl regex (this is probably used only by GNU sed) with different regex style (POSIX) to have it running on every sed which exists.

I don't understand why are you so defending perl regex in sed? :)
Comment 4 Till Kamppeter 2011-07-27 18:54:33 UTC
This bug and a bug for monochrome printing on a color printer are fixed now.

GIT commit 6ab36cb4256fbd9aa00

Will also go into GS 9.04.
Comment 5 Till Kamppeter 2011-07-27 18:55:27 UTC
Closing ...
Comment 6 Hin-Tak Leung 2011-07-28 01:48:58 UTC
(In reply to comment #2)
> > The filter itself hasn't been tested yet.
> 
> That's somewhat wrong.

(In reply to comment #3)
> I don't understand why are you so defending perl regex in sed? :)

I was referring to "hasn't been tested" being somewhat wrong.