Bug 687304 - 'probable' bug in ps2epsi script
Summary: 'probable' bug in ps2epsi script
Status: RESOLVED DUPLICATE of bug 688703
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: General (show other bugs)
Version: 8.53
Hardware: PC Linux
: P2 normal
Assignee: Ray Johnston
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-18 09:00 UTC by krishan
Modified: 2007-12-13 12:55 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description krishan 2004-02-18 09:00:22 UTC
Running ps2epsi with certain postscript files generated the following
error

sed: -e expression #1, char 42: Invalid range end

Upon investigation, this seems to be due to [^!-~] in the following sed line

sed -e '/^%%BeginPreview:/,/^%%EndPreview[^!-~]*$/d' -e '/^%!PS-Adobe/d'\
       -e '/^%%[A-Za-z][A-Za-z]*[^!-~]*$/d' -e '/^%%[A-Za-z][A-Za-z]*: /d'


which I think might be a bug

The sed man page says, that to include a '-' in a negated list, it has
to be the first of the last item in the list

---
sed man entry
 `[LIST]' 
`[^LIST]' 
Matches any single character in LIST: for example, `[aeiou]' matches all 
vowels. A list may include sequences like `CHAR1-CHAR2', which matches 
any character between (inclusive) CHAR1 and CHAR2. The caret reverses 
the meaning of the regexp, so that it matches any single character 
NOT in list. To include `]' in the list, make it the first character 
(after the caret if needed), to include `-' in the list, make it the 
first or last; to include `^' put it after the first character.
Comment 1 Ray Johnston 2004-02-18 21:23:01 UTC
The sed script is correct as it stands.

The regexp [^!-~] matches any characters between ! and ~
inclusive. The '-' in the regexp indicates a range and is
NOT intended to match only '!', '-' and '~', but rather the
entire range.

This bug will be closed unless a PostScript file is attached
with a specific command line that exhibts the problem.
Comment 2 Werner Lemberg 2006-01-19 09:29:42 UTC
The bug is real, but is related to something different.

Character ranges are locale dependent, and to make [^!-~] really work as
expected you have to add

  LANG=C

at the beginning of the script.

GNU sed compiled with older glibc versions aborts on the above regexp if the
locale is not C.
Comment 3 Alex Cherepanov 2006-05-25 10:14:34 UTC

*** This bug has been marked as a duplicate of 688703 ***