Front page | perl.perl5.porters |
Postings from September 2011
[perl #100364] exit doesn't match its documentation
Thread Next
From:
Nicholas Clark
Date:
September 29, 2011 06:38
Subject:
[perl #100364] exit doesn't match its documentation
Message ID:
rt-3.6.HEAD-31297-1317303502-571.100364-75-0@perl.org
# New Ticket Created by Nicholas Clark
# Please include the string: [perl #100364]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=100364 >
This is a bug report for perl from nick@ccl4.org,
generated with the help of perlbug 1.39 running under perl 5.15.3.
-----------------------------------------------------------------
[Please describe your issue here]
I don't think that I'm being stupid here.
The docs say:
=item exit
Evaluates EXPR and exits immediately with that value. Example:
$ans = <STDIN>;
exit 0 if $ans =~ /^[Xx]/;
And C<1 == 1> is an expression? Right?
$ perl -wle 'exit 1 == 1'; echo $?
Useless use of numeric eq (==) in void context at -e line 1.
1
$ perl -wle 'exit 1 == 0'; echo $?
Useless use of numeric eq (==) in void context at -e line 1.
1
adding parentheses forces the issue;
$ perl -wle 'exit(1 == 1)'; echo $?
1
$ perl -wle 'exit(1 == 0)'; echo $?
0
I'm aware of the Advice from Klortho. Particularly:
#11943 Ah yes, and you are the first person to have noticed this bug since 1987. Sure.
But it does seem to be an inconsistency between the documentation and the
implementation. I assume that the implementation trumps the documentation
here, given that it's been constant as far back as I can test:
$ ~/Sandpit/5000/bin/perl -lwe 'exit 1 == 1'; echo $?
Useless use of numeric eq in void context at -e line 1.
1
$ ~/Sandpit/5000/bin/perl -lwe 'exit 1 == 0'; echo $?
Useless use of numeric eq in void context at -e line 1.
1
and
$ /usr/local/perl4/bin/perl4.036 -wle 'exit 1 == 1'; echo $?
1
$ /usr/local/perl4/bin/perl4.036 -wle 'exit 1 == 0'; echo $?
1
$ /usr/local/perl4/bin/perl4.036 -wle 'exit(1 == 1)'; echo $?
1
$ /usr/local/perl4/bin/perl4.036 -wle 'exit(1 == 0)'; echo $?
0
I'm not sure what 'EXPR' should be replaced with, in the documentation.
Nicholas Clark
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=core
severity=low
---
Site configuration information for perl 5.15.3:
Configured by nick at Thu Sep 22 20:40:09 BST 2011.
Summary of my perl5 (revision 5 version 15 subversion 3) configuration:
Commit id: 9100e0355b96ae40c9800b9facaa6f990da38cb3
Platform:
osname=freebsd, osvers=7.0-stable, archname=i386-freebsd-64int
uname='freebsd plum.flirble.org 7.0-stable freebsd 7.0-stable #7: sat jul 26 20:39:26 bst 2008 root@plum.flirble.org:usrobjusrsrcsysplum i386 '
config_args='-Dusedevel=y -Dcc=ccache gcc -Dld=gcc -Ubincompat5005 -Uinstallusrbinperl -Dcf_email=nick@ccl4.org -Dperladmin=nick@ccl4.org -Dinc_version_list= -Dinc_version_list_init=0 -Doptimize=-g -Uusethreads -Duse64bitint -Accflags=-DNO_MATHOMS -Uusemymalloc -Duseperlio -Dprefix=~/Sandpit/snap5.9.x-v5.15.3-17-g9100e03 -Dinstallman1dir=none -Dinstallman3dir=none -Uuserelocatableinc -de'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='ccache gcc', ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DNO_MATHOMS -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include',
optimize='-g',
cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DNO_MATHOMS -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.2.1 20070719 [FreeBSD]', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='gcc', ldflags ='-Wl,-E -fstack-protector -L/usr/local/lib'
libpth=/usr/lib /usr/local/lib
libs=-lgdbm -lm -lcrypt -lutil -lc
perllibs=-lm -lcrypt -lutil -lc
libc=, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib -fstack-protector'
Locally applied patches:
---
@INC for perl 5.15.3:
lib
/home/nick/Sandpit/snap5.9.x-v5.15.3-17-g9100e03/lib/perl5/site_perl/5.15.3/i386-freebsd-64int
/home/nick/Sandpit/snap5.9.x-v5.15.3-17-g9100e03/lib/perl5/site_perl/5.15.3
/home/nick/Sandpit/snap5.9.x-v5.15.3-17-g9100e03/lib/perl5/5.15.3/i386-freebsd-64int
/home/nick/Sandpit/snap5.9.x-v5.15.3-17-g9100e03/lib/perl5/5.15.3
.
---
Environment for perl 5.15.3:
HOME=/home/nick
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/home/nick/bin:/usr/flirble/admin/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/home/nick/bin:/usr/local/sbin:/sbin:/usr/sbin
PERL_BADLANG (unset)
SHELL=/usr/local/bin/bash
Thread Next
-
[perl #100364] exit doesn't match its documentation
by Nicholas Clark