Nasty permissions / pathing bug in perl on 1.7
Andrew DeFaria
Andrew@DeFaria.com
Sun Nov 29 22:53:00 GMT 2009
On 11/29/2009 11:43 AM, Steven Hartland wrote:
> Just been chasing my tail for hours trying to figure out why the
> permissions on a file weren't being set even though no error was being
> thrown.
>
> It turns out that giving a dos like path to chmod in perl under 1.7
> although doesn't error it doesn't do anything either.
>
> Here's my little test case:
> [script]
> #!/usr/bin/perl -w
> use strict;
>
> unlink '/tmp/test.exe';
>
> print `touch /tmp/test.exe; ls -l /tmp/test.exe`;
>
> if ( ! chmod 0777, 'C:/cygwin/tmp/test.exe' )
> {
> print STDERR "Failed to chmod ($!)\n";
> exit 1;
> }
I don't have an answer for your problem however why not do:
die "Failed to chmod ($!)"
unless chmod 0777, 'C:/cygwin/tmp/test.exe';
"die" writing to STDERR and exits with a non-zero status. Additionally,
if you don't put a '\n' in the message, die will print out the line
number of where it was called. Finally, unless is a cleaner way of
specifying not logic (IMHO).
--
Andrew DeFaria <http://defaria.com>
The Definition of an Upgrade: Take old bugs out, put new ones in.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list