[Bug 1081379] Re: cron ignoring PATH from crontab

Robie Basak 1081379 at bugs.launchpad.net
Sun Jul 7 23:31:14 UTC 2013


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

I was just looking at the list of bug reports filed against cron and
came across this bug.

Am I right in understanding that you're expecting /etc/crontab's PATH
setting to provide a default for the crontab you're then editing with
"crontab -e"?

/etc/crontab and the crontab listed by "crontab -l" are two separate
crontabs, and the PATH setting in /etc/crontab doesn't transfer across
to the crontab you can edit with "crontab -e" as root. Each crontab file
stands on its own. /etc/crontab does not provide defaults for any other
crontab. This is by design.

Setting this bug's status to Invalid, since you're expecting something
that is not supposed to happen. If I'm wrong in my understanding of your
report, or you disagree, please explain and change the bug status back
to New. Thanks!

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

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to cron in Ubuntu.
https://bugs.launchpad.net/bugs/1081379

Title:
  cron ignoring PATH from crontab

Status in “cron” package in Ubuntu:
  Invalid

Bug description:
  cron 3.0pl1-120ubuntu4 appears to be ignoring the environment
  variables in /etc/crontab, or at least PATH.

  Per crontab(5) man page:

         Several environment variables are set up automatically by the cron(8) daemon.  SHELL is set to /bin/sh, and LOGNAME and HOME are set from the /etc/passwd line of the crontab's owner.  PATH  is
         set to "/usr/bin:/bin".  HOME, SHELL, and PATH may be overridden by settings in the crontab; LOGNAME is the user that the job is running from, and may not be changed.

  I did the following simple test to demonstrate that /usr/bin:/bin is
  being used as the PATH, and it is not being overriden as described.
  I'm using the system default /etc/crontab contents. I added a cron
  entry that just writes the output of "env".

  cdodt 2 ~% cat /etc/crontab
  [. . .]
  SHELL=/bin/sh
  PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

  # m h dom mon dow user  command
  [. . .]


  root at blueprint:~# crontab -l
  * * * * * env > ~/cronenv

  
  root at blueprint:~# cat cronenv 
  HOME=/root
  LOGNAME=root
  PATH=/usr/bin:/bin
  LANG=en_US.UTF-8
  SHELL=/bin/sh
  PWD=/root


  PATH, set from /etc/crontab, is not being used. Am I missing
  something?

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




More information about the foundations-bugs mailing list