Show quoted text> -----Original Message-----
> From: Mark Shelor via RT [mailto:bug-Digest-SHA@rt.cpan.org]
> Sent: Sunday, April 06, 2008 3:50 AM
> To: brock@kuhsefamily.org
> Subject: [rt.cpan.org #34690] Digest::SHA errors with trailing space in
> file name
>
>
> <URL:
http://rt.cpan.org/Ticket/Display.html?id=34690 >
>
> Yes, Perl's 2-arg "open" ignores leading and trailing whitespace in
> filenames. The next version of Digest::SHA, scheduled for release
> later this month, will remedy the problem.
>
> However, the suggested patch will not be used. The 3-arg version of
> "open" has two serious flaws in the context of Digest::SHA:
>
> 1. It is not portable to versions of Perl prior to 5.6, and would
> orphan
> the large number of Digest::SHA users who operate on legacy platforms
> running ancient Perls.
I've only been writing perl scripts for about 4 years, and didn't know. Good information. We make it a point to keep our Linux servers homogeneous and up to date (thanks to package managers and our own custom repo), but I know not everyone has the luxury.
Show quoted text> 2. It has no magic, and interprets "-" as a literal filename instead of
> STDIN, thereby breaking the "shasum" script as well as existing user
> applications that rely on open's magic.
I can see where that could be problematic.
Show quoted text> So, the 2-arg "open" will be retained, and something like the following
> will be done to protect any leading or trailing whitespace (ref.
> perldoc -f open):
>
> $file =~ s#^(\s)#./$1#;
> open(FOO, "< $file\0");
Sounds good. My simple patch will get our Linux boxes through until the next release of Digest::SHA, at least. Thanks for the information, and for your work on this project - we use it to index and identify large numbers of files in backup volumes so our backup script can hard-link identical files that have had their names or paths changed since the last backup. Integrating Digest::SHA it into our backup script was trivial, so, thanks again.
Why our clients (and/or their software vendors) feel compelled to save files with trailing white spaces is beyond me...
- Brock