Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

A Postscript Myth

48 views
Skip to first unread message

luser- -droog

unread,
Sep 28, 2011, 5:09:33 AM9/28/11
to
Postcript's access control mechanism is often explained as an
analogue of the Unix file access mechanism. But it isn't so!

Postscript access flags are not a 3-bit mark, but a 2-bit number
representing exactly 4 values of access:

unlimited
The default access for user-created objects (the things represented
by words in your source code) is unlimited.

read-only
Only significant for (packed)arrays, strings, dictionaries,
and files. Disallows writing to object.

execute-only
Disallows reading and writing.

none
Cannot access the object in any way. For xpost, my hacky
fonttype object should have this level set, since there are no
operators that work with it. You can still query the type,
length (if appropriate), and determine the access level.

So the predicates each perform a simple numerical test.
wcheck checks if the access is unlimited.
rcheck checks if the access is read-only or unlimited.

In level 1, there is no way to distinguish read-only from
execute-only except to attempt a read and catch the error.
There is no way to distinguish execute-only from none
except to attempt to execute and catch the error.

tlvp

unread,
Sep 28, 2011, 3:39:12 PM9/28/11
to
OK, let me display my ignorance: I'd have expected four levels
as follows:

read access & write access both allowed
read access allowed, write access not allowed
read access not allowed, write access allowed
neither read access nor write access allowed.

And I'd have thought you can't 'execute' without *both* read access
*and* execute permission.

So, now, cure my ignorance, please: what am I missing?

Cheers, and TIA, -- tlvp
--
Avant de repondre, jeter la poubelle, SVP.

Helge Blischke

unread,
Sep 28, 2011, 3:55:26 PM9/28/11
to
Here is what the PLRM says with respect to access:

--- snip ---
Access
The other attribute of an object is its access. Only composite objects have access
attributes, which restrict the set of operations that can be performed on the object’s
value.
There are four types of access. In increasing order of restriction, they are:
1. Unlimited. Normally, objects have unlimited access: all operations defined for
that object are allowed. However, packed array objects always have read-only
(or even more restricted) access.
2. Read-only. An object with read-only access may not have its value written, but
may still be read or executed.
3. Execute-only. An object with execute-only access may not have its value either
read or written, but may still be executed by the PostScript interpreter.
4. None. An object with no access may not be operated on in any way by a Post-
Script program. Such objects are not of any direct use to PostScript programs,
but serve internal purposes that are not documented in this book.

--- snip ---

Helge

luser- -droog

unread,
Sep 28, 2011, 9:22:01 PM9/28/11
to
On Sep 28, 2:39 pm, tlvp <mPiOsUcB.EtLlL...@att.net> wrote:
> On Wed, 28 Sep 2011 02:09:33 -0700 (PDT), luser- -droog wrote:
> > Postcript's access control mechanism is often explained as an
> > analogue of the Unix file access mechanism. But it isn't so!
>
> > Postscript access flags are not a 3-bit mark, but a 2-bit number

I meant "mask" not "mark".
What brought it all together for me was concretizing the description
with numbers.

WRITE READ EXEC
3 - unlimited Y Y Y
2 - readonly N Y Y
1 - executeonly N N Y
0 - noaccess N N N


Using these codes, wcheck and rcheck could be implemented this way.

wcheck: boolean(object.access == 3)
rcheck: boolean(object.access >= 2)


And the hypothetical execcheck and noaccesscheck would be like this.

execcheck: boolean(object.access >= 1)
noaccesscheck: boolean(object.access == 0)


HTH
--
Josh

tlvp

unread,
Sep 29, 2011, 7:17:22 PM9/29/11
to
Helge, -droog,

Thank you both for clarifying things so well that my ignorance
(or at least this component of it) is dispelled. Droog's chart

WRITE READ EXEC
3 - unlimited Y Y Y
2 - readonly N Y Y
1 - executeonly N N Y
0 - noaccess N N N

captures the essence of the situation in a memorable nnutshell
(and suggests that "readonly" is a bit of a misnomer :-) )!

Cheers, -- tlvp
0 new messages