This is the mail archive of the 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]

Bug in (conv_path_list_buf_size)

The above mentioned function returns sometimes a too small buffer
size. This problem was found when using 'cygpath --path --windows'

Here is a test scenario to reproduce the problem (on my machine):

  $ mount
  C:\programs\cygwin\bin on /usr/bin type system (binmode)
  C:\programs\cygwin\lib on /usr/lib type system (binmode)
  C:\programs\cygwin on / type system (binmode)
  d:\home-stonie on /home/stonie type system (binmode)
  \\eagle\voice on /voice type user (binmode)
  \\eagle\data on /data type user (binmode)
  c: on /c type user (binmode,noumount)
  d: on /d type user (binmode,noumount)

  $ mkdir /tmp/this/is/a/very/long/directory/path/to/some/of/my/software
  $ cd    /tmp/this/is/a/very/long/directory/path/to/some/of/my/software
  $ 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 of the cygpath output just
before log4j-1.2.5.jar)

The algorithm in conv_path_list_buf_size() looks only at the size of
the mount table and the length of the relativ posix path, but
ignores the absolute path length of each path element. In the above
example the computed size is 355, but the converted path needs 365

The algorithm works fine as long the mount table contains a lot of
entries with at least one reasonable long entry and/or the working
directory is short.

I see following solutions:

a) Increase the slop.

b) Make the size estimation more precise by adding the size of
   the current working directory for each relativ path element.

What do you think?


Unsubscribe info:
Bug reporting:

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