← Back to team overview

touch-packages team mailing list archive

[Bug 1337576] Re: dash inability - cron starts binary with /bin/sh

 

Perhaps I should have been more clearer: the POSIX standard mandates
that the command field (that's everything in the sixth column of a
crontab file) be passed as arguments to /bin/sh:

  | The sixth field of a line in a crontab entry is a string
  | that shall be executed by sh at the specified times.

Therefore, this cannot be changed.

Furthermore, exec'ing the command directly would severely break existing
crontabs. Take the following entry for example, which utilizes output
redirection:

  15  *  *  *  * df -h > $HOME/disk.log

As you correctly identified, /bin/sh points to /bin/dash. But you can
point that to any other Bourne-compatible shell, eg bash, if you want.

** Changed in: cron (Ubuntu)
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to cron in Ubuntu.
https://bugs.launchpad.net/bugs/1337576

Title:
  dash inability - cron starts binary with /bin/sh

Status in “cron” package in Ubuntu:
  Invalid

Bug description:
  -- Problem Description --
  CRON uses shell to start a binary executable defined in crontab, which is a waste of the resources for the extra shell process hanging in the system. It's supposed to run it directly with exec system call.

  *** Here are some command outputs to see the extra process(12327) and relevant information: ***
  # ps -ef | grep -e CRON -e PMLnx
  root     12326   771  0 13:59 ?        00:00:00 CRON
  root     12327 12326  0 13:59 ?        00:00:00 /bin/sh -c /var/perf/pm/bin/daemon_PMLnx      <--- extra layer, a waste
  root     12328 12327  0 13:59 ?        00:00:00 /var/perf/pm/bin/daemon_PMLnx

  # crontab -l
  59 * * * * /var/perf/pm/bin/daemon_PMLnx

  # file /var/perf/pm/bin/daemon_PMLnx
  /var/perf/pm/bin/daemon_PMLnx: ELF 64-bit LSB  executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 3.0.0, BuildID[sha1]=1761d6d97eabb4e52870cb517fe6bf457e5bf89e, stripped

  # uname -a
  Linux ubuntu 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:09:21 UTC 2014 ppc64le ppc64le ppc64le GNU/Linux

  # dpkg -l cron
      Name  Version            Architecture  Description
  +++-=====-==================-=============-=========================
  ii  cron  3.0pl1-124ubuntu2  ppc64el       process scheduling daemon

  *** Expect cron to directly execute a binary like this ***
  # ps -ef | grep -e CRON -e PMLnx
  root      2293  2223  0 09:59 ?        00:00:00 /usr/sbin/CRON -n
  root      2294  2293  0 09:59 ?        00:00:00 /var/perf/pm/bin/daemon_PMLnx

  # uname -a
  Linux hulala 3.12.15-3-default #1 SMP Wed Apr 2 17:08:55 UTC 2014 (69c2ea8) ppc64le ppc64le ppc64le GNU/Linux

  # cat /etc/SuSE-release
  SUSE Linux Enterprise Server 12 (ppc64le)
  VERSION = 12
  PATCHLEVEL = 0

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cron/+bug/1337576/+subscriptions