Bug 691458 - Odd dependency of currentpagedevice on letter / a4 etc
Summary: Odd dependency of currentpagedevice on letter / a4 etc
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PS Interpreter (show other bugs)
Version: 8.71
Hardware: PC Linux
: P4 normal
Assignee: Alex Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-14 15:42 UTC by mjr19
Modified: 2010-07-17 21:26 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
patch (6.46 KB, application/octet-stream)
2010-07-17 21:14 UTC, Alex Cherepanov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mjr19 2010-07-14 15:42:22 UTC
I find the output for the following code sequence surprising:

gs -c '/a4{} def (png16m) selectdevice currentpagedevice quit'

GPL Ghostscript 8.71 (2010-02-10)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Error: /rangecheck in --currentpagedevice--
Operand stack:
 (etc)

I cannot see why '(png16m) selectdevice currentpagedevice' should fail if
a4 is defined to a null procedure. It works fine if the '/a4{} def' is omitted.

As setpagedevice includes an implicit currentpagedevice,

gs -c '/a4{} def (png16m) selectdevice <<>> setpagedevice quit'

also fails for any dictionary. The error occurs if any of the papersize operators known to gs is redefined (a3, letter, a4small, etc.) It seems to occur with most output devices too (png16m can be replaced by x11). It seems that something is iterating over .papertypenames and making assumptions about the form of the procedures defined there.

MJR
Comment 1 Alex Cherepanov 2010-07-15 13:41:10 UTC
See the comment in gs_statd.pd :

% Note: these executable arrays should all begin with two
% integers which are the width and height (see gs_setpd.ps).
 /11x17 {792 1224 //.setpagesize exec} bind def  % 11x17 portrait
 /a3 {842 1191 //.setpagesize exec} bind def
 /a4 {595 842 //.setpagesize exec} bind def

The fact that this restriction survives past the start-up time
is a bug.
Comment 2 Alex Cherepanov 2010-07-17 21:14:40 UTC
Created attachment 6502 [details]
patch
Comment 3 Alex Cherepanov 2010-07-17 21:26:24 UTC
Re-implement handling of named page sizes to avoid dependence on
the definitions of compatibility operators (a4, letter, etc.)
in userdict.

The patch has been committed as a rev. 11517.