File.getAbsolutePath() bugfix

2000-01-13 Thread Mike Linksvayer


File.getAbsolutePath() was not stripping out extra "." path
components, which is contrary to the behavior of the JDK, and
breaks user code that relies on the JDK behavior.  getCanonicalPath()
was also broken was a result.

The following code produces a simple case:

System.err.println(new File(".").getAbsolutePath());

If current directory is /foo, output under the JDK is "/foo", output
under Kaffe is "/foo/.".

I've included a simple patch below, and I'll look into a regression
test soon.


Index: java/io/File.java
===
RCS file: /cvs/kaffe/kaffe/libraries/javalib/java/io/File.java,v
retrieving revision 1.21
diff -u -r1.21 File.java
--- java/io/File.java   1999/10/12 19:05:45 1.21
+++ java/io/File.java   2000/01/13 18:05:35
@@ -156,7 +156,15 @@
return getPath();
}
else {
-   return System.getProperty("user.dir") + separatorChar + getPath(
);
+   String path = getPath();
+   String userDir = System.getProperty("user.dir");
+   if (path.equals(".")) {
+   return userDir;
+   }
+   if (path.startsWith("./")) {
+   path = path.substring(2);
+   }
+   return userDir + separatorChar + path;
}
 }
 

-- 
  See From: and Organization: above.



Re: File.getAbsolutePath() bugfix

2000-01-13 Thread Mike Linksvayer


 Thanks, fixed!

Argh, please unfix.  I'm an idiot ... the behavior of getAbsolutePath()
is correct, only getCanonicalPath() is incorrect.  I'll post a real
fix tonight, after I've tested more thoroughly.

I must learn not to:
* think code is finished before writing unit tests
* think code is fixed if it fixes my particular problem
* watch over a locksmith fixing my front door while debugging (really)

Sorry about that.

-- 
  See From: and Organization: above.



java/lang/Object

2000-01-13 Thread Derek L Davies



This is probably something really stupid but I'm flapping trying to
figure it out.  I've writen a unit test for the addition of GetEnv to
the invokation interface.  When I run it I get:

0.:/home/ddavies/src/kaffe-1.0.5/test/regression/native./run.sh
Couldn't find or load essential class `java/lang/Object' 
java.lang.NoClassDefFoundError java/lang/Object
Aborted (core dumped)
0.:/home/ddavies/src/kaffe-1.0.5/test/regression/native

I've tried various manipulations of CLASSPATH.  Any ideas on what I'm
missing would be of great help.  Here's the code:

+++ run.sh (bastardized `kaffe`):
#! /bin/sh

#
# Driver script for Kaffe.
# This script invokes the "Kaffe" executable after modifying
# CLASSPATH and LD_LIBRARY_PATH as needed.
#
# We prepend kaffe's lib directory to LD_LIBRARY_PATH.
#
# KAFFELIBRARYPATH is defined to kaffe's native lib directory
# (lib/kaffe) if not set.
#
# The effective CLASSPATH is made up of four parts, which 
# are composed in the following order:
#
#   1. a user-specified CLASSPATH or .
#   2. Klasses.jar in $datadir/kaffe
#   3. Kaffe extensions jar files in $datadir/kaffe
#   4. kjc.jar in $datadir/kaffe
#   5. classes.zip in $datadir/kaffe iff it exists.
#
# Note that as the last thing we slurp in the files $datadir/kafferc
# and $HOME/.kafferc (in that order) if they exist. This allows site
# and user specific JAR files to be automatically added to CLASSPATH.
#

# If KAFFE_DEBUG is set to either gdb or emacs, a debugging session
# will be started.  gdb will be started so that the current working
# directory and the argument list are correct.

prefix="/home/ddavies"
exec_prefix="${prefix}"
PATHSEP=':'
DIRSEP='/'
: ${KAFFE_LIBDIR="${exec_prefix}/lib"}
: ${KAFFE_LIBEXECDIR="${exec_prefix}/libexec"}
: ${KAFFE_CLASSDIR="${prefix}/share/kaffe"}
: ${KAFFE_NATIVE_LIBRARY_DIR="${exec_prefix}/lib/kaffe"}
: ${KAFFE_OLD_NATIVE_LIBRARY_DIR="$KAFFE_CLASSDIR/lib/i386-linux"}

if test x"${KAFFEHOME+set}"x != x"set"x; then
  KAFFEHOME="/home/ddavies"
fi
export KAFFEHOME

CLASSPATH="${CLASSPATH-.}"
for f in Klasses.jar comm.jar pjava.jar servlet.jar tools.jar microsoft.jar kjc.jar 
rmi.jar; do
  if test -f "$KAFFE_CLASSDIR/$f"; then
CLASSPATH="$CLASSPATH$PATHSEP$KAFFE_CLASSDIR/$f"
  fi
done
if test -f "$KAFFE_CLASSDIR/classes.zip"; then
  CLASSPATH="$CLASSPATH$PATHSEP$KAFFE_CLASSDIR/classes.zip"
