Bug 108948 - ports/lang/stklos has bashism in installed scripts
Summary: ports/lang/stklos has bashism in installed scripts
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Rong-En Fan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-08 22:50 UTC by clemens fischer
Modified: 2007-02-12 19:50 UTC (History)
1 user (show)

See Also:


Attachments
file.diff (203 bytes, patch)
2007-02-08 22:50 UTC, clemens fischer
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description clemens fischer 2007-02-08 22:50:19 UTC
two of the bourne shell scripts installed by ports/lang/stklos contain
function definitions formulated the "bash-way", thus fail issueing
a syntax error.  the shebang line is "#!/bin/sh".  the definitions are
prefixed by the bash reserved word "function":

  /l/bin/stklos-ext-install:function usage()
  /l/bin/stklos-install:function usage()
  /l/bin/stklos-install:function trace()
  /l/bin/stklos-install:function try_fetch()
  /l/bin/stklos-install:function die()
  /l/bin/stklos-install:function find_prefix()
  /l/bin/stklos-install:function install_package()
  /l/bin/stklos-install:function uninstall_package()
  /l/bin/stklos-install:function list_extensions()

also, both scripts refer to the bash builtin variable "$UID", which has
to be replaced by "`id -u`".

Fix: $ rrcsdiff /l/bin/stklos-install
rcsdiff --unified /l/bin/stklos-install
===================================================================
RCS file: /l/bin/RCS/stklos-install,v
retrieving revision 1.1
-    if [ $UID = 0 ] ;then
+    if [ `id -u` -eq 0 ] ;then
        prefix=`stklos-config --prefix`
     else
        mkdir -p $HOME/.stklos
@@ -145,7 +145,7 @@
 # ----------------------------------------------------------------------
 #      uninstall_package ...
 # ----------------------------------------------------------------------
-function uninstall_package()
+uninstall_package()
 {
     pkg=$1

@@ -175,7 +175,7 @@
 # ----------------------------------------------------------------------
 #      list_extensions ...
 # ----------------------------------------------------------------------
-function list_extensions()
+list_extensions()
 {
     trace "Available extensions:"
     DIR=`find_prefix`

$ rrcsdiff /usr/local/bin/stklos-ext-install
rcsdiff --unified /usr/local/bin/stklos-ext-install
===================================================================
RCS file: /usr/local/bin/RCS/stklos-ext-install,v
retrieving revision 1.1


-function usage()
+usage()
 {
     echo "Usage: $0 pkg file dir mode
 where
@@ -48,7 +48,7 @@
 MODE=$4

 # Create the destination directory
-if [ $UID = 0 ] ;then
+if [ `id -u` -eq 0 ] ;then
     DEST=`stklos-config -p`/$DIR
     DB=`stklos-config -p`/share/stklos/extensions
 else
@@ -69,7 +69,7 @@
 chmod $MODE $DEST/$FILE

 # Retain in our DB that this file was installed
-if [ $UID = 0 ] ;then
+if [ `id -u` -eq 0 ] ;then
     DBDIR=`stklos-config -p`/share/stklos/extensions
 else
     DBDIR=$HOME/.stklos/ext/extensions--7tDDAwtxF6KgMtkWkKsRg2sDV5NoxjPNkz58egoKYd4lPkKM
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

diff --unified -r1.1 /l/bin/stklos-install
--- /l/bin/stklos-install       2007/02/08 22:25:47     1.1
+++ /l/bin/stklos-install       2007/02/08 22:27:50
@@ -34,7 +34,7 @@
 # ----------------------------------------------------------------------
 #      Usage ...
 # ----------------------------------------------------------------------
-function usage()
+usage()
 {
     cat <<EOF
 Usage: stklos-setup [OPTIONS] package
@@ -50,7 +50,7 @@
 # ----------------------------------------------------------------------
 #      trace ...
 # ----------------------------------------------------------------------
-function trace()
+trace()
 {
     case $TERM in
        vt100|xterm*|rxvt|urxvt*) begin=""; end="" ;;
@@ -62,7 +62,7 @@
 # ----------------------------------------------------------------------
 #      try-fetch ...
 # ----------------------------------------------------------------------
-function try_fetch()
+try_fetch()
 {
     pkg=$1
     trace "Package $pkg is absent. Try to fetch it from $DISTURL"
@@ -75,7 +75,7 @@
 # ----------------------------------------------------------------------
 #      die ...
 # ----------------------------------------------------------------------
-function die()
+die()
 {
     echo $1 >&2
     exit 1
@@ -85,9 +85,9 @@
 # ----------------------------------------------------------------------
 #      find_prefix ...
 # ----------------------------------------------------------------------
-function find_prefix()
+find_prefix()
 {
-    if [ $UID = 0 ] ;then
+    if [ `id -u` -eq 0 ] ;then
        echo "`stklos-config --prefix`/share/stklos/extensions"
     else
        echo $HOME/.stklos/ext/extensions
@@ -98,7 +98,7 @@
 # ----------------------------------------------------------------------
 #      install_package ...
 # ----------------------------------------------------------------------
-function install_package()
+install_package()
 {
     pkg=$1
     TMP=/tmp/stklos-setup-$$
@@ -116,7 +116,7 @@
        exit 1
     fi
How-To-Repeat: 
after installing lang/stklos, do:

  $ stklos-install
  /usr/local/bin/stklos-install: 37: Syntax error: "(" unexpected

the same goes for "/l/bin/stklos-ext-install".
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2007-02-08 22:50:33 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback
Comment 2 Ying-Chieh Chen 2007-02-09 02:35:41 UTC
Dear Edwin,

  I approve this patch, please commit it.

Thanks!

On Thu, Feb 08, 2007 at 10:50:26PM +0000, Edwin Groothuis wrote:
> Maintainer of lang/stklos,
> 
> Please note that PR ports/108948 has just been submitted.
> 
> If it contains a patch for an upgrade, an enhancement or a bug fix
> you agree on, reply to this email stating that you approve the patch
> and a committer will take care of it.
> 
> The full text of the PR can be found at:
>     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/108948
> 
> -- 
> Edwin Groothuis
> edwin@FreeBSD.org
Comment 3 Rong-En Fan freebsd_committer freebsd_triage 2007-02-12 12:48:49 UTC
Responsible Changed
From-To: freebsd-ports-bugs->rafan

Eat.
Comment 4 dfilter service freebsd_committer freebsd_triage 2007-02-12 13:12:13 UTC
rafan       2007-02-12 13:12:04 UTC

  FreeBSD ports repository

  Modified files:
    lang/stklos          Makefile 
  Log:
  - No more bash syntax!
  - Bump PORTREVISION
  
  PR:             ports/108948 (based on)
  Submitted by:   clemens fischer <ino-news at spotteswoode.dnsalias.org>
  Approved by:    Ying-Chieh Chen (maintainer via irc)
  
  Revision  Changes    Path
  1.12      +9 -1      ports/lang/stklos/Makefile
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 5 Rong-En Fan freebsd_committer freebsd_triage 2007-02-12 13:12:19 UTC
State Changed
From-To: feedback->closed

Committed. Thanks!