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 Subject: Re: Nasty permissions / pathing bug in perl on 1.7 Date: Sun, 29 Nov 2009 12:37:06 -0700 Lines: 34 Message-ID: References: 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: X-Stationery: 0.4.10 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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 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