fi
case "$DIRSEP" in /) ;;
*) CLASSPATH=`echo "$CLASSPATH" | sed 's,/,'"$DIRSEP"',g'` ;;
esac
export CLASSPATH
KAFFELIBRARYPATH="$KAFFE_NATIVE_LIBRARY_DIR$PATHSEP$KAFFE_LIBDIR"${KAFFELIBRARYPATH+"$PATHSEP$KAFFELIBRARYPATH"}${LD_LIBRARY_PATH+"$PATHSEP${LD_LIBRARY_PATH}"}
if test -d "$KAFFE_OLD_NATIVE_LIBRARY_DIR"; then
  KAFFELIBRARYPATH="$KAFFELIBRARYPATH$PATHSEP$KAFFE_OLD_NATIVE_LIBRARY_DIR"
fi
export KAFFELIBRARYPATH
LD_LIBRARY_PATH="$KAFFE_LIBDIR"${LD_LIBRARY_PATH+"$PATHSEP$LD_LIBRARY_PATH"}
export LD_LIBRARY_PATH
PATH="$PATH:$KAFFE_LIBDIR" # MS-Windows DLLs must be in the PATH
export PATH

# Slurp in system and user specific scripts
if [ -f "${prefix}/share/kaffe/kafferc" ]; then
. ${prefix}/share/kaffe/kafferc
fi
if [ -f "${HOME}/.kafferc" ]; then
. "${HOME}/.kafferc"
fi

if test x"${KAFFE_DEBUG+set}"x != x"set"x; then
exec ./testGetEnv
else
case `"$KAFFE_DEBUG" --version /dev/null 2/dev/null` in
*"GDB"* | *"GNU gdb"*)
# start command-line gdb within the correct working directory,
# and set up the specified argument list
{
echo "shell rm -f /tmp/.gdbinit.$$"
echo "cd `pwd`"
echo "set args $*"
} /tmp/.gdbinit.$$
exec "$KAFFE_DEBUG" -command /tmp/.gdbinit.$$ $KAFFE_LIBEXECDIR/Kaffe
rm -f /tmp/.gdbinit.$$;;
DDD*)
# Tell DDD to start gdb within the correct working directory,
# and set up the specified argument list
{
echo "shell rm -f /tmp/.gdbinit.$$"
echo "cd `pwd`"
echo "set args $*"
} /tmp/.gdbinit.$$
exec "$KAFFE_DEBUG" --debugger "${GDB-gdb} -command /tmp/.gdbinit.$$" \
  $KAFFE_LIBEXECDIR/Kaffe
rm -f /tmp/.gdbinit.$$;;
"GNU Emacs"*)
# start gdb within GNU Emacs, move into the current working
# directory and set up the specified argument list
exec "$KAFFE_DEBUG" -eval "(progn (gdb \"gdb $KAFFE_LIBEXECDIR/Kaffe\") 
(gud-call \"cd `pwd`\") (gud-call \"set args $*\"))";;
XEmacs*)
# start gdb within XEmacs, move into the current working
# directory and set up the specified argument list
exec "$KAFFE_DEBUG" -eval "(progn (gdb \"$KAFFE_LIBEXECDIR/Kaffe\") (gdb-call 
\"cd `pwd`\") (gdb-call \"set args $*\"))";;
*) echo you must set KAFFE_DEBUG to either emacs or gdb 2;;
esac
fi
exit 1
--- run.sh

+++ Makefile.am (stolen from kaffe/kaffe/Makefile.am)
# Makefile.in for kaffe - a Java(tm) compatible virtual machine wrapper.
#
# Copyright (c) 1996, 1997, 1998, 1999
#   Transvirtual Technologies, Inc.  All rights 

Re: File.getAbsolutePath() bugfix

2000-01-13 Thread Archie Cobbs


Mike Linksvayer writes:
  Thanks, fixed!
 
 Argh, please unfix.  I'm an idiot ... the behavior of getAbsolutePath()
 is correct, only getCanonicalPath() is incorrect.  I'll post a real
 fix tonight, after I've tested more thoroughly.

OK, unfixed! :-)

-Archie

___
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com



Re: Regression Test failures in current CVS

2000-01-13 Thread Alexandre Oliva


On Jan 14, 2000, Dalibor Topic [EMAIL PROTECTED] wrote:

 I assume that the problem lies in the upgrade from
 textutils 1.22 (used in RH 6.0) and textutils 2.0 (RH
 6.1), since all failing tests use "// Sort output",
 and in the case I inspected closely, Reflect.java, the
 only differences were in the order of a few lines in
 the sorted output. I'va attached the files
 Reflect.fail and Reflect.out to this mail.

 Did anyone else experience something similar?

Nope, but I've also got textutils 2.0.  What is your LANG environment
variable set to?

-- 
Alexandre Oliva http://www.ic.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{lsd.ic.unicamp.br,guarana.{org,com}} aoliva@{acm,computer}.org
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them