[Bug 1164] New: auto-java-classpath functionality breaks on spaces in file names

blfs-bugs at linuxfromscratch.org blfs-bugs at linuxfromscratch.org
Thu Jan 13 00:23:24 PST 2005


http://blfs-bugs.linuxfromscratch.org/show_bug.cgi?id=1164

           Summary: auto-java-classpath functionality breaks on spaces in
                    file names
           Product: Beyond LinuxFromScratch
           Version: SVN
          Platform: All
               URL: http://www.linuxfromscratch.org/blfs/view/svn/general/j2
                    sdk.html#id2739673
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: BOOK
        AssignedTo: blfs-book at linuxfromscratch.org
        ReportedBy: n-roeser at gmx.net
         QAContact: blfs-book at linuxfromscratch.org


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:
-----BEGIN script snippet-----
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
-----END script snippet-----

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.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
You are the QA contact for the bug, or are watching the QA contact.



More information about the blfs-book mailing list