Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eval + format - \n = pp_ctl.c assertion #7009

Closed
p5pRT opened this issue Dec 30, 2003 · 7 comments
Closed

eval + format - \n = pp_ctl.c assertion #7009

p5pRT opened this issue Dec 30, 2003 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Dec 30, 2003

Migrated from rt.perl.org#24774 (status was 'resolved')

Searchable as RT24774$

@p5pRT
Copy link
Author

p5pRT commented Dec 30, 2003

From rob@exitexchange.com

This is a bug report for perl from rob@​exitexchange.com,
generated with the help of perlbug 1.34 running under perl v5.8.2.

created a format with eval, that does NOT include a trailing \n,
gives the following error when write() is called​:

Assertion fpc <= fops + maxops failed​: file "pp_ctl.c", line 3731 at (eval 1) line 5.

Test case​:
#!/usr/bin/perl -w
use strict;

my @​v = ('k');

# eval "format STDOUT = \n@​\n\@​v\n"; # does NOT trigger bug
eval "format STDOUT = \n@​\n\@​v"; # triggers bug

write;
__END__


Flags​:
  category=core
  severity=low


Site configuration information for perl v5.8.2​:

Configured by rob at Mon Nov 17 11​:00​:52 PST 2003.

Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration​:
  Platform​:
  osname=linux, osvers=2.4.20-8, archname=i386-linux
  uname='linux www 2.4.20-8 #1 thu mar 13 17​:54​:28 est 2003 i686 i686 i386 gnulinux '
  config_args='-des -Doptimize=-O2 -g -pipe -Dcc=gcc -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Dotherlibdirs=/usr/lib/perl5/5.8.1 -Duseshrplib -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Dinstallusrbinperl -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr'
  hint=recommended, useposix=true, d_sigaction=define
  usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
  useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
  use64bitint=undef use64bitall=undef uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='gcc', ccflags ='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
  optimize='-O2 -g -pipe',
  cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm'
  ccversion='', gccversion='3.2.2 20030222 (Red Hat Linux 3.2.2-5)', gccosandvers=''
  intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
  ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
  alignbytes=4, prototype=define
  Linker and Libraries​:
  ld='gcc', ldflags =' -L/usr/local/lib'
  libpth=/usr/local/lib /lib /usr/lib
  libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
  perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
  libc=/lib/libc-2.3.2.so, so=so, useshrplib=true, libperl=libperl.so
  gnulibc_version='2.3.2'
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.8.2/i386-linux/CORE'
  cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches​:
 


@​INC for perl v5.8.2​:
  /usr/lib/perl5/5.8.2/i386-linux
  /usr/lib/perl5/5.8.2
  /usr/lib/perl5/site_perl/5.8.2/i386-linux
  /usr/lib/perl5/site_perl/5.8.2
  /usr/lib/perl5/site_perl/5.8.0
  /usr/lib/perl5/site_perl
  /usr/lib/perl5/vendor_perl/5.8.2/i386-linux
  /usr/lib/perl5/vendor_perl/5.8.2
  /usr/lib/perl5/vendor_perl/5.8.0
  /usr/lib/perl5/vendor_perl
  /usr/lib/perl5/5.8.1
  .


Environment for perl v5.8.2​:
  HOME=/home/rob
  LANG=en_US
  LANGUAGE (unset)
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/usr/local/bin​:/bin​:/usr/bin​:/usr/X11R6/bin​:/home/rob/bin
  PERL_BADLANG (unset)
  SHELL=/bin/bash

Complete configuration data for perl v5.8.2​:

Author=''
CONFIG='true'
Date='$Date'
Header=''
Id='$Id'
Locker=''
Log='$Log'
Mcc='Mcc'
PATCHLEVEL='8'
PERL_API_REVISION='5'
PERL_API_SUBVERSION='0'
PERL_API_VERSION='8'
PERL_CONFIG_SH='true'
PERL_REVISION='5'
PERL_SUBVERSION='2'
PERL_VERSION='8'
RCSfile='$RCSfile'
Revision='$Revision'
SUBVERSION='2'
Source=''
State=''
_a='.a'
_exe=''
_o='.o'
afs='false'
afsroot='/afs'
alignbytes='4'
ansi2knr=''
aphostname='/bin/hostname'
api_revision='5'
api_subversion='0'
api_version='8'
api_versionstring='5.8.0'
ar='ar'
archlib='/usr/lib/perl5/5.8.2/i386-linux'
archlibexp='/usr/lib/perl5/5.8.2/i386-linux'
archname='i386-linux'
archname64=''
archobjs=''
asctime_r_proto='0'
awk='awk'
baserev='5.0'
bash=''
bin='/usr/bin'
binexp='/usr/bin'
bison='bison'
byacc='byacc'
byteorder='1234'
c=''
castflags='0'
cat='cat'
cc='gcc'
cccdlflags='-fpic'
ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.8.2/i386-linux/CORE'
ccflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm'
ccflags_uselargefiles='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
ccname='gcc'
ccsymbols='cpu=i386 __GNUC_PATCHLEVEL__=2 __gnu_linux__=1 __GXX_ABI_VERSION=102 machine=i386 __NO_INLINE__=1 __STDC_HOSTED__=1 system=posix __tune_i386__=1'
ccversion=''
cf_by='rob'
cf_email='rob@​www.empire2.com'
cf_time='Mon Nov 17 11​:00​:52 PST 2003'
charsize='1'
chgrp=''
chmod='chmod'
chown=''
clocktype='clock_t'
comm='comm'
compress=''
config_arg0='./Configure'
config_arg1='-des'
config_arg10='-Duseshrplib'
config_arg11='-Duselargefiles'
config_arg12='-Dd_dosuid'
config_arg13='-Dd_semctl_semun'
config_arg14='-Di_db'
config_arg15='-Ui_ndbm'
config_arg16='-Di_gdbm'
config_arg17='-Di_shadow'
config_arg18='-Di_syslog'
config_arg19='-Dman3ext=3pm'
config_arg2='-Doptimize=-O2 -g -pipe'
config_arg20='-Dinstallusrbinperl'
config_arg21='-Ubincompat5005'
config_arg22='-Uversiononly'
config_arg23='-Dpager=/usr/bin/less -isr'
config_arg3='-Dcc=gcc'
config_arg4='-Dinstallprefix=/usr'
config_arg5='-Dprefix=/usr'
config_arg6='-Darchname=i386-linux'
config_arg7='-Dvendorprefix=/usr'
config_arg8='-Dsiteprefix=/usr'
config_arg9='-Dotherlibdirs=/usr/lib/perl5/5.8.1'
config_argc='23'
config_args='-des -Doptimize=-O2 -g -pipe -Dcc=gcc -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Dotherlibdirs=/usr/lib/perl5/5.8.1 -Duseshrplib -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Dinstallusrbinperl -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr'
contains='grep'
cp='cp'
cpio=''
cpp='cpp'
cpp_stuff='42'
cppccsymbols='__ELF__=1 __GNUC__=3 __GNUC_MINOR__=2 i386=1 __i386=1 __i386__=1 linux=1 __linux=1 __linux__=1 unix=1 __unix=1 __unix__=1'
cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm'
cpplast='-'
cppminus='-'
cpprun='gcc -E'
cppstdin='gcc -E'
cppsymbols='_FILE_OFFSET_BITS=64 __GLIBC__=2 __GLIBC_MINOR__=3 __GNU_LIBRARY__=6 _LARGEFILE_SOURCE=1 _POSIX_C_SOURCE=199506 _POSIX_SOURCE=1 __STDC__=1 __USE_BSD=1 __USE_FILE_OFFSET64=1 __USE_LARGEFILE=1 __USE_MISC=1 __USE_POSIX=1 __USE_POSIX199309=1 __USE_POSIX199506=1 __USE_POSIX2=1 __USE_SVID=1'
crypt_r_proto='0'
cryptlib=''
csh='csh'
ctermid_r_proto='0'
ctime_r_proto='0'
d_Gconvert='gcvt((x),(n),(b))'
d_PRIEUldbl='define'
d_PRIFUldbl='define'
d_PRIGUldbl='define'
d_PRIXU64='define'
d_PRId64='define'
d_PRIeldbl='define'
d_PRIfldbl='define'
d_PRIgldbl='define'
d_PRIi64='define'
d_PRIo64='define'
d_PRIu64='define'
d_PRIx64='define'
d_SCNfldbl='define'
d__fwalk=''
d_access='define'
d_accessx=''
d_aintl=''
d_alarm='define'
d_archlib='define'
d_asctime_r=''
d_atolf=''
d_atoll='define'
d_attribut='define'
d_bcmp='define'
d_bcopy='define'
d_bsd=''
d_bsdgetpgrp=''
d_bsdsetpgrp=''
d_bzero='define'
d_casti32=''
d_castneg='define'
d_charvspr=''
d_chown='define'
d_chroot='define'
d_chsize=''
d_class=''
d_closedir='define'
d_cmsghdr_s='define'
d_const='define'
d_copysignl='define'
d_crypt='define'
d_crypt_r=''
d_csh='define'
d_ctermid_r=''
d_ctime_r=''
d_cuserid='define'
d_dbl_dig='define'
d_dbminitproto=''
d_difftime='define'
d_dirfd='define'
d_dirnamlen=''
d_dlerror='define'
d_dlopen='define'
d_dlsymun=''
d_dosuid='define'
d_drand48_r=''
d_drand48proto='define'
d_dup2='define'
d_eaccess=''
d_endgrent='define'
d_endgrent_r=''
d_endhent='define'
d_endhostent_r=''
d_endnent='define'
d_endnetent_r=''
d_endpent='define'
d_endprotoent_r=''
d_endpwent='define'
d_endpwent_r=''
d_endsent='define'
d_endservent_r=''
d_eofnblk='define'
d_eunice=''
d_faststdio=''
d_fchdir='define'
d_fchmod='define'
d_fchown='define'
d_fcntl='define'
d_fcntl_can_lock='define'
d_fd_macros='define'
d_fd_set='define'
d_fds_bits=''
d_fgetpos='define'
d_finite='define'
d_finitel='define'
d_flexfnam='define'
d_flock='define'
d_flockproto='define'
d_fork='define'
d_fp_class=''
d_fpathconf='define'
d_fpclass=''
d_fpclassify=''
d_fpclassl=''
d_fpos64_t=''
d_frexpl='define'
d_fs_data_s=''
d_fseeko='define'
d_fsetpos='define'
d_fstatfs='define'
d_fstatvfs='define'
d_fsync='define'
d_ftello='define'
d_ftime=''
d_getcwd='define'
d_getespwnam=''
d_getfsstat=''
d_getgrent='define'
d_getgrent_r=''
d_getgrgid_r=''
d_getgrnam_r=''
d_getgrps='define'
d_gethbyaddr='define'
d_gethbyname='define'
d_gethent='define'
d_gethname='define'
d_gethostbyaddr_r=''
d_gethostbyname_r=''
d_gethostent_r=''
d_gethostprotos='define'
d_getitimer='define'
d_getlogin='define'
d_getlogin_r=''
d_getmnt=''
d_getmntent='define'
d_getnbyaddr='define'
d_getnbyname='define'
d_getnent='define'
d_getnetbyaddr_r=''
d_getnetbyname_r=''
d_getnetent_r=''
d_getnetprotos='define'
d_getpagsz='define'
d_getpbyname='define'
d_getpbynumber='define'
d_getpent='define'
d_getpgid='define'
d_getpgrp='define'
d_getpgrp2=''
d_getppid='define'
d_getprior='define'
d_getprotobyname_r=''
d_getprotobynumber_r=''
d_getprotoent_r=''
d_getprotoprotos='define'
d_getprpwnam=''
d_getpwent='define'
d_getpwent_r=''
d_getpwnam_r=''
d_getpwuid_r=''
d_getsbyname='define'
d_getsbyport='define'
d_getsent='define'
d_getservbyname_r=''
d_getservbyport_r=''
d_getservent_r=''
d_getservprotos='define'
d_getspnam='define'
d_getspnam_r=''
d_gettimeod='define'
d_gmtime_r=''
d_gnulibc='define'
d_grpasswd='define'
d_hasmntopt='define'
d_htonl='define'
d_ilogbl='define'
d_index=''
d_inetaton='define'
d_int64_t='define'
d_isascii='define'
d_isfinite=''
d_isinf='define'
d_isnan='define'
d_isnanl='define'
d_killpg='define'
d_lchown='define'
d_ldbl_dig='define'
d_link='define'
d_localtime_r=''
d_locconv='define'
d_lockf='define'
d_longdbl='define'
d_longlong='define'
d_lseekproto='define'
d_lstat='define'
d_madvise='define'
d_mblen='define'
d_mbstowcs='define'
d_mbtowc='define'
d_memchr='define'
d_memcmp='define'
d_memcpy='define'
d_memmove='define'
d_memset='define'
d_mkdir='define'
d_mkdtemp='define'
d_mkfifo='define'
d_mkstemp='define'
d_mkstemps=''
d_mktime='define'
d_mmap='define'
d_modfl='define'
d_modfl_pow32_bug=''
d_modflproto=''
d_mprotect='define'
d_msg='define'
d_msg_ctrunc='define'
d_msg_dontroute='define'
d_msg_oob='define'
d_msg_peek='define'
d_msg_proxy='define'
d_msgctl='define'
d_msgget='define'
d_msghdr_s='define'
d_msgrcv='define'
d_msgsnd='define'
d_msync='define'
d_munmap='define'
d_mymalloc=''
d_nice='define'
d_nl_langinfo='define'
d_nv_preserves_uv='define'
d_off64_t=''
d_old_pthread_create_joinable=''
d_oldpthreads=''
d_oldsock=''
d_open3='define'
d_pathconf='define'
d_pause='define'
d_perl_otherlibdirs='define'
d_phostname=''
d_pipe='define'
d_poll='define'
d_portable='define'
d_procselfexe='define'
d_pthread_atfork=''
d_pthread_attr_setscope='define'
d_pthread_yield='define'
d_pwage=''
d_pwchange=''
d_pwclass=''
d_pwcomment=''
d_pwexpire=''
d_pwgecos='define'
d_pwpasswd='define'
d_pwquota=''
d_qgcvt='define'
d_quad='define'
d_random_r=''
d_readdir='define'
d_readdir64_r=''
d_readdir_r=''
d_readlink='define'
d_readv='define'
d_recvmsg='define'
d_rename='define'
d_rewinddir='define'
d_rmdir='define'
d_safebcpy=''
d_safemcpy=''
d_sanemcmp='define'
d_sbrkproto='define'
d_scalbnl='define'
d_sched_yield='define'
d_scm_rights='define'
d_seekdir='define'
d_select='define'
d_sem='define'
d_semctl='define'
d_semctl_semid_ds='define'
d_semctl_semun='define'
d_semget='define'
d_semop='define'
d_sendmsg='define'
d_setegid='define'
d_seteuid='define'
d_setgrent='define'
d_setgrent_r=''
d_setgrps='define'
d_sethent='define'
d_sethostent_r=''
d_setitimer='define'
d_setlinebuf='define'
d_setlocale='define'
d_setlocale_r=''
d_setnent='define'
d_setnetent_r=''
d_setpent='define'
d_setpgid='define'
d_setpgrp='define'
d_setpgrp2=''
d_setprior='define'
d_setproctitle=''
d_setprotoent_r=''
d_setpwent='define'
d_setpwent_r=''
d_setregid='define'
d_setresgid='define'
d_setresuid='define'
d_setreuid='define'
d_setrgid=''
d_setruid=''
d_setsent='define'
d_setservent_r=''
d_setsid='define'
d_setvbuf='define'
d_sfio=''
d_shm='define'
d_shmat='define'
d_shmatprototype='define'
d_shmctl='define'
d_shmdt='define'
d_shmget='define'
d_sigaction='define'
d_sigprocmask='define'
d_sigsetjmp='define'
d_sockatmark='define'
d_sockatmarkproto=''
d_socket='define'
d_socklen_t='define'
d_sockpair='define'
d_socks5_init=''
d_sqrtl='define'
d_srand48_r=''
d_srandom_r=''
d_sresgproto=''
d_sresuproto=''
d_statblks='define'
d_statfs_f_flags=''
d_statfs_s='define'
d_statvfs='define'
d_stdio_cnt_lval=''
d_stdio_ptr_lval=''
d_stdio_ptr_lval_nochange_cnt=''
d_stdio_ptr_lval_sets_cnt=''
d_stdio_stream_array=''
d_stdiobase=''
d_stdstdio=''
d_strchr='define'
d_strcoll='define'
d_strctcpy='define'
d_strerrm='strerror(e)'
d_strerror='define'
d_strerror_r=''
d_strftime='define'
d_strtod='define'
d_strtol='define'
d_strtold='define'
d_strtoll='define'
d_strtoq='define'
d_strtoul='define'
d_strtoull='define'
d_strtouq='define'
d_strxfrm='define'
d_suidsafe=''
d_symlink='define'
d_syscall='define'
d_syscallproto='define'
d_sysconf='define'
d_sysernlst=''
d_syserrlst='define'
d_system='define'
d_tcgetpgrp='define'
d_tcsetpgrp='define'
d_telldir='define'
d_telldirproto='define'
d_time='define'
d_times='define'
d_tm_tm_gmtoff='define'
d_tm_tm_zone='define'
d_tmpnam_r=''
d_truncate='define'
d_ttyname_r=''
d_tzname='define'
d_u32align='define'
d_ualarm='define'
d_umask='define'
d_uname='define'
d_union_semun=''
d_unordered=''
d_usleep='define'
d_usleepproto='define'
d_ustat='define'
d_vendorarch='define'
d_vendorbin='define'
d_vendorlib='define'
d_vendorscript='define'
d_vfork=''
d_void_closedir=''
d_voidsig='define'
d_voidtty=''
d_volatile='define'
d_vprintf='define'
d_wait4='define'
d_waitpid='define'
d_wcstombs='define'
d_wctomb='define'
d_writev='define'
d_xenix=''
date='date'
db_hashtype='u_int32_t'
db_prefixtype='size_t'
db_version_major='4'
db_version_minor='0'
db_version_patch='14'
defvoidused='15'
direntrytype='struct dirent'
dlext='so'
dlsrc='dl_dlopen.xs'
doublesize='8'
drand01='drand48()'
drand48_r_proto='0'
dynamic_ext='attrs B ByteLoader Cwd Data/Dumper DB_File Devel/DProf Devel/Peek Devel/PPPort Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call GDBM_File I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Opcode PerlIO/encoding PerlIO/scalar PerlIO/via POSIX re SDBM_File Socket Storable Sys/Hostname Sys/Syslog threads Time/HiRes Unicode/Normalize XS/APItest XS/Typemap threads/shared'
eagain='EAGAIN'
ebcdic=''
echo='echo'
egrep='egrep'
emacs=''
endgrent_r_proto='0'
endhostent_r_proto='0'
endnetent_r_proto='0'
endprotoent_r_proto='0'
endpwent_r_proto='0'
endservent_r_proto='0'
eunicefix='​:'
exe_ext=''
expr='expr'
extensions='attrs B ByteLoader Cwd Data/Dumper DB_File Devel/DProf Devel/Peek Devel/PPPort Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call GDBM_File I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Opcode PerlIO/encoding PerlIO/scalar PerlIO/via POSIX re SDBM_File Socket Storable Sys/Hostname Sys/Syslog threads Time/HiRes Unicode/Normalize XS/APItest XS/Typemap threads/shared Errno'
extras=''
fflushNULL='define'
fflushall=''
find=''
firstmakefile='makefile'
flex=''
fpossize='16'
fpostype='fpos_t'
freetype='void'
from='​:'
full_ar='/usr/bin/ar'
full_csh='/bin/csh'
full_sed='/bin/sed'
gccansipedantic=''
gccosandvers=''
gccversion='3.2.2 20030222 (Red Hat Linux 3.2.2-5)'
getgrent_r_proto='0'
getgrgid_r_proto='0'
getgrnam_r_proto='0'
gethostbyaddr_r_proto='0'
gethostbyname_r_proto='0'
gethostent_r_proto='0'
getlogin_r_proto='0'
getnetbyaddr_r_proto='0'
getnetbyname_r_proto='0'
getnetent_r_proto='0'
getprotobyname_r_proto='0'
getprotobynumber_r_proto='0'
getprotoent_r_proto='0'
getpwent_r_proto='0'
getpwnam_r_proto='0'
getpwuid_r_proto='0'
getservbyname_r_proto='0'
getservbyport_r_proto='0'
getservent_r_proto='0'
getspnam_r_proto='0'
gidformat='"lu"'
gidsign='1'
gidsize='4'
gidtype='gid_t'
glibpth='/usr/shlib /lib /usr/lib /usr/lib/386 /lib/386 /usr/ccs/lib /usr/ucblib /usr/local/lib '
gmake='gmake'
gmtime_r_proto='0'
gnulibc_version='2.3.2'
grep='grep'
groupcat='cat /etc/group'
groupstype='gid_t'
gzip='gzip'
h_fcntl='false'
h_sysfile='true'
hint='recommended'
hostcat='cat /etc/hosts'
html1dir=' '
html1direxp=''
html3dir=' '
html3direxp=''
i16size='2'
i16type='short'
i32size='4'
i32type='long'
i64size='8'
i64type='long long'
i8size='1'
i8type='char'
i_arpainet='define'
i_bsdioctl=''
i_crypt='define'
i_db='define'
i_dbm=''
i_dirent='define'
i_dld=''
i_dlfcn='define'
i_fcntl=''
i_float='define'
i_fp=''
i_fp_class=''
i_gdbm='define'
i_grp='define'
i_ieeefp=''
i_inttypes='define'
i_langinfo='define'
i_libutil=''
i_limits='define'
i_locale='define'
i_machcthr=''
i_malloc='define'
i_math='define'
i_memory=''
i_mntent='define'
i_ndbm=''
i_netdb='define'
i_neterrno=''
i_netinettcp='define'
i_niin='define'
i_poll='define'
i_prot=''
i_pthread='define'
i_pwd='define'
i_rpcsvcdbm=''
i_sfio=''
i_sgtty=''
i_shadow='define'
i_socks=''
i_stdarg='define'
i_stddef='define'
i_stdlib='define'
i_string='define'
i_sunmath=''
i_sysaccess=''
i_sysdir='define'
i_sysfile='define'
i_sysfilio=''
i_sysin=''
i_sysioctl='define'
i_syslog='define'
i_sysmman='define'
i_sysmode=''
i_sysmount='define'
i_sysndir=''
i_sysparam='define'
i_sysresrc='define'
i_syssecrt=''
i_sysselct='define'
i_syssockio=''
i_sysstat='define'
i_sysstatfs='define'
i_sysstatvfs='define'
i_systime='define'
i_systimek=''
i_systimes='define'
i_systypes='define'
i_sysuio='define'
i_sysun='define'
i_sysutsname='define'
i_sysvfs='define'
i_syswait='define'
i_termio=''
i_termios='define'
i_time='define'
i_unistd='define'
i_ustat='define'
i_utime='define'
i_values='define'
i_varargs=''
i_varhdr='stdarg.h'
i_vfork=''
ignore_versioned_solibs='y'
inc_version_list='5.8.0'
inc_version_list_init='"5.8.0",0'
incpath=''
inews=''
installarchlib='/usr/lib/perl5/5.8.2/i386-linux'
installbin='/usr/bin'
installhtml1dir=''
installhtml3dir=''
installman1dir='/usr/share/man/man1'
installman3dir='/usr/share/man/man3'
installprefix='/usr'
installprefixexp='/usr'
installprivlib='/usr/lib/perl5/5.8.2'
installscript='/usr/bin'
installsitearch='/usr/lib/perl5/site_perl/5.8.2/i386-linux'
installsitebin='/usr/bin'
installsitehtml1dir=''
installsitehtml3dir=''
installsitelib='/usr/lib/perl5/site_perl/5.8.2'
installsiteman1dir='/usr/share/man/man1'
installsiteman3dir='/usr/share/man/man3'
installsitescript='/usr/bin'
installstyle='lib/perl5'
installusrbinperl='define'
installvendorarch='/usr/lib/perl5/vendor_perl/5.8.2/i386-linux'
installvendorbin='/usr/bin'
installvendorhtml1dir=''
installvendorhtml3dir=''
installvendorlib='/usr/lib/perl5/vendor_perl/5.8.2'
installvendorman1dir='/usr/share/man/man1'
installvendorman3dir='/usr/share/man/man3'
installvendorscript='/usr/bin'
intsize='4'
issymlink='/usr/bin/test -h'
ivdformat='"ld"'
ivsize='4'
ivtype='long'
known_extensions='attrs B ByteLoader Cwd Data/Dumper DB_File Devel/DProf Devel/Peek Devel/PPPort Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call GDBM_File I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 NDBM_File ODBM_File Opcode PerlIO/encoding PerlIO/scalar PerlIO/via POSIX re SDBM_File Socket Storable Sys/Hostname Sys/Syslog Thread threads Time/HiRes Unicode/Normalize XS/APItest XS/Typemap threads/shared'
ksh=''
ld='gcc'
lddlflags='-shared -L/usr/local/lib'
ldflags=' -L/usr/local/lib'
ldflags_uselargefiles=''
ldlibpthname='LD_LIBRARY_PATH'
less='less'
lib_ext='.a'
libc='/lib/libc-2.3.2.so'
libperl='libperl.so'
libpth='/usr/local/lib /lib /usr/lib'
libs='-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc'
libsdirs=' /usr/lib'
libsfiles=' libnsl.so libgdbm.so libdb.so libdl.so libm.so libcrypt.so libutil.so libc.so'
libsfound=' /usr/lib/libnsl.so /usr/lib/libgdbm.so /usr/lib/libdb.so /usr/lib/libdl.so /usr/lib/libm.so /usr/lib/libcrypt.so /usr/lib/libutil.so /usr/lib/libc.so'
libspath=' /usr/local/lib /lib /usr/lib'
libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun m crypt sec util c cposix posix ucb BSD'
libswanted_uselargefiles=''
line=''
lint=''
lkflags=''
ln='ln'
lns='/bin/ln -s'
localtime_r_proto='0'
locincpth='/usr/local/include /opt/local/include /usr/gnu/include /opt/gnu/include /usr/GNU/include /opt/GNU/include'
loclibpth='/usr/local/lib /opt/local/lib /usr/gnu/lib /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib'
longdblsize='12'
longlongsize='8'
longsize='4'
lp=''
lpr=''
ls='ls'
lseeksize='8'
lseektype='off_t'
mail=''
mailx=''
make='make'
make_set_make='#'
mallocobj=''
mallocsrc=''
malloctype='void *'
man1dir='/usr/share/man/man1'
man1direxp='/usr/share/man/man1'
man1ext='1'
man3dir='/usr/share/man/man3'
man3direxp='/usr/share/man/man3'
man3ext='3pm'
mips_type=''
mistrustnm=''
mkdir='mkdir'
mmaptype='void *'
modetype='mode_t'
more='more'
multiarch=''
mv=''
myarchname='i686-linux'
mydomain='.empire2.com'
myhostname='www'
myuname='linux www 2.4.20-8 #1 thu mar 13 17​:54​:28 est 2003 i686 i686 i386 gnulinux '
n='-n'
need_va_copy=''
netdb_hlen_type='size_t'
netdb_host_type='const void *'
netdb_name_type='const char *'
netdb_net_type='in_addr_t'
nm='nm'
nm_opt=''
nm_so_opt='--dynamic'
nonxs_ext='Errno'
nroff='nroff'
nvEUformat='"E"'
nvFUformat='"F"'
nvGUformat='"G"'
nv_preserves_uv_bits='32'
nveformat='"e"'
nvfformat='"f"'
nvgformat='"g"'
nvsize='8'
nvtype='double'
o_nonblock='O_NONBLOCK'
obj_ext='.o'
old_pthread_create_joinable=''
optimize='-O2 -g -pipe'
orderlib='false'
osname='linux'
osvers='2.4.20-8'
otherlibdirs='/usr/lib/perl5/5.8.1'
package='perl5'
pager='/usr/bin/less -isr'
passcat='cat /etc/passwd'
patchlevel='8'
path_sep='​:'
perl=''
perl5='/usr/bin/perl'
perl_patchlevel=''
perladmin='rob@​www.empire2.com'
perllibs='-lnsl -ldl -lm -lcrypt -lutil -lc'
perlpath='/usr/bin/perl'
pg='pg'
phostname='hostname'
pidtype='pid_t'
plibpth=''
pm_apiversion='5.005'
pmake=''
pr=''
prefix='/usr'
prefixexp='/usr'
privlib='/usr/lib/perl5/5.8.2'
privlibexp='/usr/lib/perl5/5.8.2'
procselfexe='"/proc/self/exe"'
prototype='define'
ptrsize='4'
quadkind='3'
quadtype='long long'
randbits='48'
randfunc='drand48'
random_r_proto='0'
randseedtype='long'
ranlib='​:'
rd_nodata='-1'
readdir64_r_proto='0'
readdir_r_proto='0'
revision='5'
rm='rm'
rmail=''
run=''
runnm='false'
sPRIEUldbl='"LE"'
sPRIFUldbl='"LF"'
sPRIGUldbl='"LG"'
sPRIXU64='"LX"'
sPRId64='"Ld"'
sPRIeldbl='"Le"'
sPRIfldbl='"Lf"'
sPRIgldbl='"Lg"'
sPRIi64='"Li"'
sPRIo64='"Lo"'
sPRIu64='"Lu"'
sPRIx64='"Lx"'
sSCNfldbl='"Lf"'
sched_yield='sched_yield()'
scriptdir='/usr/bin'
scriptdirexp='/usr/bin'
sed='sed'
seedfunc='srand48'
selectminbits='32'
selecttype='fd_set *'
sendmail=''
setgrent_r_proto='0'
sethostent_r_proto='0'
setlocale_r_proto='0'
setnetent_r_proto='0'
setprotoent_r_proto='0'
setpwent_r_proto='0'
setservent_r_proto='0'
sh='/bin/sh'
shar=''
sharpbang='#!'
shmattype='void *'
shortsize='2'
shrpenv=''
shsharp='true'
sig_count='64'
sig_name='ZERO HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS NUM32 RTMIN NUM34 NUM35 NUM36 NUM37 NUM38 NUM39 NUM40 NUM41 NUM42 NUM43 NUM44 NUM45 NUM46 NUM47 NUM48 NUM49 NUM50 NUM51 NUM52 NUM53 NUM54 NUM55 NUM56 NUM57 NUM58 NUM59 NUM60 NUM61 NUM62 NUM63 IOT CLD POLL UNUSED '
sig_name_init='"ZERO", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "BUS", "FPE", "KILL", "USR1", "SEGV", "USR2", "PIPE", "ALRM", "TERM", "STKFLT", "CHLD", "CONT", "STOP", "TSTP", "TTIN", "TTOU", "URG", "XCPU", "XFSZ", "VTALRM", "PROF", "WINCH", "IO", "PWR", "SYS", "NUM32", "RTMIN", "NUM34", "NUM35", "NUM36", "NUM37", "NUM38", "NUM39", "NUM40", "NUM41", "NUM42", "NUM43", "NUM44", "NUM45", "NUM46", "NUM47", "NUM48", "NUM49", "NUM50", "NUM51", "NUM52", "NUM53", "NUM54", "NUM55", "NUM56", "NUM57", "NUM58", "NUM59", "NUM60", "NUM61", "NUM62", "NUM63", "IOT", "CLD", "POLL", "UNUSED", 0'
sig_num='0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 6 17 29 31 '
sig_num_init='0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 6, 17, 29, 31, 0'
sig_size='68'
signal_t='void'
sitearch='/usr/lib/perl5/site_perl/5.8.2/i386-linux'
sitearchexp='/usr/lib/perl5/site_perl/5.8.2/i386-linux'
sitebin='/usr/bin'
sitebinexp='/usr/bin'
sitehtml1dir=''
sitehtml1direxp=''
sitehtml3dir=''
sitehtml3direxp=''
sitelib='/usr/lib/perl5/site_perl/5.8.2'
sitelib_stem='/usr/lib/perl5/site_perl'
sitelibexp='/usr/lib/perl5/site_perl/5.8.2'
siteman1dir='/usr/share/man/man1'
siteman1direxp='/usr/share/man/man1'
siteman3dir='/usr/share/man/man3'
siteman3direxp='/usr/share/man/man3'
siteprefix='/usr'
siteprefixexp='/usr'
sitescript='/usr/bin'
sitescriptexp='/usr/bin'
sizesize='4'
sizetype='size_t'
sleep=''
smail=''
so='so'
sockethdr=''
socketlib=''
socksizetype='socklen_t'
sort='sort'
spackage='Perl5'
spitshell='cat'
srand48_r_proto='0'
srandom_r_proto='0'
src='.'
ssizetype='ssize_t'
startperl='#!/usr/bin/perl'
startsh='#!/bin/sh'
static_ext=' '
stdchar='char'
stdio_base='((fp)->_IO_read_base)'
stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)'
stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
stdio_filbuf=''
stdio_ptr='((fp)->_IO_read_ptr)'
stdio_stream_array=''
strerror_r_proto='0'
strings='/usr/include/string.h'
submit=''
subversion='2'
sysman='/usr/share/man/man1'
tail=''
tar=''
targetarch=''
tbl=''
tee=''
test='test'
timeincl='/usr/include/sys/time.h /usr/include/time.h '
timetype='time_t'
tmpnam_r_proto='0'
to='​:'
touch='touch'
tr='tr'
trnl='\n'
troff=''
ttyname_r_proto='0'
u16size='2'
u16type='unsigned short'
u32size='4'
u32type='unsigned long'
u64size='8'
u64type='unsigned long long'
u8size='1'
u8type='unsigned char'
uidformat='"lu"'
uidsign='1'
uidsize='4'
uidtype='uid_t'
uname='uname'
uniq='uniq'
uquadtype='unsigned long long'
use5005threads=''
use64bitall=''
use64bitint=''
usecrosscompile=''
usedl='define'
usefaststdio='define'
useithreads=''
uselargefiles='define'
uselongdouble=''
usemorebits=''
usemultiplicity=''
usemymalloc='n'
usenm='false'
useopcode='true'
useperlio='define'
useposix='true'
usereentrant=''
usesfio='false'
useshrplib='true'
usesocks=''
usethreads=''
usevendorprefix='define'
usevfork='false'
usrinc='/usr/include'
uuname=''
uvXUformat='"lX"'
uvoformat='"lo"'
uvsize='4'
uvtype='unsigned long'
uvuformat='"lu"'
uvxformat='"lx"'
vendorarch='/usr/lib/perl5/vendor_perl/5.8.2/i386-linux'
vendorarchexp='/usr/lib/perl5/vendor_perl/5.8.2/i386-linux'
vendorbin='/usr/bin'
vendorbinexp='/usr/bin'
vendorhtml1dir=' '
vendorhtml1direxp=''
vendorhtml3dir=' '
vendorhtml3direxp=''
vendorlib='/usr/lib/perl5/vendor_perl/5.8.2'
vendorlib_stem='/usr/lib/perl5/vendor_perl'
vendorlibexp='/usr/lib/perl5/vendor_perl/5.8.2'
vendorman1dir='/usr/share/man/man1'
vendorman1direxp='/usr/share/man/man1'
vendorman3dir='/usr/share/man/man3'
vendorman3direxp='/usr/share/man/man3'
vendorprefix='/usr'
vendorprefixexp='/usr'
vendorscript='/usr/bin'
vendorscriptexp='/usr/bin'
version='5.8.2'
version_patchlevel_string='version 8 subversion 2'
versiononly=''
vi=''
voidflags='15'
xlibpth='/usr/lib/386 /lib/386'
xs_apiversion='5.8.2'
yacc='/usr/bin/byacc'
yaccflags=''
zcat=''
zip='zip'

