List Info

Thread: Erroneous binmode() call in uupacktool.pl




Erroneous binmode() call in uupacktool.pl
user name
2007-11-06 17:58:05
The uupacktool.pl calls binmode() on the input file handle,
which is
wrong because the .packed file is supposed to be a text
file.  If you
store the .packed files with CR/LF line endings the script
fails because
the regexp in the following line will not match anymore:

       my ($head, $body) = split /__UU__n/, $str;

You'll only run into this problem if you convert the Perl
sources to
native line endings on Windows.

Cheers,
-Jan

--- uupacktool.pl.orig  2007-05-20 21:35:51.000000000 -0700
+++ uupacktool.pl       2007-11-06 15:44:24.267480000 -0800
 -26,7
+26,6 

     open my $fh, "<", $file
         or do { warn "Could not open input file $file:
$!"; exit 0 };
-    binmode $fh;
     my $str = do { local $/; <$fh> };

     ### unpack?
End of patch.

PS: There is one other bug that will be exposed if you
convert the Perl sources to
    CR/LF line endings:

    http://rt.perl.org/rt3/Public/Bug/Display.html?id=27918

This bug should be reopened, it still exists in both
perl-5.8 and perl-
current (I don't seem to have write access to the Perl bug
database,
otherwise I would have reopened it myself). It is being
exposed by the
op/readline.t test, as I reported before:

    http://g
roups.google.com/group/perl.perl5.porters/browse_thread/thre
ad/ff331d0119e23971/45d624f415d8a85b

For my own repository I've just moved the two
fresh_perl_is() tests to the
end of the file, but I'm not sure this is the right thing
for the public
repo.



Re: Erroneous binmode() call in uupacktool.pl
user name
2007-11-07 04:47:47
On 07/11/2007, Jan Dubois <jandactivestate.com> wrote:
> The uupacktool.pl calls binmode() on the input file
handle, which is
> wrong because the .packed file is supposed to be a text
file.  If you
> store the .packed files with CR/LF line endings the
script fails because
> the regexp in the following line will not match
anymore:
>
>        my ($head, $body) = split /__UU__n/, $str;
>
> You'll only run into this problem if you convert the
Perl sources to
> native line endings on Windows.

Thanks, applied.

> PS: There is one other bug that will be exposed if you
convert the Perl sources to
>     CR/LF line endings:
>
>     http://rt.perl.org/rt3/Public/Bug/Display.html?id=27918
>
> This bug should be reopened, it still exists in both
perl-5.8 and perl-
> current (I don't seem to have write access to the Perl
bug database,
> otherwise I would have reopened it myself). It is being
exposed by the
> op/readline.t test, as I reported before:
>
>     http://g
roups.google.com/group/perl.perl5.porters/browse_thread/thre
ad/ff331d0119e23971/45d624f415d8a85b
>
> For my own repository I've just moved the two
fresh_perl_is() tests to the
> end of the file, but I'm not sure this is the right
thing for the public
> repo.

Thanks, reopened.

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )