assert() when no TERM or PATH from parent environment

Bug #251113 reported by Arkadiusz Miśkiewicz
4
Affects Status Importance Assigned to Milestone
upstart
Fix Released
Medium
Unassigned

Bug Description

process_setup_environment (Job *job)
{
        char **env;
        char *path, *term, *jobid;

        nih_assert (job != NULL);

        /* Inherit PATH and TERM from our parent's environment, everything
         * else is often just overspill from initramfs.
         */
        NIH_MUST (path = nih_strdup (NULL, getenv ("PATH")));
        NIH_MUST (term = nih_strdup (NULL, getenv ("TERM")));

and then nih_strdup() has:

nih_assert (str != NULL);

which means that if there is no PATH or TERM then this happens:

Jul 23 13:31:58 fx init: string.c:143: Assertion failed in nih_strdup: str != NULL
Jul 23 13:31:58 fx init: rcS main process (4490) killed by ABRT signal

(it's upstart from hardy)

You could ask how it's possible to not have PATH or TERM in environment... it is reality when running ubuntu as guest in linux vserver.

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

The environment code in trunk is substantially different and not affected by this bug

Changed in upstart:
status: New → Fix Released
status: Fix Released → Fix Committed
importance: Undecided → Medium
Changed in upstart:
status: Fix Committed → Fix Released
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.