@p5pRT
Copy link
Author

p5pRT commented Dec 30, 2003

From @iabyn

On Tue, Dec 30, 2003 at 01​:26​:59AM -0000, rob@​exitexchange.com (via RT) wrote​:

created a format with eval, that does NOT include a trailing \n,
gives the following error when write() is called​:

Assertion fpc <= fops + maxops failed​: file "pp_ctl.c", line 3731 at (eval 1) line 5.

Ah, mea cupla!

Fixed by patch #22005
(Nick, this is a good candidate for 5.8.3)

--
But Pity stayed his hand. "It's a pity I've run out of bullets",
he thought. - "Bored of the Rings"

Change 22005 by davem@​davem-percy on 2003/12/30 15​:07​:50

  Subject​: Re​: [perl #24774] eval + format - \n = pp_ctl.c assertion
  heuristics for calculating buffer size needed to compile a format
  didn't allow for \0

Affected files ...

... //depot/perl/pp_ctl.c#377 edit
... //depot/perl/t/op/write.t#31 edit

Differences ...

==== //depot/perl/pp_ctl.c#377 (text) ====

@​@​ -3580,7 +3580,7 @​@​

  /* estimate the buffer size needed */
  for (base = s; s <= send; s++) {
- if (*s == '\n' || *s == '@​' || *s == '^')
+ if (*s == '\n' || *s == '\0' || *s == '@​' || *s == '^')
  maxops += 10;
  }
  s = base;

==== //depot/perl/t/op/write.t#31 (xtext) ====

@​@​ -5,7 +5,7 @​@​
  @​INC = '../lib';
}

