Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 615633

Summary: condor_chirp get_job_attr can return garbage
Product: Red Hat Enterprise MRG Reporter: Matthew Farrellee <matt>
Component: condorAssignee: Matthew Farrellee <matt>
Status: CLOSED ERRATA QA Contact: Lubos Trilety <ltrilety>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.2CC: ltrilety
Target Milestone: 1.3   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-10-14 16:14:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Matthew Farrellee 2010-07-17 15:48:48 UTC
Description of problem:

After ssh_to_job...

$ /usr/libexec/condor/condor_chirp get_job_attr Owner                 
"matt"uuuuuuuuuuuuuuuuuu
$ MALLOC_PERTURB_=97 /usr/libexec/condor/condor_chirp get_job_attr Owner
"matt"aaaaaaaaaaaaaaaaaa
$ MALLOC_PERTURB_=98 /usr/libexec/condor/condor_chirp get_job_attr Owner
"matt"bbbbbbbbbbbbbbbbbb
$ MALLOC_PERTURB_=0 /usr/libexec/condor/condor_chirp get_job_attr Owner
"matt"

From chirp_client.c:

		*expr = (char*)malloc(result);
		if(*expr) {
			actual = fread(*expr,1,result,c->rstream);
			if(actual!=result) chirp_fatal_request("get_job_attr");
		} else {

From io_proxy_handler.cpp:

		result = REMOTE_CONDOR_get_job_attr(name,recv_expr);
		if(result==0) {
			sprintf(line,"%u",(unsigned int)strlen(recv_expr));
			r->put_line_raw(line);
			r->put_bytes_raw(recv_expr,strlen(recv_expr));
		} else {

Oops! No terminating NULL.


Version-Release number of selected component (if applicable):

7.4.4-0.4


Additional information:

Workaround by setting MALLOC_PERTURB_=0

Comment 1 Matthew Farrellee 2010-07-17 16:13:05 UTC
diff --git a/src/condor_chirp/condor_chirp.cpp b/src/condor_chirp/condor_chirp.cpp
index c1e9fbb..20e513f 100644
--- a/src/condor_chirp/condor_chirp.cpp
+++ b/src/condor_chirp/condor_chirp.cpp
@@ -307,8 +307,8 @@ int chirp_get_job_attr(int argc, char **argv) {
        }
 
        char *p = 0;
-       chirp_client_get_job_attr(client, argv[2], &p);
-       printf("%s\n", p);
+       int len = chirp_client_get_job_attr(client, argv[2], &p);
+       printf("%.*s\n", len, p);
        return 0;
 }

Comment 2 Matthew Farrellee 2010-07-17 16:17:09 UTC
https://condor-wiki.cs.wisc.edu/index.cgi/tktview?tn=1513

Built post 7.4.4-0.4

Comment 3 Lubos Trilety 2010-08-06 12:18:50 UTC
Tested with (version):
condor-7.4.4-0.8

Tested on:
RHEL5 x86_64,i386  - passed
RHEL4 x86_64,i386  - passed

>>> VERIFIED

Comment 5 errata-xmlrpc 2010-10-14 16:14:02 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2010-0773.html