Bug 49491 - all environment is wiped out prior to executing user command
Summary: all environment is wiped out prior to executing user command
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: at
Version: 1.0
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Jens Petersen
QA Contact: Aaron Brown
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-07-20 05:09 UTC by j. alan eldridge
Modified: 2005-10-31 22:00 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-08-05 04:42:37 UTC
Embargoed:


Attachments (Terms of Use)
replacement for patch15 that works and is clearer (1.01 KB, patch)
2001-07-20 05:58 UTC, j. alan eldridge
no flags Details | Diff
The RIGHT patch file (I grabbed the wrong one in the wee hours of the AM) (1.21 KB, patch)
2001-07-20 15:37 UTC, j. alan eldridge
no flags Details | Diff
OK just shoot me. I had 3 versions lying around. Now I feel like and idiot. (1.19 KB, patch)
2001-07-20 15:46 UTC, j. alan eldridge
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2002:015 0 normal SHIPPED_LIVE : Updated at package available 2002-01-15 05:00:00 UTC

Description j. alan eldridge 2001-07-20 05:09:28 UTC
Description of Problem:

I marked this as "all" platforms because at's generic, and this is really 
badly broken.

How Reproducible:

submit a job that relies on any variable in the current environment. 
let's take a real obvious one: PATH.

E.g., I use "#!/usr/bin/env bash" on my scripts so they'll still work on 
Slowlaris, where bash is in /usr/local.

Now let's look at the file that at creates to run the job:

PATH=/home/alane/misc/scripts:/home/alane/bin:/home/alane/sbin:/usr/local/sbin:/usr/local/bin:/usr/local/jre1.2.2/bin:/usr/kerberos/bin:/bin:/usr/bin:/usr/X11R6/bin; 
export PATH=
# <horshack>
# OOH! OOH! THERE IT IS!
# </horshack>
cd /system/software/redhat/rh\-installed || {
         echo 'Execution directory inaccessible' >&2
         exit 1
}



AAAUUUUGGGHH!!! WTF!!!???? Patch13 introduces this bug. Remove the second 
hunk of Patch13. 

diff -u -r at-3.1.8/at.c.env at-3.1.8/at.c
--- at-3.1.8/at.c	Fri May 18 13:09:36 2001
+++ at-3.1.8-eqp/at.c	Fri May 18 12:47:08 2001
@@ -360,7 +360,7 @@
 	char *eqp;
 
 	eqp = strchr(*atenv, '=');
-	if (ap == NULL)
+	if (eqp == NULL)
 	    eqp = *atenv;
 	else {
 	    unsigned int i;
@@ -405,7 +405,7 @@
 		}
 	    }
 	    fputs("; export ", fp);
-	    fwrite(*atenv, sizeof(char), eqp - *atenv - 1, fp);
+	    fwrite(*atenv, sizeof(char), eqp - *atenv, fp);
 	    fputc('\n', fp);
 
 	}

How in hell did this get released?

Comment 1 j. alan eldridge 2001-07-20 05:15:36 UTC
Oops. It's Patch15. at-3.1.8-env.patch. The most recent one. The one that was 
applied to make this new release. 

wp's environment patch didn't work out quite right.

Comment 2 j. alan eldridge 2001-07-20 05:56:27 UTC
Ahh. Well. I guess I was a bit harsh there. Sorry.

Here's a different patch. It's a bit clearer. Uses a couple more vars, but 
hey, E Pluribus Optimizum.



Comment 3 j. alan eldridge 2001-07-20 05:58:44 UTC
Created attachment 24269 [details]
replacement for patch15 that works and is clearer

Comment 4 j. alan eldridge 2001-07-20 15:37:54 UTC
Created attachment 24309 [details]
The RIGHT patch file (I grabbed the wrong one in the wee hours of the AM)

Comment 5 j. alan eldridge 2001-07-20 15:46:55 UTC
Created attachment 24311 [details]
OK just shoot me. I had 3 versions lying around. Now I feel like and idiot.

Comment 6 Jens Petersen 2002-08-14 09:47:34 UTC
Seems this has been fixed for some time.  Works in Red Hat 7.3 at least and
limbo. Closing.


Note You need to log in before you can comment on or make changes to this bug.