-print "1..49\n";
+print "1..50\n";

my $CAT = ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') ? 'type'
  : ($^O eq 'MacOS') ? 'catenate'
@​@​ -300,14 +300,24 @​@​
  print `$CAT Op_write.tmp`;
}

+{
+ # Bug #24774 format without trailing \n failed assertion
+ my @​v = ('k');
+ eval "format OUT14 = \n@​\n\@​v";
+ open(OUT14, '>Op_write.tmp') || die "Can't create Op_write.tmp";
+ write(OUT14);
+ close OUT14 or die "Could not close​: $!";
+ print "ok 14\n";
+}
+
#######################################
# Easiest to add new tests above here #
#######################################

-# 14..49​: scary format testing from Merijn H. Brand
+# 15..50​: scary format testing from Merijn H. Brand

-my $test = 14;
-my $tests = 49;
+my $test = 15;
+my $tests = 50;

if ($^O eq 'VMS' || $^O eq 'MSWin32' || $^O eq 'dos' || $^O eq 'MacOS' ||
  ($^O eq 'os2' and not eval '$OS2​::can_fork')) {

@p5pRT
Copy link
Author

p5pRT commented Dec 30, 2003

@iabyn - Status changed from 'open' to 'resolved'

@p5pRT p5pRT closed this as completed Dec 30, 2003
@p5pRT
Copy link
Author

p5pRT commented Jan 2, 2004

From wolfgang.laun@alcatel.at

On Tue, 30 Dec 2003 15​:30​:37 +0000 davem@​fdisolutions.com wrote​:

On Tue, Dec 30, 2003 at 01​:26​:59AM -0000, rob@​exitexchange.com (via RT) wrote​:

created a format with eval, that does NOT include a trailing \n,
gives the following error when write() is called​:

Assertion fpc <= fops + maxops failed​: file "pp_ctl.c", line 3731 at (eval 1) line 5.

Ah, mea cupla!

Fixed by patch #22005
(Nick, this is a good candidate for 5.8.3)

Festina lente ;-)

