This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Nasty permissions / pathing bug in perl on 1.7

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:
#!/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 <>
The Definition of an Upgrade: Take old bugs out, put new ones in.

-- Problem reports: FAQ: Documentation: Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]