Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upNo error on assignment to $> #1969
Comments
This comment has been minimized.
This comment has been minimized.
From mjtg@cus.cam.ac.ukShouldn't this (run in an unprivileged environment) cause some sort perl5.6.0 -wle '$> = 0; print $>' Mike Guy % perl -V Characteristics of this binary (from libperl): |
This comment has been minimized.
This comment has been minimized.
From [Unknown Contact. See original ticket]
Perl doesn't give warnings on syscall failures. --tom |
This comment has been minimized.
This comment has been minimized.
From [Unknown Contact. See original ticket]Tom Christiansen <tchrist@chthon.perl.com> wrote
Ah! Of course it doesn't. Silly me. But perhaps the documentation of $> (and all the rest that hide system Mike Guy |
This comment has been minimized.
This comment has been minimized.
From @smpeters
Attached is a patch to perlvar.pod to document the variables I found |
This comment has been minimized.
This comment has been minimized.
From @smpetersperlvar.pod.patch--- perlvar.pod.orig Sat Nov 20 22:18:40 2004
+++ perlvar.pod Sat Nov 20 22:34:55 2004
@@ -765,7 +765,9 @@
The real uid of this process. (Mnemonic: it's the uid you came I<from>,
if you're running setuid.) You can change both the real uid and
-the effective uid at the same time by using POSIX::setuid().
+the effective uid at the same time by using POSIX::setuid(). Since
+changes to $< require a system call, check $! after a change attempt to
+detect any possible errors.
=item $EFFECTIVE_USER_ID
@@ -779,7 +781,8 @@
($<,$>) = ($>,$<); # swap real and effective uid
You can change both the effective uid and the real uid at the same
-time by using POSIX::setuid().
+time by using POSIX::setuid(). Changes to $> require a check to $!
+to detect any possible errors after an attempted change.
(Mnemonic: it's the uid you went I<to>, if you're running setuid.)
C<< $< >> and C<< $> >> can be swapped only on machines
@@ -802,7 +805,8 @@
back to C<$(> without being forced numeric, such as by adding zero.
You can change both the real gid and the effective gid at the same
-time by using POSIX::setgid().
+time by using POSIX::setgid(). Changes to $( require a check to $!
+to detect any possible errors after an attempted change.
(Mnemonic: parentheses are used to I<group> things. The real gid is the
group you I<left>, if you're running setgid.)
@@ -828,6 +832,8 @@
You can change both the effective gid and the real gid at the same
time by using POSIX::setgid() (use only a single numeric argument).
+Changes to $) require a check to $! to detect any possible errors
+after an attempted change.
(Mnemonic: parentheses are used to I<group> things. The effective gid
is the group that's I<right> for you, if you're running setgid.)
|
This comment has been minimized.
This comment has been minimized.
From rick@bort.caOn Sun, Nov 21, 2004 at 04:38:09AM -0000, Steve Peters via RT wrote:
You neglected to mention the need to initialize $! to 0 before the -- |
This comment has been minimized.
This comment has been minimized.
From @rgsSteve Peters via RT wrote:
Thanks, applied as change #23532 to bleadperl. -- |
This comment has been minimized.
This comment has been minimized.
@smpeters - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#3242 (status was 'resolved')
Searchable as RT3242$