upstart loses track of process ID when /etc/default/ entry contains backticks

Bug #1000246 reported by Simon Fraser
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
upstart (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Initially noticed with our autofs5 configuration, which uses `uname ` to set some architecture specific options for a software distribution mount.

If /etc/default/testapp contains an entry like:
OPTION=`uname -m`

Then upstart gets the wrong PID for the daemon. This means we can't stop/restart the service, and shutting down the machine is impossible without resetting the power - upstart hangs looking for the wrong process ID.

# status testapp
testapp start/running, process 854
# ps -ef | grep testapp
root 855 1 0 15:04 ? 00:00:00 /root/testapp

Take the backticks out of /etc/default/testapp and things work as expected.

# cat testapp.c
#include <sys/types.h>

int main(void) {
 pid_t pid = fork();
 if ( pid == 0 ) {
  while(1) {
   sleep(10);
  }
 } else {
  return(0);
 }
}

# cat /etc/default/testapp
OPTION=`uname -m`
# cat /etc/init/testapp.conf
description "Test Application"
author "<email address hidden>"

start on runlevel [2345]
stop on runlevel [!2345]

expect fork # have also tried 'expect daemon'
respawn

script
    if [ -f /etc/default/testapp ] ; then
        . /etc/default/testapp
    fi
    exec /root/testapp
end script

lsb_release -rd
Description: Ubuntu 12.04 LTS
Release: 12.04

# apt-cache policy upstart
upstart:
  Installed: 1.5-0ubuntu5
  Candidate: 1.5-0ubuntu7
  Version table:
     1.5-0ubuntu7 0
        500 http://gb.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
 *** 1.5-0ubuntu5 0
        500 http://gb.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
        100 /var/lib/dpkg/status

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in upstart (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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