From: Robbie Hatley on

Greetings, groups. I'm running Windows 2000 and djgpp, and trying
to read the built-in perl documentation via "perldoc", but it's
not working. Perldoc fails both when invoked from the Windows
command processor (cmd.exe) or from Bash. In either case, I get
an error like this:

wd=C:\djgpp\bin
%bash
bash-2.04$ perldoc perl
Error in tempfile() using c:/djgpp/tmp/XXXXXXXXXX: Could not create temp file c:
/djgpp/tmp/zkQ06tqlcH: Invalid argument (EINVAL) at /dev/env/DJDIR/lib/perl5/Pod
/Perldoc.pm line 1483
bash-2.04$ exit
exit
wd=C:\djgpp\bin
%perl perldoc perl
Error in tempfile() using C:/TEMP/XXXXXXXXXX: Could not create temp file C:/TEMP
/0mfgo64w9W: Invalid argument (EINVAL) at /dev/env/DJDIR/lib/perl5/Pod/Perldoc.p
m line 1483
wd=C:\djgpp\bin
%

Now, when I look at perldoc.pm line 1483, I see:

#..........................................................................
sub new_tempfile { # $self->new_tempfile( [$suffix, [$infix] ] )
my $self = shift;

++$Temp_Files_Created;

if( IS_MSWin32 ) {
my @out = $self->MSWin_perldoc_tempfile(@_);
return @out if @out;
# otherwise fall thru to the normal stuff below...
}

require File::Temp;
return File::Temp::tempfile(UNLINK => 1); ######### LINE 1483 #########
}
#..........................................................................

So, why would the parameters of File::Temp::tempfile be "invalid"?
And what the heck is "UNLINK"? That doesn't look like a variable.

I'm getting this problem both on my computer at work, and here at home.
Both computers are running MS Windows 2000, and both are using djgpp
and Perl version 5.8.8 .

I tried changing environment variable "tmpdir" to "C:\Temp", but I get
that same "Invalid argument on line 1483" error.

I'm not sure if this is a Perl issue or a djgpp issue (or both), so I'm
posting this in both comp.lang.perl.misc and comp.os.msdos.djgpp .

--
Cheers,
Robbie Hatley
perl -le 'print "\154o\156e\167o\154f\100w\145ll\56c\157m"'
perl -le 'print "\150ttp\72//\167ww.\167ell.\143om/~\154onewolf/"'


From: A. Sinan Unur on
"Robbie Hatley" <lonewolf(a)well.com> wrote in
news:zd6dnbRZ8J5AdJvVnZ2dnUVZ_rignZ2d(a)giganews.com:

> wd=C:\djgpp\bin
> %bash
> bash-2.04$ perldoc perl
> Error in tempfile() using c:/djgpp/tmp/XXXXXXXXXX: Could not
> create temp file c: /djgpp/tmp/zkQ06tqlcH: Invalid argument
> (EINVAL) at /dev/env/DJDIR/lib/perl5/Pod /Perldoc.pm line 1483
> bash-2.04$ exit
> exit
> wd=C:\djgpp\bin
> %perl perldoc perl
> Error in tempfile() using C:/TEMP/XXXXXXXXXX: Could not create
> temp file C:/TEMP /0mfgo64w9W: Invalid argument (EINVAL) at
> /dev/env/DJDIR/lib/perl5/Pod/Perldoc.p m line 1483
> wd=C:\djgpp\bin
> %

You have a permissions problem. Either c:\djgpp\tmp does not exist or
you do not have permissions to write there. Same applies to
C:\TEMP

I did use DJGPP for a long time. However, unless you really are doing
DOS development, I see very little point in trying to make do with
Perl in the DOS environment.

> return File::Temp::tempfile(UNLINK => 1); ######### LINE 1483
> #########
>
> So, why would the parameters of File::Temp::tempfile be "invalid"?
> And what the heck is "UNLINK"? That doesn't look like a variable.

No, the fat comma, =>, automatically quotes a bare string consisting
only of \w characters. Therefore, the statement above is identical to

return File::Temp::tempfile('UNLINK', 1);

> I'm getting this problem both on my computer at work, and here at
> home. Both computers are running MS Windows 2000, and both are
> using djgpp and Perl version 5.8.8 .
>
> I tried changing environment variable "tmpdir" to "C:\Temp", but I
> get that same "Invalid argument on line 1483" error.

