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]

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


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

and I also have the following jar file:

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

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

  /cygdrive/c $ jar tf jakarta-jmeter-2.2/bin/*jar
  META-INF/
  META-INF/MANIFEST.MF
  org/
  org/apache/
  org/apache/jmeter/
  org/apache/jmeter/DynamicClassLoader.class
  org/apache/jmeter/NewDriver$1.class
  org/apache/jmeter/NewDriver.class
  META-INF/LICENSE
  META-INF/NOTICE

But I can NOT list its contents using absolute path:

  $ jar tf $PWD/jakarta-jmeter-2.2/bin/*jar
  java.io.FileNotFoundException:
\cygdrive\c\jakarta-jmeter-2.2\bin\ApacheJMeter.jar 
  (Das System kann den angegebenen Pfad nicht finden)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:106)
        at java.io.FileInputStream.<init>(FileInputStream.java:66)
        at sun.tools.jar.Main.run(Main.java:205)
        at sun.tools.jar.Main.main(Main.java:1022)

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: cygwin-owner@cygwin.com 
> Sent: Monday, May 07, 2007 3:29 PM
> To: cygwin@cygwin.com
> 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
using
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
implicitly,
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
  irb(main):001:0> 

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
(/cygdrive/...), 
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
-- 
Ronald Fischer <ronald.fischer@venyon.com>
Phone: +49-89-452133-162
 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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