init-script status method doesn't handle instances correctly

Bug #1177398 reported by Bjunity on 2013-05-07
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
memcached (Debian)
Fix Released
Unknown
memcached (Ubuntu)
Medium
Unassigned

Bug Description

Line in /etc/init.d/memcached:

status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?

If you have more than 1 Instance the script exit after the first instance found, so the other instances aren't checked.

The quick & dirty fix:

er_or=0

CONFIG_NUM=${#CONFIGS[@]}
.

.
.
.

status)

      status_of_proc -p $PIDFILE $DAEMON $NAME

       returnvalue=`echo $?`

      if [ "$returnvalue" -ne "0" ]
        then
         er_or=`expr $er_or \+ 1`
      fi

       ;;
  *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
        exit 1
        ;;
esac
done;

if [ "$er_or" -ne "0" ]
then
        exit 2
else
        exit 0
fi

CVE References

Robie Basak (racb) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

You have not included any package version information in your report.

Looking at /etc/init.d/memcached supplied by 1.4.14-0ubuntu1, it looks to me that support for stopping multiple instances is already included. I haven't looked closely, but it isn't clear to me whether you are looking at an older version of the package, or are referring to the bug in the latest version that I'm looking at.

Please run:

apport-collect 1177398

on your affected machine to automatically attach all relevant versioning information to this bug. Once done, please change the bug status back to New.

Changed in memcached (Ubuntu):
status: New → Incomplete
Bjunity (bjunity) wrote :

Sry, it's on precise. It is the "status" - function in the init script, not the "stop" - function.

# lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.2 LTS
Release: 12.04
Codename: precise

# dpkg -l | grep memcached

ii memcached 1.4.13-0ubuntu2 A high-performance memory object caching system

Changed in memcached (Ubuntu):
status: Incomplete → New
Robie Basak (racb) wrote :

Thanks. I misunderstood your report before. I now understand, have confirmed by reading the full init script and forwarded the bug on to Debian.

Ubuntu is ahead of Debian in the upstream version but this script comes from a patch in Debian packaging, so ideally Debian will accept a fix and then we can adopt it.

Changed in memcached (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Changed in memcached (Debian):
status: Unknown → New
Changed in memcached (Debian):
status: New → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package memcached - 1.4.24-2ubuntu1

---------------
memcached (1.4.24-2ubuntu1) wily; urgency=medium

  * Merge from Debian unstable. Remaining changes: (LP: #1462747)
    - debian/patches/fix-distribution.patch: added patch to show
      distribution on version (updated to make merging easier)

memcached (1.4.24-2) unstable; urgency=medium

  * Refresh 06_eol_comment_handling.patch and debian/systemd-memcached-wrapper
    to handle "\#" value for -D flag
  * debian/rules: remove package generated memcached.init file

memcached (1.4.24-1) unstable; urgency=medium

  * New upstream release, refresh 07_disable_tests.patch
  * debian/control: Remove XS-Testsuite as dpkg now recognize this header
  * debian/tests: test the daemon by creating, getting, and flushing keys

memcached (1.4.21-1.1) unstable; urgency=medium

  * Non-maintainer upload.

  [ Guillaume Delacour ]
  * Provide systemd perl wrapper to load /etc/memcached.conf settings, thanks
    Christos Trochalakis (Closes: #774087)

memcached (1.4.21-1) unstable; urgency=medium

  * New upstream release
  * Use autotools-dev instead of dh_autoreconf, backup upstream files updated
  * Patching configure.ac no more needed
  * Don't run t/whitespace.t as .git in packaging report false positive

memcached (1.4.20-1) unstable; urgency=medium

  * New upstream release: (Closes: #733588)
    - Includes fix for CVE-2013-7291 (Closes: #735314)
    - Fix build for arm64 port (Closes: #761027, #721203)
  * Add myself to Uploaders
  * Provide scripts/damemtop, scripts/mc_slab_mover
  * README is now README.md
  * Suggests perl modules used by the new scripts
  * Packaging updates:
    - Switch to debhelper 9 and use source format 3.0
    - remove dpkg-dev and quilt Build-Deps,
    - add adduser dependency
    - use all hardening options
    - remove unnecessary debian/README.source
    - update debian/copyring to use the machine-readable format
  * Bumped policy version to 3.9.6 (no changes needed)
  * Use dedicated memcache user instead of nobody, thanks Clint Byrum
    (Closes: #587797)
  * Use DEP-8 to test the package, thanks Yolanda Robla (Closes: #710015)
  * Update description to remove "A" article and change Homepage
  * Handle end of line comments in memcached.conf (Closes: #683144)
  * Update debian/watch to track memcached.org (github has old 1.6.0-beta1)
  * Update upstream manpage to add missing options (Closes: #685800)
  * Add Vcs-{Git,Browser}
  * Provide systemd support.
  * Provide the status for several instances in scripts/memcached-init, if
    the script is used. (Closes: #709163, LP: #1177398)

  [ Ana Beatriz Guerrero Lopez ]
  * As discussed with David by IRC, sponsor the package with Guillaume
    co-maintaining.
  * Add the stanza "XS-Testsuite: autopkgtest" in debian/control
  * Acknowledge old NMUs from Arno Töll. (Closes: #641770, #672125)

 -- Marc Deslauriers <email address hidden> Tue, 18 Aug 2015 08:52:11 -0400

Changed in memcached (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.