Yes, it fixes the assertion failure and all that may come from an
insufficient allocation. But note that the eval does not return an
error, so the format can be run. Observe​:

  bash$ cat fmtbug.pl
  my @​v = ('k');
  eval "format STDOUT = \n@​\n\@​v";
  print "eval error = [[$@​]]\n";
  write;
  bash$ ./perl fmtbug.pl
  eval error = [[]]
  k
  ;bash$ # Arrgh!

The lone semicolon is sneaked into the string to be eval'ed, and no check
for the closing "\n.\n" catches (as is done when parsing from a file, including
a require/do). In short​: eval must not accept a format that is not explicitly
terminated.

A patch against toke.c (5.8.2) appears to fix this​:

  bash$ ./perl fmtbug.pl
  eval error = [[Format not terminated at (eval 1) line 5, at end of line
  syntax error at (eval 1) line 5, at EOF
  ]]
  Undefined format "STDOUT" called at ../fmtbug.pl line 7.

This breaks the new test 14 in t/op/write.t, so this is patched again.

Finally I'd like to draw your attention to the fact that some NULL
character *embedded* in the eval'ed string terminates format parsing
prematurely (possibly because strchr is used in toke.c in scan_formline),
resulting in an error ("Missing right curly or square bracket"). Any
need to fix this, accepting embedded NULLs?

