OS/2 port of Perl 5.8 not adding CR to \n

  • Thread starter Shmuel (Seymour J.) Metz
  • Start date
S

Shmuel (Seymour J.) Metz

I installed Perl 5.8 from
<http://www.cpan.org/authors/id/I/IL/ILYAZ/os2/582+/> and was dismayed
to see output lines on STDOUT terminated with just linefeed instead of
CRLF. According to the dromedary and the online documentation, Perl
should have replaced the LF with the appropriate ending sequence for
the platform, and OS/2 uses the same convention as DOS, CRLF.

When I installed 5.8, I used the option to upgrade an existing
installation. Could that be the problem? Did I download the wrong
version?

Thanks for any assistance.

--
Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action. I reserve the
right to publicly post or ridicule any abusive E-mail. Reply to
domain Patriot dot net user shmuel+news to contact me. Do not
reply to (e-mail address removed)
 
I

Ilya Zakharevich

[A complimentary Cc of this posting was NOT [manually] sent to
Shmuel (Seymour J.) Metz
I installed Perl 5.8 from
<http://www.cpan.org/authors/id/I/IL/ILYAZ/os2/582+/> and was dismayed
to see output lines on STDOUT terminated with just linefeed instead of
CRLF.

"Dismayed"?!!!

Hint: a bug report should include: your code, what you expect to see
as the result, and what you actually see.

But trying to read your mind: are you using syswrite()? With the new
IO model in place, syswrite() is automatically binmode(). This is
unfortunate, but sits quite deep in the innards of the (IMO, borken)
implementation of IO model.

Hope this helps,
Ilya
 
S

Shmuel (Seymour J.) Metz

on 08/29/2004 said:
Hint: a bug report

I wanted to first confirm that I had installed the correct version. I
had assumed that enough people were using the OS/2 port that this
could not be new.
But trying to read your mind: are you using syswrite()?

Print, with the default (STDOUT) file handle. Does that go through
syswrite?

If this is indeed the correcxt version, do I report the bug to CPAN?
If not, what is the proper URL?

Thanks.

--
Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action. I reserve the
right to publicly post or ridicule any abusive E-mail. Reply to
domain Patriot dot net user shmuel+news to contact me. Do not
reply to (e-mail address removed)
 
I

Ilya Zakharevich

[A complimentary Cc of this posting was sent to
Shmuel (Seymour J.) Metz
I wanted to first confirm that I had installed the correct version.
"Correct"???
Print, with the default (STDOUT) file handle. Does that go through
syswrite?

Only syswrite() "goes through syswrite()".
If this is indeed the correcxt version, do I report the bug to CPAN?

What bug?

Hope this helps,
Ilya
 
S

Shmuel (Seymour J.) Metz

on 08/30/2004 said:
"Correct"???

That is, I wanted to verify that the Perl at
What bug?

The code

print "testline1a\ntestline1b\n","testline2\n";
print "testline2\n";

Produces the output

testline1a
testline1b
testline2

This occurs even if I

SET PerlIO=:crlf

--
Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action. I reserve the
right to publicly post or ridicule any abusive E-mail. Reply to
domain Patriot dot net user shmuel+news to contact me. Do not
reply to (e-mail address removed)
 
I

Ilya Zakharevich

[A complimentary Cc of this posting was sent to
Shmuel (Seymour J.) Metz
That is, I wanted to verify that the Perl at
<http://www.cpan.org/authors/id/I/IL/ILYAZ/os2/582+/> is in fact the
most recnt OS/2 port.

Since it is not a port, but a build, your question does not make sense.
The code

print "testline1a\ntestline1b\n","testline2\n";
print "testline2\n";

This is not a code somebody can run. Try

perl -we "%ENV=(); system $^X, @ARGV" -- -e "print qq(a\nb\n)"

(This starts a kid Perl process without any environment. You may need
to double % if you start it from 4os2.)

Hope this helps,
Ilya
 
P

Peter Weilbacher

Since it is not a port, but a build, your question does not make sense.

But you could still try to answer the question he really has. :)

At least I am using that version and it works quite well for me.
Although I almost only use it for Mozilla compilation currently (which
makes quite heavy use of perl scripts).
This is not a code somebody can run.

No, but if I put that into a test.pl and then run perl test.pl I get
[M:\PETER]perl test.pl
testline1a
testline1b
testline2
testline2

[M:\PETER]
Where the linebreaks really are 0x0d, 0x0a.
Try

perl -we "%ENV=(); system $^X, @ARGV" -- -e "print qq(a\nb\n)"

That gives me
[M:\PETER]perl test.pl
a
b

[M:\PETER]
just as expected. If Shmuel does not then something is probably wrong
with the installation.
 
I

Ilya Zakharevich

[A complimentary Cc of this posting was NOT [per weedlist] sent to
Peter Weilbacher
just as expected.

Of course
If Shmuel does not then something is probably wrong
with the installation.

If it is installed, there should be no way to break CRLF stuff.
Either it is not installed (and some other version is run), or some
environment variable loads some extra module.

The first condition may be detected by

J:\test-programs\perl\modules>perl -wle "print OS2::DLLname"
J:\test-programs\perl\modules>perl -wle "print $^X"

and perl -V (the DLL name should be .../PERL312F.DLL). The second
condition is detected by the command I gave, as well as the tail of
`perl -V' output.

Hope this helps,
Ilya
 
S

Shmuel (Seymour J.) Metz

on 09/01/2004 said:
The first condition may be detected by

[H:\]perl -wle "print OS2::DLLname"
G:/EMX/DLL/PERL312F.DLL

[H:\]perl -wle "print $^X"
G:/EMX/BIN/PERL.EXE
and perl -V

Summary of my perl5 (revision 5.0 version 8 subversion 2)
configuration:
Platform:
osname=os2, osvers=2.30, archname=os2
uname='os2 ia-ia 2 2.30 i386 '
config_args='-des -D prefix=i:/perllib'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=unde f
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=y, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-Zomf -Zmt -DDOSISH -DOS2=2 -DEMBED -I.
-D_EMX_CRT_REV_=
60',
optimize='-O2 -fomit-frame-pointer -malign-loops=2 -malign-jumps=2
-malign-f unctions=2 -s',
cppflags='-Zomf -Zmt -DDOSISH -DOS2=2 -DEMBED -I.
-D_EMX_CRT_REV_=60'
ccversion='', gccversion='2.8.1', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define,
longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize =4
alignbytes=4, prototype=define
Linker and Libraries:
ld='gcc', ldflags ='-Zexe -Zomf -Zmt -Zcrtdll -Zstack 32000
-Zlinker /e:2'
libpth=i:/emx.add/lib i:/emx/lib i:/emx.f77/lib
D:/DEVTOOLS/OPENGL/LIB I:/JAVA11/LIB i:/emx/lib/mt
libs=-lsocket -lm -lbsd -lcrypt
perllibs=-lsocket -lm -lbsd -lcrypt
libc=i:/emx/lib/mt/c_import.lib, so=dll, useshrplib=true,
libperl=libperl.lib
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-Zdll', lddlflags='-Zdll -Zomf -Zmt -Zcrtdll -Zlinker
/e:2'


Characteristics of this binary (from libperl):
Compile-time options: USE_LARGE_FILES
Built under os2
Compiled at Dec 14 2003 01:02:36
%ENV:
PERLIO=":crlf"
PERLLIB_PREFIX="i:/perllib/lib;G:\PERLLIB\LIB"
PERL_BADLANG="0"
PERL_SH_DIR="G:\BIN"
@INC:
G:/PERLLIB/LIB/5.8.2/os2
G:/PERLLIB/LIB/5.8.2
G:/PERLLIB/LIB/site_perl/5.8.2/os2
G:/PERLLIB/LIB/site_perl/5.8.2
G:/PERLLIB/LIB/site_perl/5.00553
G:/PERLLIB/LIB/site_perl
 
S

Shmuel (Seymour J.) Metz

on 08/31/2004 said:
Since it is not a port, but a build, your question does not make
sense.

perl -we "%ENV=(); system $^X, @ARGV" -- -e "print qq(a\nb\n)"

That works. I didn't need to double the %, and doing so causes an
error message.

I've played around with the failing program, and have a somewhat
shoreter test case. I have one version that works, and one that fails,
differing only in the code

BEGIN {
$E::errno_okay = 0;
if(eval "require Errno") {
Errno->import();
$E::errno_okay = 1;
}
$E::dbi_okay = 0;
if(eval "require DBI") {
$E::dbi_okay = 1;
}
$E::cgi_okay = 0;
if(eval "require CGI") {
$E::cgi_okay = 1;
}
$E::bwInclude_okay = 0;
if(eval "require bwInclude") {
$E::bwInclude_okay = 1;
}
}
Hope this helps,

Thank you. Any idea why the above code would affect the \n handling?

--
Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action. I reserve the
right to publicly post or ridicule any abusive E-mail. Reply to
domain Patriot dot net user shmuel+news to contact me. Do not
reply to (e-mail address removed)
 
I

Ilya Zakharevich

[A complimentary Cc of this posting was sent to
Shmuel (Seymour J.) Metz
Then is <http://www.cpan.org/authors/id/I/IL/ILYAZ/os2/582+/> the most
recent stable build for OS/2?

"Stable" does not makes sense for builds - they do not change under
your foot. The most recent is one done by you 3 secs ago - but maybe
in these 3 secs somebody else beat you for it...
That works. I didn't need to double the %, and doing so causes an
error message.

Looking at your `perl -V', I suspect that just

perl -we "print qq(a\nb\n)"

will do the same, no playing with %ENV is necessary...
I've played around with the failing program, and have a somewhat
shoreter test case.

People who want other people to spend their time helping them (if you
can parse it ;-) usually try to show they are at the end of their
rope. Definitely you could make it shorter than this...

And again, it does not make sense posting a "piece" of code. Did not
you see it?

Hope this helps,
Ilya
 
S

Shmuel (Seymour J.) Metz

on 09/02/2004 said:
Looking at your `perl -V', I suspect that just
perl -we "print qq(a\nb\n)"
will do the same, no playing with %ENV is necessary...

Probably; the problem turns out to be the eval "require CGI in the
BEGIN block.
And again, it does not make sense posting a "piece" of code.

Well, in this case the piece of code turns out to be all that was
relevant. I got it working by commenting out that code. Looking at
CGI.pm, I see

$needs_binmode = $OS=~/^(WINDOWS|DOS|OS2|MSWin|CYGWIN)/;

if ($needs_binmode) {
$CGI::DefaultClass->binmode(main::STDOUT);
$CGI::DefaultClass->binmode(main::STDIN);
$CGI::DefaultClass->binmode(main::STDERR);
}

I couldn't find anything in the documentation mentioning that, so now
my question is "Is that a bug or a feature?"

--
Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action. I reserve the
right to publicly post or ridicule any abusive E-mail. Reply to
domain Patriot dot net user shmuel+news to contact me. Do not
reply to (e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top