-x implementations

Maarten Litmaath maart at cs.vu.nl
Thu Jan 31 06:36:38 AEST 1991


In article <1991Jan29.153242.12335 at convex.com>,
	tchrist at convex.COM (Tom Christiansen) writes:
)From the keyboard of maart at cs.vu.nl (Maarten Litmaath):
):How does Perl implement `-x', Tom?
)
)It does its own stat, and then does the bit compares itself to 
)determine accessibility; it does not use access(2).

Good!

)Note that both -x and -X exist for checking effective and real IDs
)respectively; likewise -r/-R, -w/-W, and -o/-O.  Does this solve
)your problem?

I guess so.

)Could you show me some, um, test cases where /bin/test
)fails so I can see what perl does under the same circumstances?

As root:

	$ test -x /etc/passwd && echo 'Huh?  /etc/passwd is executable?'

If your effective uid is that of user `foo', whereas your real uid is
that of user `bar':

	$ ls -l mailbox
	-rw-------  1 foo          1079 Jan 30 19:26 mailbox
	$ test -r mailbox || echo 'Huh?  Is mailbox unreadable for me?'

Access(2), a sick system call.  (I _know_ it uses the real uid on
purpose.)
--
Temporary files like /tmp/sh$$ are an abomination.



More information about the Comp.unix.programmer mailing list