delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/10/07/04:49:38

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Thu, 7 Oct 2010 10:49:10 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: (cd $P && pwd) fails for path >255 chars
Message-ID: <20101007084910.GA14054@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20101007095030 DOT GA3479 AT localhost DOT localdomain>
MIME-Version: 1.0
In-Reply-To: <20101007095030.GA3479@localhost.localdomain>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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

On Oct  7 11:50, Ladislav Michl wrote:
> Hi,
> 
> while building Cygwin hosted toolchain build was mysteriously failing with
> 'No such file or directory'. Here's a test case:
> 
> P=/tmp
> for i in 1 2 3 4 5 6 7 8
> do
>   P=$P/this_is_somewhat_very_long_path
> done
> mkdir -p $P
> (cd $P && pwd)
> 
> pwd outputs just '.', but once editing loop to end at 7th iteration (thus
> making path shorter than 255 characters) it prints path correctly.
> 
> The problem is that 'cd' cannot change directory to path longer that 255
> characters and fails silently with exit status 0. Is it known/expected
> behaviour?

It is not known behaviour and it's rather weird.  If you try to cd into
this directory on the command line it works fine.  And pwd works fine
as well.  Just as part of the shell script it fails.

That looks like a bash bug.  If you convert the script to tcsh syntax,
you'll see that it works fine in tcsh:

  set P = /home/corinna/tmp
  foreach i ( 1 2 3 4 5 6 7 8 )
    set P = $P/this_is_somewhat_very_long_path
  end
  mkdir -p $P
  (cd $P && pwd)

I also tried with path lengths of more than 6000 chars.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

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

- Raw text -


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