delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/07/24/14:54:04

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <4046.12.105.86.170.1248381402.squirrel@bobsbits.net>
References: <4046 DOT 12 DOT 105 DOT 86 DOT 170 DOT 1248381402 DOT squirrel AT bobsbits DOT net>
Date: Fri, 24 Jul 2009 20:53:50 +0200
Message-ID: <6910a60907241153ue99dc0cuc9558de6849d4ba8@mail.gmail.com>
Subject: Re: cygwin 1.7 and perl Fcntl.pm and Touch.pm
From: Reini Urban <rurban AT x-ray DOT at>
To: cygwin AT cygwin DOT com, bob AT bobsbits DOT net, nwetters AT cpan DOT org
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

> installed cygwin 1.7
>
> bob AT davisrs/c/src654$ cygcheck -c cygwin
> Cygwin Package Information
> Package =A0 =A0 =A0 =A0 =A0 =A0 =A0Version =A0 =A0 =A0 =A0Status
> cygwin =A0 =A0 =A0 =A0 =A0 =A0 =A0 1.7.0-51 =A0 =A0 =A0 OK
>
> used cpan to install File::Touch
>
> The install fails from what appears to be an error with this module:
>
> bob AT davisrs/c/src654$ perl -MFcntl -e ' print $Fcntl::{"O_NONBLOCK"}, "\n=
" '
> SCALAR(0x100c22a0)

Hmm, this looks like an incorrect usage of the Fcntl exported constants.
Perl constants are subs and not scalars.

The right usage would be:
perl -MFcntl -le ' print O_NONBLOCK'
  -l is a trick to add \n to every output line.
and this is 16384 on 1.5 and 1.7 with all perl's I have.

perl -MFcntl -le ' print &O_NONBLOCK'

> Whereas on a cygwin 1.5 system this produces:
> bob AT davisrs1~$ perl -MFcntl -e ' print $Fcntl::{"O_NONBLOCK"}, "\n"'
> *Fcntl::O_NONBLOCK

This is perl-5.8 specific and not cygwin-1.5.

The idea is this:
This is the internal typeglob for the O_NONBLOCK symbol in the Fcntl
package namespace.
&{ $Fcntl::{'O_NONBLOCK'} } uses the sub of this typeglob, which
results in 16384.
Using &{ $Fcntl::{'O_NONBLOCK'} } ensures that the definition of O_NONBLOCK=
 is
checked and not the value, e.g. if O_NONBLOCK would be 0.

But the perl-5.10 Exporter was improved and therefore $Fcntl::{'O_NONBLOCK'}
autovivifies to a scalar, without any coderef. So it fails.

> The failing line(s) in touch.pm is:
>
> eval {
> =A0 =A0$SYSOPEN_MODE |=3D &{ $Fcntl::{'O_NONBLOCK'} };
> };
> if($@) {
> =A0 =A0if($@ =3D~ /Your vendor has not defined/) {
> =A0 =A0 =A0 =A0# probably running on Windows.
> =A0 =A0} else {
> =A0 =A0 =A0 =A0die "$@"; # Rethrow exception, must be something different
> =A0 =A0}

The next failure with this module are two wrong MacOS X files in the distro
._Makefile.PL and ._test.pl with binary garbage causing
Writing Makefile for File::Touch
(/usr/bin/perl Makefile.PL exited with 0)
CPAN::Reporter: Makefile.PL result is 'pass', No errors.
cp ._test.pl blib/lib/File/._test.pl
cp Touch.pm blib/lib/File/Touch.pm
Manifying blib/man3/File.Touch.3pm
/usr/bin/perl.exe "-Iblib/arch" "-Iblib/lib" ._Makefile.PL ._Makefile
Unrecognized character \x05 in column 2 at ._Makefile.PL line 1.
make: *** [._Makefile] Error 255
(/usr/bin/make exited with 512)

go to ~/.cpan/build/File-Touch-0.06-*
rm ._*

change the two lines of
$SYSOPEN_MODE |=3D &{ $Fcntl::{'O_NONBLOCK'} }
to
$SYSOPEN_MODE |=3D O_NONBLOCK


perl Makefile.PL
make
make test install clean

--=20
Reini Urban
http://phpwiki.org/           http://murbreak.at/

--
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