Opened 20 years ago

Closed 19 years ago

Last modified 11 years ago

#1164 closed defect (fixed)

auto-java-classpath functionality breaks on spaces in file names

Reported by: Nico R. Owned by: blfs-book@…
Priority: high Milestone:
Component: BOOK Version: SVN
Severity: normal Keywords:
Cc:

Description

The auto-java-classpath script snippet does not work correctly if any of the path components contains spaces.

Example: /usr/lib/auto-java-classpath/foobar.jar /usr/lib/auto-java-classpath/foo bar.jar

Result: CLASSPATH=".:/usr/lib/auto-java-classpath:/usr/lib/auto-java-classpath/foo:bar.jar:/usr/lib/auto-java-classpath/foobar.jar"

Expected result: CLASSPATH=".:/usr/lib/auto-java-classpath:/usr/lib/auto-java-classpath/foo bar.jar:/usr/lib/auto-java-classpath/foobar.jar"

Suggestion to fix this: Replace with the following lines:


AUTO_CLASSPATH_DIR='/usr/lib/auto-java-classpath' CLASSPATH="${CLASSPATH}${CLASSPATH:+:}.:${AUTO_CLASSPATH_DIR}" ls "${AUTO_CLASSPATH_DIR}"/*.jar &>/dev/null && for f in "${AUTO_CLASSPATH_DIR}"/*.jar; do

CLASSPATH="${CLASSPATH}:${f}"

done export CLASSPATH


This will still catch the case of the auto-java-classpath directory being empty, but it will also work if it contains files with spaces in their filenames. It might need a little longer to execute, though.

Change History (2)

comment:1 by DJ Lucas, 19 years ago

Resolution: fixed
Status: newclosed

Fixed in previous update to use profile.d directory.

comment:2 by bdubbs@…, 11 years ago

Milestone: old

Milestone old deleted

Note: See TracTickets for help on using tickets.