Regards
Wolfgang

Inline Patch
--- toke.c.old	Fri Jan  2 08:50:37 2004
+++ toke.c	Fri Jan  2 10:11:31 2004
@@ -2424,8 +2424,12 @@
 	if (!PL_rsfp) {
 	    PL_last_uni = 0;
 	    PL_last_lop = 0;
-	    if (PL_lex_brackets)
-		yyerror("Missing right curly or square bracket");
+	    if (PL_lex_brackets) {
+ 	        if (PL_lex_formbrack)
+		    yyerror("Format not terminated");
+                else
+		    yyerror("Missing right curly or square bracket");
+	    }
             DEBUG_T( { PerlIO_printf(Perl_debug_log,
                         "### Tokener got EOF\n");
             } );
@@ -7577,6 +7581,7 @@
     register char *t;
     SV *stuff = newSVpvn("",0);
     bool needargs = FALSE;
+    bool eofmt = FALSE;
 
     while (!needargs) {
 	if (*s == '.' || *s == /*{*/'}') {
@@ -7586,8 +7591,10 @@
 #else
 	    for (t = s+1;SPACE_OR_TAB(*t) || *t == '\r'; t++) ;
 #endif
-	    if (*t == '\n' || t == PL_bufend)
+	    if (*t == '\n' || t == PL_bufend) {
+	        eofmt = TRUE;
 		break;
+            }
 	}
 	if (PL_in_eval && !PL_rsfp) {
 	    eol = strchr(s,'\n');
@@ -7627,7 +7634,6 @@
 	    PL_last_lop = PL_last_uni = Nullch;
 	    if (!s) {
 		s = PL_bufptr;
-		yyerror("Format not terminated");
 		break;
 	    }
 	}
@@ -7656,7 +7662,8 @@
     }
     else {
 	SvREFCNT_dec(stuff);
-	PL_lex_formbrack = 0;
+	if (eofmt)
+	    PL_lex_formbrack = 0;
 	PL_bufptr = s;
     }
     return s;
--- t/op/write.t.old	Fri Jan  2 11:11:28 2004
+++ t/op/write.t	Fri Jan  2 10:53:50 2004
@@ -302,12 +302,10 @@
 
 {
     # Bug #24774 format without trailing \n failed assertion
+    # but this must not compile because we'd get a ';' into the format
     my @v = ('k');
     eval "format OUT14 = \n@\n\@v";
-    open(OUT14, '&gt;Op_write.tmp') || die "Can't create Op_write.tmp";
-    write(OUT14);
-    close OUT14 or die "Could not close: $!";
-    print "ok 14\n";
+    print $@ ? "ok 14\n" : "not ok 14\n";
 }
 
 #######################################

@p5pRT
Copy link
Author

p5pRT commented Jan 2, 2004

From @Tux

On Fri 02 Jan 2004 11​:31, LAUN Wolfgang <wolfgang.laun@​alcatel.at> wrote​:

On Tue, 30 Dec 2003 15​:30​:37 +0000 davem@​fdisolutions.com wrote​:

On Tue, Dec 30, 2003 at 01​:26​:59AM -0000, rob@​exitexchange.com (via RT) wrote​:

created a format with eval, that does NOT include a trailing \n,
gives the following error when write() is called​:

Assertion fpc <= fops + maxops failed​: file "pp_ctl.c", line 3731 at (eval 1) line 5.

Ah, mea cupla!

Fixed by patch #22005
(Nick, this is a good candidate for 5.8.3)

Festina lente ;-)

