cygpath -pw output is corrupt for long path names

Daniel Steinmann daniel.steinmann@insonic.com
Tue Oct 29 13:57:00 GMT 2002


When I use cygpath -pw for a unix path with a lot of directory
components for each entry in the path, I get corrupted output.

Here is an example usage (see also attached cygcheck -s output):

$ pwd
/tmp/this/is/a/very/long/directory/path/enterprise/modules/base

$ cygpath -pw
:/c/programs/jdk1.3.1_04/jre/lib/rt.jar:../../lib/fso.jar:../../lib/vcom.jar:../../lib/vcomsc.jar:../../lib/log4j-1.2.5.jar
;c:\programs\jdk1.3.1_04\jre\lib\rt.jar;C:\programs\cygwin\tmp\this\is\a\very\long\directory\path\enterprise\lib\fso.jar;C:\programs\cygwin\tmp\this\is\a\very\long\directory\path\enterprise\lib\vcom.jar;C:\programs\cygwin\tmp\this\is\a\very\long\directory\path\enterprise\lib\vcomsc.jar;C:\programs\cygwin\tmp\this\is\a\very\long\directory\path\enterprise ?  log4j-1.2.5.jar

(Note the spaces and the question mark before log4j-1.2.5.jar)

After running this in gdb with the latest sources from CVS I can
explain this behaviour like this: In cygpath.cc the function
conv_path_list_buf_size() from path.cc gets indirectly invoked. This
function uses the member native_pathlen from the mount table to
compute the size of memory needed for this path. My mount table
looks like this:

