n 4 December 2012 13:02, Carlos Alberto Lopez Perez <clo...@igalia.com> wrote:
> I have recently just discovered this. I started digging why one of my
> scripts was failing and at the end I discovered that this was caused
> because cron was setting the PATH for my script to be:
>
> PATH=/usr/bin:/bin

Well, this is documented. If you read the crontab manpage [1] you will see:

PATH   is   set   to  "/usr/bin:/bin".   HOME,  SHELL, and PATH may be
overridden by settings in the crontab;
(...)
Note  in particular that if you want a PATH other than
"/usr/bin:/bin", you will need to set it in the crontab file.

> Digging on the source code I found this:
>

Even though the code has the  _PATH_DEFPATH_ROOT definition, it is
actually not used currently in the code. You can see this if you grep
the full sources [2]

> But the second one seems to be intended for the root user, and is not used.

Yes, the code for that distinction is not there. And it is not
documented nowhere.

> All the tests that I did were as root with a cronfile under /etc/cron.d and 
> the PATH that I got by default
> was "/usr/bin:/bin"

As expected, since it is the defined (and documented) behaviour.

> I believe that the bug #688716 is related to this.

Not exactly. Bug #688716  wants the PATH to be inherited from the
init.d script, instead of being hardcoded in the code. You want cron
to define two distinct paths (for root vs. non-root users).

Either way, its a change in behaviour. For me this is a wishlist bug,
we might tackle this in the future (after the next release). I will
change its severity accordingly.

I'm not sure if the latest cron upstream already provides for this (I
would need to review the code) but maybe it does already and fixing
#511780 would fix also this bug.


Regards

Javier




[1] 
http://manpages.debian.net/cgi-bin/man.cgi?query=crontab&sektion=5&apropos=0&manpath=Debian+unstable+sid&locale=

[2] 
http://anonscm.debian.org/gitweb/?p=pkg-cron%2Fpkg-cron.git&a=search&h=HEAD&st=grep&s=_PATH_DEFPATH


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to