[jboss-dev] Symlinks and JBoss AS ./bin/*.sh scripts

Emmanuel Bernard emmanuel at hibernate.org
Mon Nov 29 09:04:21 EST 2010

On 28 nov. 2010, at 23:03, David M. Lloyd wrote:

> On 11/28/2010 10:18 AM, Emmanuel Bernard wrote:
>> Hey guys,
>> Over the week-end I've packaged JBoss AS 6 into HomeBrew (a Mac OS X packaging system made of git and ruby).
>> I've discovered that our scripts are not symlinks friendly and will fail (often not finding the jars).
>> I've fixed the issue but I wanted to get a review of my work. Let me know if you thing there could be a problem, otherwise I'll apply them to SVN.
>> [...]
>>   ls=`ls -ld "$PRG"`
>>   link=`expr "$ls" : '.*->  \(.*\)$'`
> This is fragile I think.  It'd probably be better to use "readlink" 
> instead, whose actual purpose is to read links.

I've tried your approach but I had a couple of issues. The main one is that readlink -f (recursive) is not standard across all platforms. The second issue I had was that readlink sometimes return links to the script basedir, sometimes as absolute. I imagine I could circumvent issue 2 (I've something for issue 1) but the fix will likely end up as weak as the original proposal (that comes from mvn, tomcat and co, so I imagine is decently battle tested).

Is that worth the work?


More information about the jboss-development mailing list