Bug 185623 - tell doesn't return right value when appending
Summary: tell doesn't return right value when appending
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: perl
Version: 3.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jason Vas Dias
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks: 187539
TreeView+ depends on / blocked
 
Reported: 2006-03-16 14:10 UTC by Bastien Nocera
Modified: 2007-11-30 22:07 UTC (History)
1 user (show)

Fixed In Version: RHBA-2006-0294
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-05-10 21:57:10 UTC
Target Upstream Version:
Embargoed:


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


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2006:0294 0 normal SHIPPED_LIVE perl bug fix update 2006-07-19 19:03:00 UTC

Description Bastien Nocera 2006-03-16 14:10:30 UTC
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 14:12:27 UTC
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 14:15:27 UTC
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 18:50:02 UTC
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 20:29:10 UTC
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 21:57:10 UTC
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.