Yes, it fixes the assertion failure and all that may come from an
insufficient allocation. But note that the eval does not return an
error, so the format can be run. Observe​:

Wolfgang, can I please have your comments on this​:

On Mon 27 Oct 2003 19​:36, "H.Merijn Brand" <h.m.brand@​hccnet.nl> wrote​:

The last paragraph of perlform sais

--8<---
Inside of an expression, the whitespace characters \n, \t and \f are
considered to be equivalent to a single space. Thus, you could think
of this filter being applied to each value in the format​:

   $value =~ tr/\\n\\t\\f/ /;

  The remaining whitespace character\, \\r\, forces the printing of a new
  line if allowed by the picture line\.

-->8---

I know nobody cares, but why is \e treated as whitespace? It's not in these
docs, and I cannot think of a valid reason to strip escapes, other than ...
way back when we had paper terminals ...

l1​:/pro/3gl/CPAN/perl-current 157 > perl5.8.0 -MO=Deparse merijn/fmt.pl
$_ = "\eE";
format STDOUT =
@​<<<<<<<<<<<<<<
$_
.
write;
merijn/fmt.pl syntax OK
l1​:/pro/3gl/CPAN/perl-current 158 > perl5.8.0 -MO=Concise merijn/fmt.pl
e <@​> leave[t1] vKP/REFC ->(end)
7 <0> enter ->8
8 <;> nextstate(main 1 fmt.pl​:3) v ->9
b <2> sassign vKS/2 ->c
9 <$> const(PV "\033E") s ->a
- <1> ex-rv2sv sKRM*/1 ->b
a <$> gvsv(*_) s ->b
c <;> nextstate(main 2 fmt.pl​:10) v ->d
d <0> enterwrite v ->e
merijn/fmt.pl syntax OK
l1​:/pro/3gl/CPAN/perl-current 159 > perl5.8.0 -MO=Terse merijn/fmt.pl
LISTOP (0x4001e170) leave [1]
OP (0x4002d650) enter
COP (0x4001e128) nextstate
BINOP (0x4001e0f8) sassign
SVOP (0x4001e088) const PV (0x4001a428) "\033E"
UNOP (0x4001e058) null [15]
SVOP (0x4001e028) gvsv GV (0x4001a314) *_
COP (0x4002d608) nextstate
OP (0x4002d5e0) enterwrite
merijn/fmt.pl syntax OK
l1​:/pro/3gl/CPAN/perl-current 160 > perl5.8.0 merijn/fmt.pl | cat -ve
E$
l1​:/pro/3gl/CPAN/perl-current 161 >

