delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/11/29/14:37:41

X-Recipient: archive-cygwin AT delorie DOT 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 AT cygwin DOT com
From: Andrew DeFaria <Andrew AT DeFaria DOT 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 AT multiplay DOT co DOT uk>
Mime-Version: 1.0
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 AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019