Skip Menu | You are currently an anonymous guest. | Login | Return to Main | Preferences
Id: 32342
Status: open
Left: 0 min
Priority: 0/0
Queue: perl5

Owner: Nobody
Requestors: quietdragon <earl_chew [at] agilent.com>
Cc:
AdminCc:

Operating System: cygwin
PatchStatus: (no value)
Severity: medium
Type:
  • core
  • OS-interaction
  • PerlIO
  • portability
Perl Version: 5.8.5
Fixed In: (no value)



X History Display mode: Brief headersFull headers
#   Fri Nov 05 15:59:26 2004 quietdragon - Ticket created  
CC: gp@familiehaase.de
Subject: Perl binmode problem on cygwin text mount
Date: Fri, 05 Nov 2004 15:58:58 -0800
To: perlbug@perl.org
From: Earl Chew <earl_chew@agilent.com>
Download (untitled) [text/plain 4.6k]
This is a bug report for perl from earl_chew@agilent.com,
generated with the help of perlbug 1.35 running under perl v5.8.5.


-----------------------------------------------------------------
[Please enter your report here]

Perl v5.8.5 does not correct set cygwin binmode when dealing
with STDOUT vs a disk file:

binmode STDOUT;
print "Hello\n";

Perl v5.6.1 does not have this problem:

perl foo.pl > foo.txt ; od -c foo.txt ; ls -l foo.txt

0000000 H e l l o \r \n # Perl 5.8.5-3 Cygwin 1.5.11
-rw-r--r-- 1 earl mkpasswd 7 Nov 4 11:10 foo.txt


0000000 H e l l o \n # Perl 5.6.1-2 Cygwin 1.3.10
-rw-r--r-- 1 earl mkpasswd 6 Nov 4 11:14 foo.txt


0000000 H e l l o \n # Perl 5.6.1-2 Cygwin 1.5.11
-rw-r--r-- 1 earl mkpasswd 6 Nov 4 11:14 foo.txt

The file sizes reported by ls confirm the extra \r reported by od.

This problem can also be reproduced by using on a text mount:

perl -e 'open OUT,">q.txt";binmode OUT;print OUT "Hello\n"'
perl -e 'binmode STDOUT;print STDOUT "Hello\n"' > q.txt

The output in q.txt (held on a text mount) differs between the
two invocations. This is described in more detail in:

http://www.cygwin.com/ml/cygwin/2004-11/msg00192.html
http://www.cygwin.com/ml/cygwin/2004-11/msg00198.html

and in the thread beginning:

http://www.cygwin.com/ml/cygwin/2004-11/msg00131.html

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=core
severity=medium
---
Site configuration information for perl v5.8.5:

Configured by gerrit at Thu Aug 19 19:39:49 2004.

Summary of my perl5 (revision 5 version 8 subversion 5) configuration:
Platform:
osname=cygwin, osvers=1.5.10(0.11642),
archname=cygwin-thread-multi-64int
uname='cygwin_nt-5.1 inspiron 1.5.10(0.11642) 2004-05-25 22:07 i686
unknown unknown cygwin '
config_args='-de -Dmksymlinks -Duse64bitint -Dusethreads
-Doptimize=-O2 -Dman3ext=3pm'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=define use64bitall=undef uselongdouble=undef
usemymalloc=y, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing
-pipe -I/usr/local/include',
optimize='-O2',
cppflags='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe
-I/usr/local/include'
ccversion='', gccversion='3.3.3 (cygwin special)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long long', ivsize=8, nvtype='double', nvsize=8,
Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='ld2', ldflags =' -s -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib /lib
libs=-lgdbm -ldb -lcrypt -lgdbm_compat
perllibs=-lcrypt -lgdbm_compat
libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' -s'
cccdlflags=' ', lddlflags=' -s -L/usr/local/lib'

Locally applied patches:


---
@INC for perl v5.8.5:
/usr/lib/perl5/5.8.5/cygwin-thread-multi-64int
/usr/lib/perl5/5.8.5
/usr/lib/perl5/site_perl/5.8.5/cygwin-thread-multi-64int
/usr/lib/perl5/site_perl/5.8.5
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.5/cygwin-thread-multi-64int
/usr/lib/perl5/vendor_perl/5.8.5
/usr/lib/perl5/vendor_perl
.

