delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/10/06/07:07:10

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:in-reply-to:references:date
:message-id:subject:from:to:content-type; q=dns; s=default; b=OQ
wyW8ZOV2gbDHQUbMuHnwynulsL8YXxzfzP2zNhejk+1Aov7f2JI9EpgLzutwFFO3
upauontzqeS50Zto4gqQj2gxNVI+x0z1qTUmr2iEdx3fHwh6tuj/l/QQv6kGbekb
DGjF8acre0APUIY9TNLTXe47Alfdrx8mbSF6A1nec=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:in-reply-to:references:date
:message-id:subject:from:to:content-type; s=default; bh=5CK2SnMN
7kFfPloriZDzQAZ7JQc=; b=Buu1knP7Q1NLPeq8ZKTP5ZC8CsoWbF8b5lWUIvFY
nfV/rp7lybKz6nIEnRRyIZOY3Qj9xOoBOYvvogxTpB//EB96ZHaQqxLY8JWpojR/
xHCa94+e7JtKu1zJXxLBRRk39e0SDu7Fg+cTIjrjO9HGYEBN6zdAL+jILhaWN/DO
5fg=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=AWL,BAYES_40,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mail-qa0-f42.google.com
MIME-Version: 1.0
X-Received: by 10.229.213.1 with SMTP id gu1mr29598718qcb.13.1381057612890; Sun, 06 Oct 2013 04:06:52 -0700 (PDT)
In-Reply-To: <5251240C.6060805@easynet.fr>
References: <524FB2BB DOT 40608 AT orange DOT fr> <CAM9pMnMcQcp4prHqs5Bh1sCt0HGC1zaTcmHEXFPrj_+3ZffjmA AT mail DOT gmail DOT com> <52512348 DOT 1050702 AT orange DOT fr> <5251240C DOT 6060805 AT easynet DOT fr>
Date: Sun, 6 Oct 2013 13:06:52 +0200
Message-ID: <CAM9pMnO9NX0-hpSRy7i-2HyYAXnQC3wXsHeJC_ZBx3cD-vyQaw@mail.gmail.com>
Subject: Re: 1.7.25: problem with the cd command in ksh
From: Robert Klemme <shortcutter AT googlemail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes

On Sun, Oct 6, 2013 at 10:49 AM, Francis ANDRE <francis DOT andre AT easynet DOT fr> wrote:
> Hi Robert
>
> The problem here is that the string of the target directory is computed by
> another tool -- Mercurial in this case -- and that Mercurial returns a
> absolute windows style path as
>
> Z:/DEV/OpenJDK_7u40/hotspot
>
> which seems to be relative in Unix world but which is absolute in the
> Windows world.
>
>
> Moreover, when using the bash shell, the command
>
> FrancisANDRE AT idefix /cygdrive/c/Cygwin
> $ cd Z:/DEV/OpenJDK_7u40/hotspot
>
> moves the cwd without error to
> FrancisANDRE AT idefix /cygdrive/z/DEV/OpenJDK_7u40/hotspot
>
>
> So why the ksh cannot do the same?

That question ksh developers or cygwin package maintainers should be
able to answer.  They might just use different syscalls which vary in
behavior on Cygwin.  You could try to find that out with strace.

Fact remains: using the Windows JDK on Cygwin is always nasty since
it's a Windows program and communication between scripts which use
Unix style paths and programs using Windows style paths soon gets
messy - especially if paths need to go both ways.

For your ksh script the easiest fix would probably be

cd $(cygpath -u "$dir")

If it needs to be cross platform you probably need to spend a bit more
effort e.g. define a shell function dependent on the platform where
the Unix versions just return the argument and the Cygwin version does
the mentioned conversion.

Kind regards

robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

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