This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cygpath -pw output is corrupt for long path names


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.

Attachment: cygcheck.txt
Description: Text document

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]