If I remember correctly, there was problem where DJGPP tools were not
seeing the proper TEMP directory .. ah, yes, here is something that
might be useful:

http://groups.google.com/group/comp.os.msdos.djgpp/msg/ec8ac77e5e94a579

>
> I'm not sure if this is a Perl issue or a djgpp issue (or both),
> so I'm posting this in both comp.lang.perl.misc and
> comp.os.msdos.djgpp .
>

Sinan

--
A. Sinan Unur <1usa(a)llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
From: Robbie Hatley on

"A. Sinan Unur" wrote:

> "Robbie Hatley" wrote:
>
> > wd=C:\djgpp\bin
> > %bash
> > bash-2.04$ perldoc perl
> > Error in tempfile() using c:/djgpp/tmp/XXXXXXXXXX: Could not
> > create temp file c: /djgpp/tmp/zkQ06tqlcH: Invalid argument
> > (EINVAL) at /dev/env/DJDIR/lib/perl5/Pod /Perldoc.pm line 1483
> > bash-2.04$ exit
> > exit
> > wd=C:\djgpp\bin
> > %perl perldoc perl
> > Error in tempfile() using C:/TEMP/XXXXXXXXXX: Could not create
> > temp file C:/TEMP /0mfgo64w9W: Invalid argument (EINVAL) at
> > /dev/env/DJDIR/lib/perl5/Pod/Perldoc.p m line 1483
> > wd=C:\djgpp\bin
> > %
>
> You have a permissions problem. Either c:\djgpp\tmp does not exist or
> you do not have permissions to write there. Same applies to
> C:\TEMP

No.

First of all, in that situation, the error is different,
and says "Permission Denied" (EACESS or EPERM) not
"Invalid Argument (EINVAL)".

Secondly, that was the first thing I thought of. I tried setting
tmpdir first to "C:\djgpp\tmp", then to "C:\Temp". In each case
I set the permissions (NTFS file system) to "Everyone: Full Control".
But I still get "cannot create temp file: invalid argument".

> I did use DJGPP for a long time. However, unless you really are doing
> DOS development, I see very little point in trying to make do with
> Perl in the DOS environment.

What environment would you suggest? My Perl installation
works fine for my purposes in the Win2K command console
environment (cmd.exe), or a Bash sub-shell run from that.
It's Perldoc.pm that's malfunctioning, not Perl or djgpp
or cmd.exe.

> > return File::Temp::tempfile(UNLINK => 1); ######### LINE 1483
> > #########
> >
> > So, why would the parameters of File::Temp::tempfile be "invalid"?
> > And what the heck is "UNLINK"? That doesn't look like a variable.
>
> No, the fat comma, =>, automatically quotes a bare string consisting
> only of \w characters. Therefore, the statement above is identical to
> return File::Temp::tempfile('UNLINK', 1);

Ok. So under what conditions would ('UNLINK', 1) be "invalid"?

> If I remember correctly, there was problem where DJGPP tools were not
> seeing the proper TEMP directory .. ah, yes, here is something that
> might be useful:
>
> http://groups.google.com/group/comp.os.msdos.djgpp/msg/ec8ac77e5e94a579

I get:
myenv:
TEMP=C:\TEMP
TEMPDIR=C:\TEMP
TMP=C:\TEMP
TMPDIR=C:\TEMP
set:
TEMP=C:\TEMP
tempdir=C:\TEMP
TMP=C:\TEMP
tmpdir=C:\TEMP
Bash:
TEMP='C:\TEMP'
TEMPDIR='C:\TEMP'
TMP='C:\TEMP'
TMPDIR=c:/TEMP

It's all "C:\Temp" from any point of view. So that's not the
problem. The directory is correct, and the permissions are
correct.

But I still get "Invalid argument", and Perldoc still refuses
to run, on every computer I try it on.

--
Perplexed,
Robbie Hatley
perl -le 'print "\154o\156e\167o\154f\100w\145ll\56c\157m"'
perl -le 'print "\150ttp\72//\167ww.\167ell.\143om/~\154onewolf/"'


From: A. Sinan Unur on
"Robbie Hatley" <lonewolf(a)well.com> wrote in
news:YNqdnXMJMcgtkJrVnZ2dnUVZ_qOknZ2d(a)giganews.com:

