Access of files using absolute path (was: Error opening script file)

Ronald Fischer
Mon May 7 15:50:00 GMT 2007

Aside from the problem described in my original posting (see the quote
at the end of this
message), I found a related problem, which has nothing to do with the
execution of a script,
but which seems to suggest that I have a general problem in opening
files by specifying absolute
pathes. Here an example:

I did a cd to drive C:

  $ pwd

and I also have the following jar file:

  $ ls -l $PWD/jakarta-jmeter-2.2/bin/*jar
  -rwxrwxrwx+ 1 rfischer ???????? 9962 Jun 13  2006

I can list the content of the jar file using RELATIVE path:

  /cygdrive/c $ jar tf jakarta-jmeter-2.2/bin/*jar

But I can NOT list its contents using absolute path:

  $ jar tf $PWD/jakarta-jmeter-2.2/bin/*jar
  (Das System kann den angegebenen Pfad nicht finden)
        at Method)

Interestingly, I *can* open the file using, for example, od -x:

$ od -x $PWD/jakarta-jmeter-2.2/bin/*jar| head -n 2
0000000 4b50 0403 000a 0000 0000 a84a 34cd 0000
0000020 0000 0000 0000 0000 0000 0009 0004 454d

So on this level, it seems that od and jar use different means to "open"
a file.

Now to quote my original problem, posted earlier:

> -----Original Message-----
> From: 
> Sent: Monday, May 07, 2007 3:29 PM
> To:
> Subject: Error opening script file
> I have installed the script language JRuby, which comes with two
> executables: A binary jruby, and a 
> shell script jirb (for interactive purpose). I can call 
> jruby, but I get
> an error message when calling
> jirb:
> ~/ruby_test $ ls -l $JRUBY_HOME/bin/jirb
> -rwxr-xr-x 1 rfischer mkgroup-l-d 323 Apr 23 23:30
> /cygdrive/h/jruby-0.9.9/bin/jirb
> ~/ruby_test $ !$
> $JRUBY_HOME/bin/jirb
> Error opening script file: \cygdrive\h\jruby-0.9.9\bin\jirb 
> (Das System
> kann den angegebenen Pfad nicht finden)
> ~/ruby_test $ head -n 1 !$
> head -n 1 $JRUBY_HOME/bin/jirb
> #!/usr/bin/env jruby
> From this dialogue, you can see that jirb has the correct 
> x-permissions,
> but still the script
> file can't be opened. My guess is that bash can't load the correct
> interpreter file, so that's why
> I also have listed above the first line of the jirb script - but it
> seems that this is looking fine.

What is interesting here is that I *can* access jirb by absolute path
programs such as less or head:

  $ head -n 5 $JRUBY_HOME/bin/jirb
  #!/usr/bin/env jruby
  #   irb.rb - intaractive ruby
  #       $Release Version: 0.7.3 $
  #       $Revision$

but I can not execute it using the jruby interpreter - neither
as shown above, nor explicitly:

  $ jruby $JRUBY_HOME/bin/jirb
  Error opening script file: \cygdrive\h\jruby-0.9.9\bin\jirb (Das
System kann 
  den angegebenen Pfad nicht finden)

But this *is* possible using relative pathes:

  $ cd $JRUBY_HOME
  $ jruby bin/jirb

I experimented around with other applications. So far, I found that jar
and jruby 
have the problem that they can't open a file if it is listed absolutely
while for example ruby or zsh do not show this problem. So I first
thought that maybe
those applications have not been written with cygwin in mind - but then,
they would
have failed even with relative files - won't they?

What is going on here?

Ronald Fischer <>
Phone: +49-89-452133-162

Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list