clearenv not portable

Bug #999714 reported by reed
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Light Display Manager
Fix Released
Medium
Matt Fischer

Bug Description

lightdm-process.o: In function `process_run':
process.c:(.text+0xbb8): undefined reference to `clearenv'

Here is my patch but untested:

$NetBSD$

--- src/process.c.orig 2012-05-14 19:24:13.000000000 -0500
+++ src/process.c 2012-05-14 19:28:56.000000000 -0500
@@ -158,7 +158,11 @@
     }

     if (process->priv->clear_environment)
+#ifdef HAVE_CLEARENV
         clearenv ();
+#else
+ putenv ("environ=NULL");
+#endif

     g_hash_table_iter_init (&iter, process->priv->env);
     while (g_hash_table_iter_next (&iter, &key, &value))

Note that configure.ac will need to check for clearenv and config.h.in setup to get the HAVE_CLEARENV set.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Confirmed. According to the man page I think the change should be:
#ifdef HAVE_CLEARENV
         clearenv ();
#else
         environ = NULL;
#endif

Changed in lightdm:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
reed (reed-reedmedia) wrote :

Or use "g_clearenv();" ?

Revision history for this message
Robert Ancell (robert-ancell) wrote :

It appears g_clearenv doesn't exist, as that would be the preferred solution.

Matt Fischer (mfisch)
Changed in lightdm:
assignee: nobody → Matt Fischer (mfisch)
status: Triaged → In Progress
Revision history for this message
Matt Fischer (mfisch) wrote :

Reed,

This is what I ended up doing in the patch below, can you try and it see if it works for you?

Revision history for this message
reed (reed-reedmedia) wrote :

I assume it works. I wasn't able to test it yet. The configure.ac uses: GNOME_COMPILE_WARNINGS(maximum) I don't see any developer documentation telling me what software to install to get this macro and I didn't search far.

Revision history for this message
Matt Fischer (mfisch) wrote :

I believe that is in gnome-common.

Revision history for this message
Matt Fischer (mfisch) wrote :

And as soon as I get an ACK from you, I will propose this fix.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Committed this change for 0.3.2. I haven't tested it on a system that doesn't have clearenv() but I'll assume it works. Please reopen the bug if it doesn't.

Changed in lightdm:
status: In Progress → Fix Committed
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Fixed in 1.3.2

Changed in lightdm:
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