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

Re: 1.7.25: problem with the cd command in ksh


On Sun, Oct 6, 2013 at 10:49 AM, Francis ANDRE <francis.andre@easynet.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@idefix /cygdrive/c/Cygwin
> $ cd Z:/DEV/OpenJDK_7u40/hotspot
>
> moves the cwd without error to
> FrancisANDRE@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


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