---
Environment for perl v5.8.5:
HOME=/Documents and Settings/liz
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/Program Files/Agilent/N2X/Platform/bin:/Program
Files/Tcl83/bin:/cygdrive/d/ipcommon/shared/win32_debug:/Program
Files/Agilent/RouterTester/bin:/qarobot/tools/ethereal:/gcc-2.95.2/bin:/qarobot/release:/Program
Files/Agilent/RouterTester/bin:/vim/vim56:/WINNT/system32:/WINNT:/WINNT/System32/Wbem:/bin:/usr/bin:/cygdrive/d/cerberus/acl/lib/win32_debug:/cygdrive/d/cerberus/acl/lib/win32:/cygdrive/d/cerberus/zlib/lib/win32:/cygdrive/d/cerberus/zlib/lib/win32_debug:/cygdrive/d/cerberus/daytona/bin:/cygdrive/d/Progra~1/Microsoft
Visual Studio .NET/Vc7/bin:/cygdrive/d/Progra~1/Microsoft Visual Studio
.NET/Common7/IDE:/cygdrive/d/Progra~1/Microsoft Visual Studio
.NET/Common7/Tools/Bin:/qatoolkit/bin:/Program
Files/Rational/ClearCase/bin:/Program Files/Rational/common:/Program
Files/Rational/ClearCase/bin/fix
PERL_BADLANG (unset)
SHELL (unset)
#   Fri Nov 05 15:59:28 2004 RT_System - Operating System cygwin added  
#   Fri Nov 05 15:59:28 2004 RT_System - Severity medium added  
#   Fri Nov 05 15:59:28 2004 RT_System - Type core added  
#   Fri Nov 05 15:59:29 2004 RT_System - Perl Version 5.8.5 added  
#   Fri Nov 12 12:07:39 2004 stmpeters - Correspondence added  
RT-Send-CC: perl5-porters@perl.org
Download (untitled) [text/plain 2.2k]
> [quietdragon - Fri Nov 05 15:59:26 2004]:
>
> This is a bug report for perl from earl_chew@agilent.com,
> generated with the help of perlbug 1.35 running under perl v5.8.5.
>
>
> -----------------------------------------------------------------
> [Please enter your report here]
>
> Perl v5.8.5 does not correct set cygwin binmode when dealing
> with STDOUT vs a disk file:
>
> binmode STDOUT;
> print "Hello\n";
>
> Perl v5.6.1 does not have this problem:
>
> perl foo.pl > foo.txt ; od -c foo.txt ; ls -l foo.txt
>
> 0000000 H e l l o \r \n # Perl 5.8.5-3 Cygwin 1.5.11
> -rw-r--r-- 1 earl mkpasswd 7 Nov 4 11:10 foo.txt
>
>
> 0000000 H e l l o \n # Perl 5.6.1-2 Cygwin 1.3.10
> -rw-r--r-- 1 earl mkpasswd 6 Nov 4 11:14 foo.txt
>
>
> 0000000 H e l l o \n # Perl 5.6.1-2 Cygwin 1.5.11
> -rw-r--r-- 1 earl mkpasswd 6 Nov 4 11:14 foo.txt
>
> The file sizes reported by ls confirm the extra \r reported by od.
>
> This problem can also be reproduced by using on a text mount:
>
> perl -e 'open OUT,">q.txt";binmode OUT;print OUT "Hello\n"'
> perl -e 'binmode STDOUT;print STDOUT "Hello\n"' > q.txt
>
> The output in q.txt (held on a text mount) differs between the
> two invocations. This is described in more detail in:
>
> http://www.cygwin.com/ml/cygwin/2004-11/msg00192.html
> http://www.cygwin.com/ml/cygwin/2004-11/msg00198.html
>
> and in the thread beginning:
>
> http://www.cygwin.com/ml/cygwin/2004-11/msg00131.html
>

I was not able to repliate this problem with the stock Cygwin Perl on
the Cygwin/XP environment.

$ perl foo.pl > foo.txt ; od -c foo.txt ; ls -l foo.txt
0000000 H e l l o \n
0000006
-rw-r--r-- 1 STEVE group 6 Nov 12 2004 foo.txt

STEVE@kirk ~/sandbox
$ perl -v

This is perl, v5.8.5 built for cygwin-thread-multi-64int

Copyright 1987-2004, Larry Wall

Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.