>
> "A. Sinan Unur" wrote:
>
>> "Robbie Hatley" wrote:
>>
>> > wd=C:\djgpp\bin
>> > %bash
>> > bash-2.04$ perldoc perl
>> > Error in tempfile() using c:/djgpp/tmp/XXXXXXXXXX: Could not
>> > create temp file c: /djgpp/tmp/zkQ06tqlcH: Invalid argument
>> > (EINVAL) at /dev/env/DJDIR/lib/perl5/Pod /Perldoc.pm line 1483
>> > bash-2.04$ exit
>> > exit
>> > wd=C:\djgpp\bin
>> > %perl perldoc perl
>> > Error in tempfile() using C:/TEMP/XXXXXXXXXX: Could not create
>> > temp file C:/TEMP /0mfgo64w9W: Invalid argument (EINVAL) at
>> > /dev/env/DJDIR/lib/perl5/Pod/Perldoc.p m line 1483
>> > wd=C:\djgpp\bin
>> > %
>>
>> You have a permissions problem. Either c:\djgpp\tmp does not
>> exist or you do not have permissions to write there. Same applies
>> to C:\TEMP
>
....

> First of all, in that situation, the error is different,
> and says "Permission Denied" (EACESS or EPERM) not
> "Invalid Argument (EINVAL)".

Looking more carefully at the error message you posted, note that
the actual error is coming from File::Temp::_gettemp.

$open_success = sysopen($fh, $path, $flags, 0600);

is returning the error condition. So, the invalid value being passed
is either in $flags or the umask. I suspect $flags.

On a hunch, could you check what the following script prints:

#!/usr/bin/perl

use strict;
use warnings;

use Fcntl;

my $EXLOCK = eval {
local $SIG{__DIE__} = sub {};
local $SIG{__WARN__} = sub {};
&Fcntl::O_EXLOCK();
};

print "'$EXLOCK'\n";

__END__

Sinan

--
A. Sinan Unur <1usa(a)llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
From: Robbie Hatley on

"A. Sinan Unur" wrote:

> "Robbie Hatley" <lonewolf(a)well.com> wrote in
> news:YNqdnXMJMcgtkJrVnZ2dnUVZ_qOknZ2d(a)giganews.com:
>
> >
> > "A. Sinan Unur" wrote:
> >
> >> "Robbie Hatley" wrote:
> >>
> >> > wd=C:\djgpp\bin
> >> > %bash
> >> > bash-2.04$ perldoc perl
> >> > Error in tempfile() using c:/djgpp/tmp/XXXXXXXXXX: Could not
> >> > create temp file c: /djgpp/tmp/zkQ06tqlcH: Invalid argument
> >> > (EINVAL) at /dev/env/DJDIR/lib/perl5/Pod /Perldoc.pm line 1483
> >> > bash-2.04$ exit
> >> > exit
> >> > wd=C:\djgpp\bin
> >> > %perl perldoc perl
> >> > Error in tempfile() using C:/TEMP/XXXXXXXXXX: Could not create
> >> > temp file C:/TEMP /0mfgo64w9W: Invalid argument (EINVAL) at
> >> > /dev/env/DJDIR/lib/perl5/Pod/Perldoc.p m line 1483
> >> > wd=C:\djgpp\bin
> >> > %
> >>
> >> You have a permissions problem. Either c:\djgpp\tmp does not
> >> exist or you do not have permissions to write there. Same applies
> >> to C:\TEMP
> >
> ...
>
> > First of all, in that situation, the error is different,
> > and says "Permission Denied" (EACESS or EPERM) not
> > "Invalid Argument (EINVAL)".
>
> Looking more carefully at the error message you posted, note that
> the actual error is coming from File::Temp::_gettemp.
>
> $open_success = sysopen($fh, $path, $flags, 0600);
>
> is returning the error condition. So, the invalid value being passed
> is either in $flags or the umask. I suspect $flags.
>
> On a hunch, could you check what the following script prints:
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> use Fcntl;
>
> my $EXLOCK = eval {
> local $SIG{__DIE__} = sub {};
> local $SIG{__WARN__} = sub {};
> &Fcntl::O_EXLOCK();
> };
>
> print "'$EXLOCK'\n";
>
> __END__

Hmmm. That gives:

cwd = C:\
$p einval.p
Use of uninitialized value in concatenation (.) or string at
C:\scripts\einval.p line 14.
''
So it's just printing '', since $EXLOCK is uninitialized.
Whatever that indicates. I'm afraid its going way over my head.

--
Cheers,
Robbie Hatley
lonewolf aatt well dott com
www dott well dott com slant user slant lonewolf slant