Bug 5505 - alternatives-helper: interpreter errors on some unexpected input options
Summary: alternatives-helper: interpreter errors on some unexpected input options
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: alternatives (show other bugs)
Version: unstable
Hardware: all Linux
: P2 minor
Assignee: placeholder@altlinux.org
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-15 02:33 MSK by Ivan Zakharyaschev
Modified: 2005-09-04 22:04 MSD (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Zakharyaschev 2004-11-15 02:33:28 MSK
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 Ivan Zakharyaschev 2004-11-15 02:39:34 MSK
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 inger@altlinux.org 2004-11-18 12:56:07 MSK
Спасибо за замечания, патч обязательно приложу. 
 
Comment 3 inger@altlinux.org 2005-04-07 14:48:42 MSD
давно