Bug 49491 - all environment is wiped out prior to executing user command
all environment is wiped out prior to executing user command
Status: CLOSED CURRENTRELEASE
Product: Red Hat Raw Hide
Classification: Retired
Component: at (Show other bugs)
1.0
All Linux
high Severity high
: ---
: ---
Assigned To: Jens Petersen
Aaron Brown
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-07-20 01:09 EDT by j. alan eldridge
Modified: 2005-10-31 17:00 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-08-05 00:42:37 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
replacement for patch15 that works and is clearer (1.01 KB, patch)
2001-07-20 01:58 EDT, 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 11:37 EDT, 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 11:46 EDT, j. alan eldridge
no flags Details | Diff

  None (edit)
Description j. alan eldridge 2001-07-20 01:09:28 EDT
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 01:15:36 EDT
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@supermedia.pl's environment patch didn't work out quite right.
Comment 2 j. alan eldridge 2001-07-20 01:56:27 EDT
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 01:58:44 EDT
Created attachment 24269 [details]
replacement for patch15 that works and is clearer
Comment 4 j. alan eldridge 2001-07-20 11:37:54 EDT
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 11:46:55 EDT
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 05:47:34 EDT
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.