Bug#669909: lsb-base: resetting a global variable (OPTIND) in a function, without declaring it local, can have unpleasent consequences

Cristian Ionescu-Idbohrn <[email protected]>
Newsgroups gmane.linux.debian.devel.lsb
Message-ID <1204212242550.17614__23689.2475317747$1335041300$gmane$org@somehost>
Package: lsb-base
Version: 4.1+Debian1
Severity: normal

start_daemon () {
    local force nice pidfile exec args
--

    OPTIND=1
--
pidofproc () {
    local pidfile base status specified pid
--

    OPTIND=1
--
killproc () {
    local pidfile sig status base name_param is_term_sig
--

    OPTIND=1
--
status_of_proc () {
    local pidfile daemon name status
--
    pidfile=
    OPTIND=1
--

as it may overwrite the calling scope's OPTIND value.


-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-2-686-pae (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

-- no debconf information


Cheers,

-- 
Cristian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.