STEVE@kirk ~/sandbox
$ uname -a
CYGWIN_NT-5.1 kirk 1.5.11(0.116/4/2) 2004-09-04 23:17 i686 unknown unknown
Cygwin
#   Fri Nov 12 12:07:41 2004 RT_System - Status changed from 'new' to 'open'  
#   Sat Nov 13 06:44:07 2004 gph - Correspondence added  
CC: perl5-porters@perl.org
Subject: Re: [perl #32342] Perl binmode problem on cygwin text mount
Date: Sat, 13 Nov 2004 15:43:42 +0100
To: perlbug-followup@perl.org
From: "Gerrit P. Haase" <gp@familiehaase.de>
Download (untitled) [text/plain 1.9k]
Steve Peters via RT wrote:
>>[quietdragon - Fri Nov 05 15:59:26 2004]:
>>
>>This is a bug report for perl from earl_chew@agilent.com,
>>generated with the help of perlbug 1.35 running under perl v5.8.5.
>>
>>
>>-----------------------------------------------------------------
>>[Please enter your report here]
>>
>>Perl v5.8.5 does not correct set cygwin binmode when dealing
>>with STDOUT vs a disk file:
>>
>> binmode STDOUT;
>> print "Hello\n";
>>
>>Perl v5.6.1 does not have this problem:
>>
>>perl foo.pl > foo.txt ; od -c foo.txt ; ls -l foo.txt
>>
>> 0000000 H e l l o \r \n # Perl 5.8.5-3 Cygwin 1.5.11
>> -rw-r--r-- 1 earl mkpasswd 7 Nov 4 11:10 foo.txt
>>
>>
>> 0000000 H e l l o \n # Perl 5.6.1-2 Cygwin 1.3.10
>> -rw-r--r-- 1 earl mkpasswd 6 Nov 4 11:14 foo.txt
>>
>>
>> 0000000 H e l l o \n # Perl 5.6.1-2 Cygwin 1.5.11
>> -rw-r--r-- 1 earl mkpasswd 6 Nov 4 11:14 foo.txt
>>
>>The file sizes reported by ls confirm the extra \r reported by od.
>>
>>This problem can also be reproduced by using on a text mount:
>>
>>perl -e 'open OUT,">q.txt";binmode OUT;print OUT "Hello\n"'
>>perl -e 'binmode STDOUT;print STDOUT "Hello\n"' > q.txt
>>
>>The output in q.txt (held on a text mount) differs between the
>>two invocations. This is described in more detail in:
>>
>>http://www.cygwin.com/ml/cygwin/2004-11/msg00192.html
>>http://www.cygwin.com/ml/cygwin/2004-11/msg00198.html
>>
>>and in the thread beginning:
>>
>>http://www.cygwin.com/ml/cygwin/2004-11/msg00131.html
>>
>
>
> I was not able to repliate this problem with the stock Cygwin Perl on
> the Cygwin/XP environment.
>
> $ perl foo.pl > foo.txt ; od -c foo.txt ; ls -l foo.txt
> 0000000 H e l l o \n
> 0000006
> -rw-r--r-- 1 STEVE group 6 Nov 12 2004 foo.txt

It fails when you are doing this in a textmode mounted direcotory.

`mount | grep sandbox' shows what?

IOf not textmode mounted, please try again after:

$ mount -s -f -t X:/home/STEVE/sandbox /home/STEVE/sandbox

Gerrit
--
=^..^=
#   Tue Nov 16 01:02:41 2004 quietdragon - Correspondence added  
CC: gp@familiehaase.de
Subject: Re: [perl #32342] Perl binmode problem on cygwin text mount
Date: Mon, 15 Nov 2004 09:57:43 -0800
To: perlbug-followup@perl.org
From: Earl Chew <earl_chew@agilent.com>
Download (untitled) [text/plain 645b]
Steve Peters via RT wrote:
> I was not able to repliate this problem with the stock Cygwin Perl on
> the Cygwin/XP environment.
>
> $ perl foo.pl > foo.txt ; od -c foo.txt ; ls -l foo.txt
> 0000000 H e l l o \n
> 0000006
> -rw-r--r-- 1 STEVE group 6 Nov 12 2004 foo.txt

You must execute this on a text mount.

The easiest way to achieve this is to ensure that you are on a
drive that is not mounted.

For example, on my machine, if I have the following mounts:

c:\cygwin\bin /bin
c:\cygwin\usr /usr
c:\ /

To reproduce the problem, I go to drive d: (not listed in the mounts).

% cd /cygdrive/d
% ...

Earl
#   Sat Mar 13 12:33:51 2010 davem - Type OS-interaction added  
#   Sat Mar 13 12:33:52 2010 davem - Type PerlIO added  
#   Sat Mar 13 12:33:52 2010 davem - Type portability added  


For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org