delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/02/05/11:41:00

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Wed, 5 Feb 2003 17:40:21 +0100
From: Daniel Steinmann <daniel DOT steinmann AT insonic DOT com>
To: cygwin AT cygwin DOT com
Subject: Bug in path.cc (conv_path_list_buf_size)
Message-ID: <20030205164021.GA1408@stonie.insonic.com>
Mail-Followup-To: cygwin AT cygwin DOT com
Mime-Version: 1.0
User-Agent: Mutt/1.4i
X-Virus-Scanned: scanned with AMaViS for viruses by Interdesk GmbH
Note-from-DJ: This may be spam

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

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?

Daniel

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019