Description of problem: Digest::SHA refused to read files with name ending in spaces. Feels like the module truncated trail spaces in filenames. Version-Release number of selected component (if applicable): perl-Digest-SHA-5.45-52.fc10.x86_64 How reproducible: always. Steps to Reproduce: 1. mkdir t; cd t 2. create t.pl as in "Additional info:" section. chmod +x t.pl 3. create data files as follows: echo asdf > "t " echo -e "0\c" > t cp t "t2 " 4. ./t.pl * Actual results: ==t== b6589fc6ab0dc82cf12099d1c2d40ab994e8410c t ==t == b6589fc6ab0dc82cf12099d1c2d40ab994e8410c t ==t2 == Open failed: Bad file descriptor at ./t.pl line 17 Expected results: 1. print the sha1sum of "t2 ", instead of bad file descriptor. 2. sha1sum of "t " should be 7d97e98f8af710c7e7fe703abc8f639e0ee507c4. It looks like the calculation of "t " is taken from content of "t", ie. trailing space in filename truncated. Additional info: 1. the content of t.pl: #!/usr/bin/perl use Digest::SHA; for (@ARGV) { print ("==$_==\n"); printf("%s $_\n", &sha1sum($_)); } sub sha1sum() { my $file = shift; my $algorithm = 1; my $sha1 = Digest::SHA->new($algorithm); if (! -r $file) { return "unreadable"; } my $digest = $sha1->addfile($file); if (! defined($digest)){ return "digest undefined, file $file"; } my $hex = $digest->hexdigest; undef $digest; return $hex; }
Found the cause in pureperl module; not sure if the same applies to the .so lib as well. In file /usr/lib/perl5/5.10.0/i386-linux-thread-multi/Digest/SHA.pm method Addfile we have open(FH, "<$file") or _bail("Open failed"); which should be open(FH, "<", $file) or _bail("Open failed"); ie. use 3 args for open instead of 2 args. Apparently perl drops trailing spaces when open(FH, "<$file"). BTW, I didn't create filenames with trailing spaces; some crazy web browner did.
Wes, Does the proposal in Comment #1 make sense to you?
Sorry for the delay in a response to this. It's been a long few months of 2 trips and a VERY long illness. I think the fix you mention sounds right. I've logged a bug with the upstream about this and hopefully they'll fix it there. In the mean time, I'm actually no longer the owner of the Digest-SHA package because it comes out of the base perl package now in F10 (which even I keep forgetting). So I'm changing the component to that (where your patch can be applied).
Wes, Thanks! Hope you recover all ok.
This is apparently fixed already in the most recent Digest::SHA package too, FYI (according to the author). It's done a different way because of backwards compatibility needs with older perl (pre 5.6).
(In reply to comment #5) > This is apparently fixed already in the most recent Digest::SHA package too, Yes, Digest-SHA/Changes says this was fixed in version 5.46. This problem shoud be rt.cpan.org #34690, that would be: http://rt.cpan.org/Ticket/Display.html?id=34690 (I cannot check it atm, rt.cpan.org does not respond.) > It's done a different way because of backwards > compatibility needs with older perl (pre 5.6). Yes, the fix still uses 2-arg open(). I'm going to update Digest::SHA in rawhide and Fedora 10 to the latest release, 5.47.
perl-5.10.0-63.fc10 has been submitted as an update for Fedora 10. http://admin.fedoraproject.org/updates/perl-5.10.0-63.fc10
perl-5.10.0-64.fc10 has been pushed to the Fedora 10 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update perl'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F10/FEDORA-2009-2992
Said fix works well for me. I think we can close this bug. I tried to add feedback at http://admin.fedoraproject.org/updates/F10/FEDORA-2009-2992 but got "server internal error" several times. I had hard time to recognize the colorful security code; I think the colored code is too tough for robots and humans alike.
perl-5.10.0-66.fc10 has been pushed to the Fedora 10 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update perl'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F10/FEDORA-2009-2992
perl-5.10.0-67.fc10 has been pushed to the Fedora 10 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update perl'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F10/FEDORA-2009-2992
perl-5.10.0-68.fc10 has been pushed to the Fedora 10 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update perl'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F10/FEDORA-2009-2992
perl-5.10.0-68.fc9 has been pushed to the Fedora 9 stable repository. If problems still persist, please make note of it in this bug report.
perl-5.10.0-68.fc10 has been pushed to the Fedora 10 stable repository. If problems still persist, please make note of it in this bug report.