X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 	tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
To: cygwin@cygwin.com
From: Andrew DeFaria <Andrew@DeFaria.com>
Subject:  Re: Nasty permissions / pathing bug in perl on 1.7
Date:  Sun, 29 Nov 2009 12:37:06 -0700
Lines: 34
Message-ID: <heuih3$nkd$1@ger.gmane.org>
References:  <BE3716D1FE6B45B6A50DEB1B448E71ED@multiplay.co.uk>
Mime-Version:  1.0
Content-Type:  text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding:  7bit
User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.1.5) Gecko/20091121 Lightning/1.0pre Thunderbird/3.0
In-Reply-To: <BE3716D1FE6B45B6A50DEB1B448E71ED@multiplay.co.uk>
X-Stationery: 0.4.10
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

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

