Bug 185623 - tell doesn't return right value when appending
tell doesn't return right value when appending
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: perl (Show other bugs)
3.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jason Vas Dias
David Lawrence
:
Depends On:
Blocks: 187539
  Show dependency treegraph
 
Reported: 2006-03-16 09:10 EST by Bastien Nocera
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version: RHBA-2006-0294
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-05-10 17:57:10 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
perl-5.8.0-perlio-tell-bug-fix.patch (2.58 KB, patch)
2006-03-16 09:12 EST, Bastien Nocera
no flags Details | Diff
Patch which fixes issue in perl-5.8.0-90.9 (978 bytes, patch)
2006-03-16 13:50 EST, Jason Vas Dias
no flags Details | Diff

  None (edit)
Description Bastien Nocera 2006-03-16 09:10:30 EST
perl-5.8.0-90.4

The following test program returns the wrong value with RHEL3's Perl:
---8<---
#!/usr/bin/perl

open(F, ">>somefile");

$a=tell(F);
print "$a\n";

print F "end";

$a=tell(F);
print "$a\n";

close(F);
---8<---

On RHEL3:
# rm -f somefile
# perl foo.pl
0
3
# perl foo.pl
0
3
# perl foo.pl
0
3

On RHEL4:
# perl foo.pl
0
3
# perl foo.pl
3
6


Upstream bug seemed to be:
http://guest:guest@rt.perl.org/rt2//Ticket/Display.html?id=18711
With the patch at:
http://public.activestate.com/cgi-bin/perlbrowse?patch=18471
Comment 1 Bastien Nocera 2006-03-16 09:12:27 EST
Created attachment 126221 [details]
perl-5.8.0-perlio-tell-bug-fix.patch

Rediff'ed patch from the upstream fix. It isn't enough to fix the bug though,
as the first tell after an open() is still broken:
# perl foo.pl
0
3
# perl foo.pl
0
6
Comment 2 Bastien Nocera 2006-03-16 09:15:27 EST
I compared the code for flush, open and tell in the the current HEAD:
http://public.activestate.com/cgi-bin/perlbrowse?file=perlio.c&rev=
and with the patched version and couldn't find any significant differences to
explain why it didn't fix it.
Comment 3 Jason Vas Dias 2006-03-16 13:50:02 EST
Created attachment 126240 [details]
Patch which fixes issue in perl-5.8.0-90.9

Here's a patch which fixes the issue, which I'm applying in perl-5.8.0-90.9 .

The PerlIOUnix_open function also needed to lseek(fd,0,SEEK_END) if the file
was opened in append mode - this was fixed with a previous upstream patch.
Comment 4 Jason Vas Dias 2006-03-16 15:29:10 EST
Now fixed with perl-5.8.0-90.9, available from:
   http://people.redhat.com/~jvdias/perl/RHEL-3 
Comment 13 Red Hat Bugzilla 2006-05-10 17:57:10 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2006-0294.html

Note You need to log in before you can comment on or make changes to this bug.