Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 41481 - java-config -b chops of last character from existing classpath
Summary: java-config -b chops of last character from existing classpath
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Jason A. Mobarak (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-13 09:32 UTC by Rohit Singh
Modified: 2004-02-17 23:48 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rohit Singh 2004-02-13 09:32:51 UTC
If you use java-config to add entry to user classpath; then add another package to classpath.

java-config chops off last character before :(classpath seperator) from the classpath.

here is a sample how it looks

cat .gentoo/java-env-classpath
CLASSPATH=${CLASSPATH}:/usr/share/java-gnome/gnome-0.7.1.ja:/usr/share/java-gtk/gtk-0.7.1.jar

it should be

CLASSPATH=${CLASSPATH}:/usr/share/java-gnome/gnome-0.7.1.jar:/usr/share/java-gtk/gtk-0.7.1.jar
                                                        ******

Reproducible: Always
Steps to Reproduce:
1. run java-config -x clear current path if necessary
2. java-config -a java-gnome(or some other package)
3. java-config -b java-gtk (or some other package)


Actual Results:  
cat .gentoo/java-env-classpath
CLASSPATH=${CLASSPATH}:/usr/share/java-gnome/gnome-0.7.1.ja:/usr/share/java-gtk/gtk-0.7.1.jar


Expected Results:  
CLASSPATH=${CLASSPATH}:/usr/share/java-gnome/gnome-0.7.1.jar:/usr/share/java-gtk/gtk-0.7.1.jar

output of jc_options.py, I have added couple extra print statement to print
old_classpath before regexp

class AppendUserClasspath (jc_iface.OptInterface):

	usage = (
	  'Append to the user classpath', 

	  'Append the package names specified to the user ' 
	  'classpath, available packages can be found with '
	  'the --list-available-packages option.'
	)

	names = ('b:', 'add-user-classpath=')

	def __call__(self, args):

		jc_dir = os.path.join(env['HOME'], '.gentoo')
		old_classpath = '' 

		if not os.path.isdir(jc_dir):
			os.mkdir(jc_dir)

		elif os.path.isfile(os.path.join(jc_dir, 'java-env-classpath')):
			old_classpath = file(os.path.join(jc_dir, 'java-env-classpath'), 'r').read()
                        print old_classpath
			old_classpath = re.sub('CLASSPATH=\${CLASSPATH}:', '', old_classpath)[:-1]
                        print old_classpath

		file(os.path.join(jc_dir, 'java-env-classpath'), 'w').write(
		  'CLASSPATH=${CLASSPATH}:' + old_classpath + ':' + collect_packages(args)
		)

		if not os.path.isfile(os.path.join(jc_dir, 'java-env')): 
			file(os.path.join(jc_dir, 'java-env'), 'w').write(source_java_classpath)


here is what I get

java-config -b java-gtk
CLASSPATH=${CLASSPATH}:/usr/share/java-gnome/gnome-0.7.1.jar
/usr/share/java-gnome/gnome-0.7.1.ja

changing

old_classpath = re.sub('CLASSPATH=\${CLASSPATH}:', '', old_classpath)[:-1]


to

old_classpath = re.sub('CLASSPATH=\${CLASSPATH}:', '', old_classpath)

seem to fix it
Comment 1 Jason A. Mobarak (RETIRED) gentoo-dev 2004-02-13 23:59:32 UTC
Can you attach a patch of your changes? Looks like a simple one liner, but if I could see everything you changed to try and fix it that'd be great! Thanks.
Comment 2 Rohit Singh 2004-02-17 15:34:13 UTC
--- jc_options.py	2004-02-17 18:16:20.006611380 -0500
+++ /usr/lib/python2.3/site-packages/java_config/jc_options.py	2004-02-17 18:19:08.000000000 -0500
@@ -721,7 +721,7 @@
 
 		elif os.path.isfile(os.path.join(jc_dir, 'java-env-classpath')):
 			old_classpath = file(os.path.join(jc_dir, 'java-env-classpath'), 'r').read()
-			old_classpath = re.sub('CLASSPATH=\${CLASSPATH}:', '', old_classpath)
+			old_classpath = re.sub('CLASSPATH=\${CLASSPATH}:', '', old_classpath)[:-1]
 
 		file(os.path.join(jc_dir, 'java-env-classpath'), 'w').write(
 		  'CLASSPATH=${CLASSPATH}:' + old_classpath + ':' + collect_packages(args)
Comment 3 Jason A. Mobarak (RETIRED) gentoo-dev 2004-02-17 23:48:41 UTC
Patch in version 1.2.6 --