Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perl binmode problem on cygwin text mount #7581

Open
p5pRT opened this issue Nov 5, 2004 · 5 comments
Open

Perl binmode problem on cygwin text mount #7581

p5pRT opened this issue Nov 5, 2004 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Nov 5, 2004

Migrated from rt.perl.org#32342 (status was 'open')

Searchable as RT32342$

@p5pRT
Copy link
Author

p5pRT commented Nov 5, 2004

From earl_chew@agilent.com

Created by earl_chew@agilent.com

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

Perl Info

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)


@p5pRT
Copy link
Author

p5pRT commented Nov 12, 2004

From @smpeters

[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

@p5pRT
Copy link
Author

p5pRT commented Nov 12, 2004

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Nov 13, 2004

From gp@familiehaase.de

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
--
=^..^=

@p5pRT
Copy link
Author

p5pRT commented Nov 16, 2004

From earl_chew@agilent.com

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants