Bug 5505 - alternatives-helper: interpreter errors on some unexpected input options
: alternatives-helper: interpreter errors on some unexpected input options
Status: CLOSED FIXED
: Sisyphus
(All bugs in Sisyphus/alternatives)
: unstable
: all Linux
: P2 minor
Assigned To:
:
:
:
:
:
  Show dependency tree
 
Reported: 2004-11-15 02:33 by
Modified: 2005-09-04 22:04 (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2004-11-15 02:33:28
alternatives-0.2.0-alt0.11

The script contains unquoted variable substitutions, which lead to errors on
unexpected options because the variables expand then to unsuitable values.

A workaround:

*** alternatives-helper	2004/11/14 23:12:31	1.1
--- alternatives-helper	2004/11/14 23:18:39	1.2
***************
*** 34,41 ****
  	    mode=2; shift; continue
  	fi
  
! 	[ $mode -eq 1 ] && alternatives-install $1
! 	[ $mode -eq 2 ] && alternatives-uninstall $1
  
  	shift
  done
--- 34,41 ----
  	    mode=2; shift; continue
  	fi
  
! 	[ "${mode:-0}" -eq 1 ] && alternatives-install "$1"
! 	[ "${mode:-0}" -eq 2 ] && alternatives-uninstall "$1"
  
  	shift
  done

Steps to Reproduce:
/usr/sbin/alternatives-helper -h

Actual Results:  
/usr/sbin/alternatives-helper: line 37: [: : integer expression expected
/usr/sbin/alternatives-helper: line 38: [: : integer expression expected


Expected Results:  
At least, no sh errors.
But would like to see a usage message.
------- Comment #1 From 2004-11-15 02:39:34 -------
No, actual actual results were:

# /usr/sbin/alternatives-helper -h
/usr/sbin/alternatives-helper: line 37: [: -eq: unary operator expected
/usr/sbin/alternatives-helper: line 38: [: -eq: unary operator expected

(What I pasted before were the results of the 1st work-around attempt.)
------- Comment #2 From 2004-11-18 12:56:07 -------
Спасибо за замечания, патч обязательно приложу. 
------- Comment #3 From 2005-04-07 14:48:42 -------
давно