Bug 53852

Summary: [PATCH] fop shell script botches LOCALCLASSPATH on Cygwin
Product: Fop - Now in Jira Reporter: Markus Hoenicka <markus.hoenicka>
Component: generalAssignee: fop-dev
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: trunk   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: patch to fix $CLASSPATH handling on Cygwin

Description Markus Hoenicka 2012-09-11 16:33:07 UTC
Created attachment 29355 [details]
patch to fix $CLASSPATH handling on Cygwin

fop (the shell script, not the product) as of version 1.1rc1 did not work out of the box on WindowsXP/Cygwin:

CYGWIN_NT-5.1 sbhc123 1.7.16(0.262/5/3) 2012-07-20 22:55 i686 Cygwin

Java died with an exception as it was unable to locate the fop classes. Turned out that the $CLASSPATH that the script created was invalid.

There were two unrelated reasons:

1. If $CLASSPATH is set to a DOS-style path outside of Cygwin, then an intermediate version of $LOCALCLASSPATH (before its final conversion to DOS-style) is a mixture of Unix- and DOS-style paths. This breaks cygpath as it can't handle mixed-style paths. Unfortunately, some badly programmed softwares like Quicktime modify $CLASSPATH globally. So any preset $CLASSPATH should be converted to Unix-style before attaching it to $LOCALCLASSPATH

2. $LOCALCLASSPATH is assembled by collecting .jar files from the /lib subdir of fop. On Cygwin, the script uses Unix paths and the DOS path separator (:). This wreaks havoc on $LOCALCLASSPATH if you want to obtain a clean DOS version of the assembled path. Also, using Unix-style paths and path separators throughout obviates one conversion step (to Unix-style) before converting $LOCALCLASSPATH to DOS-style.

The attached patch attempts to fix these problems. The patched script works fine for me if I set the following environment variables, e.g. in .bashrc:

FOP_HOME=/cygdrive/c/Programme/fop-1.1rc1
JAVA_HOME=/cygdrive/c/Programme/Java/jre7
Comment 1 Mehdi Houshmand 2012-09-26 13:24:46 UTC
Hi Markus,

This commit looks ok, but I don't really use Windows much so I'm slightly reticent  in committing it. Could a Windows user take a look?

Thanks

Mehdi