Front page | perl.perl5.porters |
Postings from January 2008
[perl #50266] Writeing to file error when using cgi that does not use http headers. FreeBSD Apache.
Thread Next
From:
77Network.com - 77Chat.com
Date:
January 26, 2008 18:22
Subject:
[perl #50266] Writeing to file error when using cgi that does not use http headers. FreeBSD Apache.
Message ID:
rt-3.6.HEAD-4355-1201380481-498.50266-75-0@perl.org
# New Ticket Created by "77Network.com - 77Chat.com"
# Please include the string: [perl #50266]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=50266 >
This is my code, it is a CGI script.
#!/usr/bin/perl
#print "Content-type: text/plain", "\n\n";
$file = "/usr/home/testuser/email.log";
$url = "http://google.com/"; # destination of the redirection
open(TMP, "> $file") || die "2";
binmode(TMP);
print TMP "xxxxxxxx";
close(tmp);
print "location: $url\n\n";
exit();
"email.log" is owned by the account with 777 permissions.
I am invoking the script through cgi on apache.
When I run the script as it is, "email.log" has its timestamp updated, however the file is empty. The browser gets redirected to google as expected.
I tried to do some debugging and I uncommented line 2. I did not do anything else. I only removed the "#" on line 2. When I run it this way everything works correctly. The file gets written and contains "xxxxxxxx" and the browser opens a file with the string http://google.com in it.
I then commented line 2 and reran it. The file was updated, but the contents were empty. The browser was once again redirected as expected. I have tried this with and with binmode(). The results are the same.
There are no errors produced in the log files.
If I run this script from the command prompt it works as expected.
I have tried a number of things with permissions and file owner. I also tried deleting the file and letting the webserver user create the file. It will create the file just fine, but the issue with the file being empty still remains.
This is such a common use of perl that I find it hard to believe it is a new bug, but I really don't know who else to contact about this. Please let me know if you want to see this occur for yourself. I can let you log on to the test account at my server.
I am running 5.8.8. I looked all over your website for the patches for this version, but I can't seem to locate the download for them.
Please let me know if this something you want to look into.
Kind Regards,
James Nemanich.
sp2791e# perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
Platform:
osname=freebsd, osvers=6.2-release, archname=i386-freebsd-64int
uname='freebsd freebsd.org 6.2-release freebsd 6.2-release #0: sat oct 14 21:57:31 pdt 2006 kris@freebsd.org:usrsrcsysmagickernelpath i386 '
config_args='-sde -Dprefix=/usr/local -Darchlib=/usr/local/lib/perl5/5.8.8/mach -Dprivlib=/usr/local/lib/perl5/5.8.8 -Dman3dir=/usr/local/lib/perl5/5.8.8/perl/man/man3 -Dman1dir=/usr/local/man/man1 -Dsitearch=/usr/local/lib/perl5/site_perl/5.8.8/mach -Dsitelib=/usr/local/lib/perl5/site_perl/5.8.8 -Dscriptdir=/usr/local/bin -Dsiteman3dir=/usr/local/lib/perl5/5.8.8/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Ui_malloc -Ui_iconv -Uinstallusrbinperl -Dcc=cc -Duseshrplib -Dccflags=-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.8/BSDPAN" -Doptimize=-O2 -fno-strict-aliasing -pipe -Ud_dosuid -Ui_gdbm -Dusethreads=n -Dusemymalloc=y -Duse64bitint'
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=define use64bitall=undef uselongdouble=undef
usemymalloc=y, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.8/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include',
optimize='-O2 -fno-strict-aliasing -pipe ',
cppflags='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.8/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include'
ccversion='', gccversion='3.4.6 [FreeBSD] 20060305', 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='cc', ldflags =' -Wl,-E -L/usr/local/lib'
libpth=/usr/lib /usr/local/lib
libs=-lm -lcrypt -lutil
perllibs=-lm -lcrypt -lutil
libc=, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -Wl,-R/usr/local/lib/perl5/5.8.8/mach/CORE'
cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: MYMALLOC PERL_MALLOC_WRAP USE_64_BIT_INT
USE_LARGE_FILES USE_PERLIO
Locally applied patches:
defined-or
Built under freebsd
Compiled at Oct 15 2006 05:04:59
@INC:
/usr/local/lib/perl5/5.8.8/BSDPAN
/usr/local/lib/perl5/site_perl/5.8.8/mach
/usr/local/lib/perl5/site_perl/5.8.8
/usr/local/lib/perl5/site_perl
/usr/local/lib/perl5/5.8.8/mach
/usr/local/lib/perl5/5.8.8
.
sp2791e#
Thread Next
-
[perl #50266] Writeing to file error when using cgi that does not use http headers. FreeBSD Apache.
by 77Network.com - 77Chat.com