Hello,

I have a problem using the Perl-integrated Cygwin path conversion methods. 
Below is my Perl bug report (#132443) created via perlbug for details. They 
suggested to file a bug against the XML::DOM module. But since it is a 
Cygwin-specific problem, I thought it is better to ask on the mailing list 
first.

Thanks,
Lando

This is a bug report for perl from l...@h0x.de,
generated with the help of perlbug 1.40 running under perl 5.26.1.

The Perl-integrated conversion function for Cygwin paths 
Cygwin::win_to_posix_path() is broken.
Tested with a path read from a XML file using XML::DOM, its output is faulty.
Depending on the setting, its output is empty, garbage or aborts with 'Out of 
memory'.
Most likely, there are some memory allocation issues.

To reproduce, please call script 'test.pl' with attached XML file 'test.xml' as 
argument.
Depending on used path to file (relative or absolute, Windows or POSIX style 
etc.), different types of failure appear.

+++ test.pl +++
#!/usr/bin/env perl

use XML::DOM;

print 'XML FILE (argument):>' . $ARGV[0] . "<\n";
my $xml_path = Cygwin::win_to_posix_path($ARGV[0]);
print 'XML FILE (converted):>' . $xml_path . "<\n";

my $parser = new XML::DOM::Parser();
my $dom_tree = $parser->parsefile($xml_path);
my $attr_path = $dom_tree->getDocumentElement()->getAttribute('attr');
print 'PATH FROM ATTRIBUTE:>' . $attr_path . "<\n";

my $win_attr_path = Cygwin::win_to_posix_path($attr_path);
print 'PATH FROM ATTRIBUTE (converted):>' . $win_attr_path . "<\n";

+++ test.xml +++
<?xml version="1.0" ?>
<Test attr="C:\Cygwin\usr\bin\ls.exe"></Test>

Please note that in my tests, only the path read from the XML is affected. 
Direct output of this
file before (broken) conversion shows no abnormality though. Therefore I am not 
sure if this bug
originates in Perl core or XML::DOM module.---
Flags:
category=core
severity=low
---
Site configuration information for perl 5.26.1:

Configured by ASSI at Tue Sep 26 18:57:14 CEST 2017.

Summary of my perl5 (revision 5 version 26 subversion 1) configuration:

Platform:
osname=cygwin
osvers=2.9.0(0.31853)
archname=i686-cygwin-threads-64int-multi
uname='cygwin_nt-6.3-wow cygwin 2.9.0(0.31853) 2017-09-12 10:41 i686 cygwin '
config_args='-des -Dprefix=/usr -Dmksymlinks 
-Darchname=i686-cygwin-threads-64int
-Dlibperl=cygperl5_26.dll -Dcc=gcc -Dld=g++ -Accflags=-ggdb -O2 -pipe
-Wimplicit-function-declaration
-fdebug-prefix-map=/mnt/share/maint/perl.x86/build=/usr/src/debug/perl-5.26.1-1
-fdebug-prefix-map=/mnt/share/maint/perl.x86/src/perl-5.26.1=/usr/src/debug/perl-5.26.1-1
 -fwrapv'
hint=recommended
useposix=true
d_sigaction=define
useithreads=define
usemultiplicity=define
use64bitint=define
use64bitall=undef
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
bincompat5005=undef
Compiler:
cc='gcc'
ccflags ='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -D_GNU_SOURCE -ggdb -O2 -pipe
-Wimplicit-function-declaration
-fdebug-prefix-map=/mnt/share/maint/perl.x86/build=/usr/src/debug/perl-5.26.1-1
-fdebug-prefix-map=/mnt/share/maint/perl.x86/src/perl-5.26.1=/usr/src/debug/perl-5.26.1-1
 -fwrapv
-fno-strict-aliasing -fstack-protector-strong -D_FORTIFY_SOURCE=2'
optimize='-O3'
cppflags='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -D_GNU_SOURCE -ggdb -O2 -pipe
-Wimplicit-function-declaration
-fdebug-prefix-map=/mnt/share/maint/perl.x86/build=/usr/src/debug/perl-5.26.1-1
-fdebug-prefix-map=/mnt/share/maint/perl.x86/src/perl-5.26.1=/usr/src/debug/perl-5.26.1-1
 -fwrapv
-fno-strict-aliasing -fstack-protector-strong'
ccversion=''
gccversion='6.4.0'
gccosandvers=''
intsize=4
longsize=4
ptrsize=4
doublesize=8
byteorder=12345678
doublekind=3
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=12
longdblkind=3
ivtype='long long'
ivsize=8
nvtype='double'
nvsize=8
Off_t='off_t'
lseeksize=8
alignbytes=8
prototype=define
Linker and Libraries:
ld='g++'
ldflags =' -Wl,--enable-auto-import -Wl,--export-all-symbols 
-Wl,--enable-auto-image-base
-fstack-protector-strong'
libpth=/usr/lib
libs=-lpthread -lgdbm -ldb -ldl -lcrypt -lgdbm_compat
perllibs=-lpthread -ldl -lcrypt
libc=/usr/lib/libcygwin.a
so=dll
useshrplib=true
libperl=cygperl5_26.dll
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs
dlext=dll
d_dlsymun=undef
ccdlflags=' '
cccdlflags=' '
lddlflags=' --shared -Wl,--enable-auto-import -Wl,--export-all-symbols 
-Wl,--enable-auto-image-base
-fstack-protector-strong'

Locally applied patches:
Cygwin: README
Cygwin: use auto-image-base instead of fixed DLL base address
Cygwin: modify hints
Cygwin: Configure correct libsearch
Cygwin: Configure correct libpth
Cygwin: Win32 correct UTF8 handling
Perl: File-Path-2.14 (fixes CVE2017-6512)

---
@INC for perl 5.26.1:
/usr/local/lib/perl5/site_perl/5.26/i686-cygwin-threads-64int
/usr/local/share/perl5/site_perl/5.26
/usr/lib/perl5/vendor_perl/5.26/i686-cygwin-threads-64int
/usr/share/perl5/vendor_perl/5.26
/usr/lib/perl5/5.26/i686-cygwin-threads-64int
/usr/share/perl5/5.26

---
Environment for perl 5.26.1:
HOME=/home/ln
LANG=en_US.UTF-8
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/usr/local/bin:/usr/bin:/cygdrive/c/ProgramData/Oracle/Java/javapath:/cygdrive/c/Windows/system
2:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShe
l/v1.0:/cygdrive/c/Program Files/Git/cmd:/cygdrive/c/Program 
Files/TortoiseGit/bin
PERL_BADLANG (unset)
SHELL=/bin/bash

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

Reply via email to