Opened 14 years ago

Closed 14 years ago

#202 closed enhancement (fixed)

buildpack updates for Solaris OS

Reported by: Huw Lewis Owned by: Dave Offiler
Priority: normal Milestone: 4.1
Component: Build Version: 4.0
Keywords: buildpack Cc: huw.lewis@…

Description

Feedback from Johannes Fritzer (Uni Graz) relating to buildpack script. He is using it to build ROPP on Solaris OS.

While we don't have access to this for testing, we can at least test that the suggested fixes/workarounds don't break existing supported systems and implement as appropriate.

In order to properly run on Solaris OS, the ./buildpack script 
requires the following modification 
(which makes ./buildpack compatible with Linux and (!) Solaris OS):

sed -i -e '173s/ls -q --color=never /ls /'  buildpack                                     

sed -i -e '224s/ls -dq --color=never /ls -d /' buildpack
Since I am using ROPP on Linux and Solaris, I have found on Solaris one minor problem 
with statements like v=$(expr index -4.0.1 -) in buildpack, at lines 177, 179, 227 and 229, which give an "expr: syntax error".

By replacing e.g. "v=$(expr index $f -)" with v=`index $f -` and adding an alternate index function 
(as found on http://unix.derkeiler.com/Newsgroups/comp.unix.shell/2009-06/msg00643.html)

#     alternate index function:   index()
#                                 {
#                                 case $1 in
#                                 *$2*) idx=${1%%$2*}
#                                 echo $(( ${#idx} + 1 ))
#                                 ;;
#                                 *) echo 0 ;;
#                                 esac
#                                 }

solves the problem and is compatible with both, Linux and Solaris.

Change history (2)

comment:1 by Dave Offiler, 14 years ago

Cc: huw.lewis@… added
Milestone: 5.04.1

1) The offending -q & --color=never options to ls were included because in some cases when ls was an alias to ls --colour=auto (default on some Linux distros) colour control characters where causing the algorithm to fail to pick the correct file or directory. I thought this was a Cygwin problem, but I've not managed to reproduce it on the latest release. It could have been on the (now defunct) NEC system...

These options have now been removed and a line unset ls inserted to return ls to its built-in state. This should work on any POSIX system.

2) The issue noted with the expr syntax error also occurs under Cygwin when the character being tested (here '-' or '_') is not present in the test string. The simplest solution is to send error output to /dev/null; apart from the error message, the algorithm worked (and still works) as intended.

This change has been successfully tested under desktop RHEL4 and Win/Cygwin - though it should be noted these platforms didn't show a problem with colour codes in the first place (I think the problem was on the ex-NEC). The updated buildpack needs to be tested on the IBM HPC and perhaps Johannes should be asked to re-test on his Solaris system. If the simple fix to (2) still gives problems on Solaris, then the noted index hack may be necessary.

Changes to buildpack committed as [2464]. Leaving this ticket open pending confirmation of portability to the IBM & Solaris.

comment:2 by Dave Offiler, 14 years ago

Resolution: fixed
Status: newclosed

Johannes has confirmed that the updated buildpack script provided to him works to his satisfaction, so this ticket is closed. It can be re-opened should any problems appear on the IBM HPC.

Note: See TracTickets for help on using tickets.