$19 = {version = 12767, cb = 16488, sys_mount_table_counter = 0, nmounts = 6,
  mount = {{native_path = "\\\\eagle\\data", '\000' <repeats 247 times>,
      native_pathlen = 12, posix_path = "/data", '\000' <repeats 254 times>,
      posix_pathlen = 5, flags = 2}, {
      native_path = "\\\\eagle\\voice", '\000' <repeats 246 times>,
      native_pathlen = 13, posix_path = "/voice", '\000' <repeats 253 times>,
      posix_pathlen = 6, flags = 2}, 
<snip>

It seems that nativ_pathlen does not count the escape backslashes
(e.g. '\\\\eagle\\voice' has 16 characters with 3 escape
backslashes, but nativ_pathlen is 13). This is not a problem as long
as the path is short because conv_path_list_buf_size() adds always
100 to the computed size of memory. But in my test case this is not
enough.

Am I missing something or is my analysis so far correct?

Daniel.
-------------- next part --------------

Cygwin Win95/NT Configuration Diagnostics
Current System Time: Tue Oct 29 19:34:37 2002

Windows 2000 Professional Ver 5.0 Build 2195 Service Pack 3

Path:	d:\home-stonie\bin
	C:\programs\cygwin\usr\local\bin
	C:\programs\cygwin\bin
	C:\programs\cygwin\bin
	c:\WINNT\system32
	c:\WINNT
	c:\WINNT\System32\Wbem
	c:\Program Files\Support Tools\
	c:\Program Files\Resource Kit\
	C:\programs\cygwin\bin
	c:\programs\tools
	c:\programs\oracle\ora81\bin
	c:\programs\nuance\v7.0.4\bin\win32
	c:\programs\nuance\v7.0.4\scripts
	C:\programs\cygwin\usr\X11R6\bin
	d:\home-stonie\tools\sysinternals\pstools
	c:\programs\j2sdk1.4.0_02\bin

SysDir: C:\WINNT\System32
WinDir: C:\WINNT

CYGWIN = `binmode ntsec nosmbntsec notty'
HOME = `d:\home-stonie'
MAKE_MODE = `unix'
PWD = `/d/home-stonie'
USER = `stonie'

Use `-r' to scan registry

a:  fd           N/A    N/A                    
c:  hd  NTFS    8001Mb  66% CP CS UN PA FC     System
d:  hd  NTFS   11068Mb  18% CP CS UN PA FC     Data
e:  cd           N/A    N/A                    

\\eagle\data            /data         user    binmode
\\eagle\voice           /voice        user    binmode
                       /             user    binmode,cygdrive
C:/programs/cygwin      /             system  binmode
d:\home-stonie          /home/stonie  system  binmode
C:/programs/cygwin/bin  /usr/bin      system  binmode
C:/programs/cygwin/lib  /usr/lib      system  binmode
                       /             user    binmode,cygdrive

Found: C:\programs\cygwin\bin\bash.exe
Found: C:\programs\cygwin\bin\cat.exe
Found: C:\programs\cygwin\bin\cpp.exe
Found: C:\programs\cygwin\bin\find.exe
Found: C:\programs\cygwin\bin\gcc.exe
Found: C:\programs\cygwin\bin\gdb.exe
Found: C:\programs\cygwin\bin\ld.exe
Found: C:\programs\cygwin\bin\ls.exe
Found: C:\programs\cygwin\bin\make.exe
Found: C:\programs\cygwin\bin\sh.exe

   58k 2002/05/07 C:\programs\cygwin\bin\cygbz2-1.dll
    6k 2002/06/24 C:\programs\cygwin\bin\cygcharset-1.dll
  625k 2002/08/09 C:\programs\cygwin\bin\cygcrypto.dll
   45k 2001/04/25 C:\programs\cygwin\bin\cygform5.dll
   35k 2002/01/09 C:\programs\cygwin\bin\cygform6.dll
   19k 2002/02/20 C:\programs\cygwin\bin\cyggdbm.dll
   17k 2001/06/28 C:\programs\cygwin\bin\cyghistory4.dll
   20k 2002/10/10 C:\programs\cygwin\bin\cyghistory5.dll
  929k 2002/06/24 C:\programs\cygwin\bin\cygiconv-2.dll
   22k 2001/12/13 C:\programs\cygwin\bin\cygintl-1.dll
   28k 2002/09/20 C:\programs\cygwin\bin\cygintl-2.dll
   21k 2001/06/20 C:\programs\cygwin\bin\cygintl.dll
   45k 2002/02/08 C:\programs\cygwin\bin\cygjbig1.dll
  119k 2002/02/09 C:\programs\cygwin\bin\cygjpeg6b.dll
   59k 2002/09/20 C:\programs\cygwin\bin\cygkpathsea-3-3-7.dll
   26k 2001/04/25 C:\programs\cygwin\bin\cygmenu5.dll
   20k 2002/01/09 C:\programs\cygwin\bin\cygmenu6.dll
  156k 2001/04/25 C:\programs\cygwin\bin\cygncurses++5.dll
  175k 2002/01/09 C:\programs\cygwin\bin\cygncurses++6.dll
  226k 2001/04/25 C:\programs\cygwin\bin\cygncurses5.dll
  202k 2002/01/09 C:\programs\cygwin\bin\cygncurses6.dll
   15k 2001/04/25 C:\programs\cygwin\bin\cygpanel5.dll
   12k 2002/01/09 C:\programs\cygwin\bin\cygpanel6.dll
   40k 2001/11/21 C:\programs\cygwin\bin\cygpcre.dll
   39k 2001/11/21 C:\programs\cygwin\bin\cygpcreposix.dll
  175k 2002/07/22 C:\programs\cygwin\bin\cygpng10.dll
  179k 2002/07/22 C:\programs\cygwin\bin\cygpng12.dll
  170k 2002/01/21 C:\programs\cygwin\bin\cygpng2.dll
   22k 2002/06/09 C:\programs\cygwin\bin\cygpopt-0.dll
  108k 2001/06/28 C:\programs\cygwin\bin\cygreadline4.dll
  127k 2002/10/10 C:\programs\cygwin\bin\cygreadline5.dll
   66k 2001/11/20 C:\programs\cygwin\bin\cygregex.dll
  159k 2002/08/09 C:\programs\cygwin\bin\cygssl.dll
  549k 2002/07/19 C:\programs\cygwin\bin\cygtcl83.dll
   11k 2002/07/19 C:\programs\cygwin\bin\cygtclpip83.dll
  253k 2002/02/10 C:\programs\cygwin\bin\cygtiff3.dll
  221k 2002/07/19 C:\programs\cygwin\bin\cygtix4183.dll
  830k 2002/07/19 C:\programs\cygwin\bin\cygtk83.dll
  904k 2002/10/14 C:\programs\cygwin\bin\cygwin1-orig.dll
   41k 2002/01/20 C:\programs\cygwin\bin\cygXpm-noX4.dll
   46k 2002/01/20 C:\programs\cygwin\bin\cygXpm-X4.dll
   50k 2002/03/12 C:\programs\cygwin\bin\cygz.dll
  905k 2002/10/23 C:\programs\cygwin\bin\cygwin1.dll
    Cygwin DLL version info:
        DLL version: 1.3.14
        DLL epoch: 19
        DLL bad signal mask: 19005
        DLL old termios: 5
        DLL malloc env: 28
        API major: 0
        API minor: 62
        Shared data: 3
        DLL identifier: cygwin1
        Mount registry: 2
        Cygnus registry name: Cygnus Solutions
        Cygwin registry name: Cygwin
        Program options name: Program Options
        Cygwin mount registry name: mounts v2
        Cygdrive flags: cygdrive flags
        Cygdrive prefix: cygdrive prefix
        Cygdrive default prefix: 
        Build date: Wed Oct 23 14:47:14 EDT 2002
        Shared id: cygwin1S3


Cygwin Package Information
Package             Version             
_update-info-dir    00077-1             
ash                 20020731-1          
autoconf            2.53b-1             
autoconf-devel      2.53a-1             
autoconf-stable     2.13-4              
automake            1.6.2-1             
automake-devel      1.6.2-1             
automake-stable     1.4p5-5             
base-files          1.0-1               
base-passwd         1.0-1               
bash                2.05b-5             
bc                  1.06-1              
binutils            20020706-2          
bison               1.35-1              
bzip2               1.0.2-2             
ccache              1.9-1               
clear               1.0-1               
cpio                2.4.2               
cron                3.0.1-7             
crypt               1.0-1               
ctags               5.2-1               
cvs                 1.11.0-1            
cygrunsrv           0.95-1              
cygutils            1.1.2-1             
cygwin              1.3.14-1            
cygwin-doc          1.2-1               
dejagnu             20010117-1          
diff                1.0-1               
diffutils           2.8.1-1             
ed                  0.2-1               
enscript            1.6.3-3             
exim                4.10-2              
expect              20010117-1          
fetchmail           6.1.0-1             
figlet              2.2-1               
file                3.37-1              
fileutils           4.1-1               
findutils           4.1.7-4             
flex                2.5.4-2             
fortune             1.8-2               
gawk                3.1.1-5             
gcc                 3.2-1               
gdb                 20020718-1          
gdbm                1.8.0-4             
gettext             0.11.5-1            
ghostscript         7.05-1              
ghostscript-base    7.05-1              
gnugo               3.2-1               
gperf               0.0                 
grep                2.5-1               
groff               1.17.2-1            
gzip                1.3.3-4             
indent              2.2.8-1             
inetutils           1.3.2-19            
irc                 20010101-1          
jbigkit             1.2-6               
jpeg                6b-7                
keychain            1.9-1               
less                374-1               
libbz2_1            1.0.2-2             
libcharset1         1.8-2               
libiconv            1.8-2               
libiconv2           1.8-2               
libintl             0.10.38-3           
libintl1            0.10.40-1           
libintl2            0.11.5-1            
libkpathsea3        20020911-1          
libncurses5         5.2-1               
libncurses6         5.2-8               
libpng              1.2.4-2             
libpng10            1.0.14-2            
libpng12            1.2.4-2             
libpng2             1.0.12-1            
libpopt0            1.6.4-4             
libreadline4        4.1-2               
libreadline5        4.3-2               
links               0.96-1              
login               1.4-4               
lynx                2.8.4-1             
m4                  0.0                 
make                3.79.1-7            
man                 1.5g-2              
mingw               20010917-1          
mingw-runtime       2.2-1               
mktemp              1.4-1               
more                2.11o-1             
mt                  2.0.1-1             
mutt                1.4-1               
nano                1.1.10-1            
ncftp               3.1.4-1             
ncurses             5.2-8               
newlib-man          20020801            
opengl              1.1.0-6             
openssh             3.4p1-5             
openssl             0.9.6g-1            
patch               2.5-3               
pcre                3.7-1               
perl                5.6.1-2             
pkgconfig           0.12.0-1            
popt                1.6.4-4             
postgresql          7.2.3-1             
procmail            3.22-7              
procps              010801-1            
python              2.2.1-1             
rcs                 5.7-3               
readline            4.3-2               
regex               4.4-2               
robots              2.0-1               
rsync               2.5.5-1             
rxvt                2.7.2-14            
sed                 3.02-1              
sh-utils            2.0-2               
sharutils           4.2.1-2             
shutdown            1.2-2               
ssmtp               2.38.7-3            
tar                 1.13.25-1           
tcltk               20001125-1          
tcsh                6.11.00-4           
termcap             20020930-1          
terminfo            5.2-3               
tetex               20020911-1          
tetex-base          20020911-1          
tetex-bin           20020911-1          
tetex-doc           20020911-1          
tetex-extra         20020911-1          
tetex-tiny          20020911-1          
texinfo             4.2-4               
textutils           2.0.21-1            
tidy                020822-1            
tiff                3.5.7-1             
time                1.7-1               
ttcp                19980512-1          
units               1.77-1              
unzip               5.50-1              
vim                 6.1-2               
w32api              2.0-1               
wget                1.8.2-1             
which               1.5-1               
whois               4.5.17-1            
xpm-nox             4.2.0-1             
zip                 2.3-2               
zlib                1.1.4-1             

Use -h to see help about each section

-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list