X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-0.2 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_LOW,T_FILL_THIS_FORM_SHORT X-Spam-Check-By: sourceware.org From: "DEWI - N. Zacharias" To: "cygwin AT cygwin DOT com" Date: Wed, 5 May 2010 10:57:31 +0200 Subject: reading /proc/registry/ causes Segmentation fault. Message-ID: <8CCC8F85C5F2784387A32FAD835FB4E602DBF139CF@server03> Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CheckCompat: OK X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 Hi all, The script below worked without problems last month. But now I get Segment= ation fault (core dumped). If I use the lines which begins with #this works fine instead of the one with GetWordExe it works fine. I tested it with the latest update Sorry that it is not shorter but it is the shortes form to get it work. Have a nice day Norbert ###########################################################################= ######## #! /usr/bin/perl -w use IO::File; my $RegistryOffice =3D '/proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsof= t/Office/'; my ($Reg_Word_Exe,$Reg_Office_Ver,$Reg_Word_Path); sub GetOfficeVer { if($Reg_Office_Ver) { return($Reg_Office_Ver); } opendir( my $ww, $RegistryOffice); my @a =3D grep{m/\d+\.\d+/}readdir($ww); closedir($ww); foreach my $tr(@a) { my $w =3D $RegistryOffice.$tr.'/Word/InstallRoot/Path'; if( -f $w) { $Reg_Office_Ver =3D $tr; my $ww =3D IO::File->new("< $w"); $Reg_Word_Path =3D <$ww>; $ww->close(); $Reg_Word_Path =3D~ s/\r*\n//; $Reg_Word_Path =3D~ s/\x0//; last; } } return($Reg_Office_Ver); } sub GetWordExe { if($Reg_Word_Exe) { return($Reg_Word_Exe); } if(!$Reg_Office_Ver) { GetOfficeVer(); } opendir(my $ww,$Reg_Word_Path); my @wa =3D grep{ m/^.*word\.exe/i} readdir($ww); closedir($ww); if(!@wa) { return(undef); } $Reg_Word_Exe =3D $Reg_Word_Path.$wa[0]; return( $Reg_Word_Exe); } ############################### here the script start working############ my $myDir =3D "/cygdrive/g/somedir"; my $myDoc =3D ' aname.doc /mamacro'; my $WordExe =3D Cygwin::win_to_posix_path(GetWordExe(),1); #this works fine my $xx =3D 'C:\Programme\Microsoft Office\Office12\WINWORD= .EXE'; #this works fine my $WordExe =3D Cygwin::win_to_posix_path($xx,1= ); $WordExe =3D~s/ /\\ /g; $WordExe.=3D$myDoc ; system('cd '.$somedir.";\n".$WordExe); sleep(3); while(1) { print "*"; my $ls =3D IO::File->new("ps -Wa |"); my @l =3D grep{ s/\n// && m/WINWORD\.EXE/ }<$ls>; if(! @l) { last; } $ls->close(); } exit; ################################################## -------------------------------------------------------------------------- Dipl. Phys. Norbert Zacharias Wind Measurements & Power Curve Measurements DEWI GmbH Ebertstrasse 96 26382 Wilhelmshaven Germany Tel.: +49 4421 4808 876 Fax: +49 4421 4808 843 Email: N DOT Zacharias AT dewi DOT de Home: http://http://www.dewi.de DEWI GmbH - Deutsches Windenergie-Institut, Wilhelmshaven Commercial Register No.: Amtsgericht Oldenburg, HRB 130241 Managing Director: Jens Peter Molly Chairman of the supervisory board: Ministerialrat Dr. Niels K=E4mpny P Please consider the environment before printing this email. -- 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