enterwrite calls S_doprint which calls CvSTART where I'm lost
I don't see the point (yet) where the \n\r\t\e are tr'd to space

--
H.Merijn Brand Amsterdam Perl Mongers (http​://amsterdam.pm.org/)
using perl-5.6.1, 5.8.0, & 5.9.x, and 806 on HP-UX 10.20 & 11.00, 11i,
  AIX 4.3, SuSE 8.2, and Win2k. http​://www.cmve.net/~merijn/
http​://archives.develooper.com/daily-build@​perl.org/ perl-qa@​perl.org
send smoke reports to​: smokers-reports@​perl.org, QA​: http​://qa.perl.org

@p5pRT
Copy link
Author

p5pRT commented Jan 2, 2004

From wolfgang.laun@alcatel.at

Hi Merijn, just a quick answer​:

-----Original Message-----
From​: H.Merijn Brand [mailto​:h.m.brand@​hccnet.nl]
Sent​: Friday, January 02, 2004 12​:19 PM
To​: LAUN Wolfgang
Cc​: Perl 5 Porters
Subject​: Re​: [perl #24774] eval + format - \n = pp_ctl.c assertion

On Fri 02 Jan 2004 11​:31, LAUN Wolfgang

Wolfgang, can I please have your comments on this​:

On Mon 27 Oct 2003 19​:36, "H.Merijn Brand"
<h.m.brand@​hccnet.nl> wrote​:

The last paragraph of perlform sais

--8<---
Inside of an expression, the whitespace characters \n, \t and \f are
considered to be equivalent to a single space. Thus, you could think
of this filter being applied to each value in the format​:

   $value =~ tr/\\n\\t\\f/ /;

  The remaining whitespace character\, \\r\, forces the printing of a new
  line if allowed by the picture line\.

-->8---

I know nobody cares, but why is \e treated as whitespace? It's not in these
docs, and I cannot think of a valid reason to strip escapes, other than ...
way back when we had paper terminals ...

Well, even then you'd want to keep escapes.

l1​:/pro/3gl/CPAN/perl-current 157 > perl5.8.0 -MO=Deparse merijn/fmt.pl
$_ = "\eE";
format STDOUT =
@​<<<<<<<<<<<<<<
$_
.
write;
merijn/fmt.pl syntax OK
l1​:/pro/3gl/CPAN/perl-current 160 > perl5.8.0 merijn/fmt.pl | cat -ve
E$
l1​:/pro/3gl/CPAN/perl-current 161 >

enterwrite calls S_doprint which calls CvSTART where I'm lost
I don't see the point (yet) where the \n\r\t\e are tr'd to space

These things happen in pp_ctl.c, and not just to ESC either. It seems
that all *control* characters are converted to space (except on EBCDIC
in the first loop, where the destination pointer is incremented twice).

THIS PATCH IS UNTESTED! I'll be back.
Wolfgang

--
H.Merijn Brand Amsterdam Perl Mongers

Inline Patch
--- pp_ctl.c.new	Fri Jan  2 12:45:32 2004
+++ pp_ctl.c	Fri Jan  2 12:50:13 2004
@@ -621,23 +621,15 @@
 		*t = '\0';
 		sv_catpvn_utf8_upgrade(PL_formtarget, s, arg, nsv);
 		for (; t < SvEND(PL_formtarget); t++) {
-#ifdef EBCDIC
-		    int ch = *t++ = *s++;
-		    if (iscntrl(ch))
-#else
-		    if (!(*t & ~31))
-#endif
+		    int ch = *t = *s++;
+		    if (isSPACE(ch))
 			*t = ' ';
 		}
 		break;
 	    }
 	    while (arg--) {
-#ifdef EBCDIC
 		int ch = *t++ = *s++;
-		if (iscntrl(ch))
-#else
-		if ( !((*t++ = *s++) & ~31) )
-#endif
+		if (isSPACE(ch))
 		    t[-1] = ' ';
 	    }
 	    break;

@p5pRT
Copy link
Author

p5pRT commented Jan 4, 2004

From @iabyn

On Fri, Jan 02, 2004 at 11​:31​:46AM +0100, LAUN Wolfgang wrote​:

Festina lente ;-)

Nil illegitimo carborundum?

Yes, it fixes the assertion failure and all that may come from an
insufficient allocation. But note that the eval does not return an
error, so the format can be run. Observe​:
[snip]
A patch against toke.c (5.8.2) appears to fix this​:

Thanks, applied as 22055.

Finally I'd like to draw your attention to the fact that some NULL
character *embedded* in the eval'ed string terminates format parsing
prematurely (possibly because strchr is used in toke.c in scan_formline),
resulting in an error ("Missing right curly or square bracket"). Any
need to fix this, accepting embedded NULLs?

My personal take on this (not that I ever use formats!) is that since
<<EOF preserves \0's, I don't see why formats should discard them. Would
it be possible to extend your 'pass through control chars' patch to handle
nulls too?

Dave.

--
SCO - a train crash in slow motion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant