diff --git a/doc/man/man5/slurm.conf.5 b/doc/man/man5/slurm.conf.5 index 027f50dfa6a83da87e1046f6db4e7d7d18285b72..b52afe5b6c0049d7fda5ed288cdb023f725867e6 100644 --- a/doc/man/man5/slurm.conf.5 +++ b/doc/man/man5/slurm.conf.5 @@ -2678,7 +2678,7 @@ outside of a partition specification (which is "NO", allowing user root to execute jobs). .TP -\fIGraceTime\fP +\fBGraceTime\fR Specifies, in units of seconds, the preemption grace time to be extended to a job which has been selected for preemption. The default value is zero, no preemption grace time is allowed on diff --git a/src/common/slurm_protocol_defs.c b/src/common/slurm_protocol_defs.c index df45a90d27f0bc7cdcb4f08c2603d6ec7a93130b..56ceb3ebd79f0b514c05768acac15ffcad8b6c02 100644 --- a/src/common/slurm_protocol_defs.c +++ b/src/common/slurm_protocol_defs.c @@ -367,8 +367,10 @@ extern void slurm_free_job_desc_msg(job_desc_msg_t * msg) if (msg) { xfree(msg->account); xfree(msg->alloc_node); - for (i = 0; i < msg->argc; i++) - xfree(msg->argv[i]); + if (msg->argv) { + for (i = 0; i < msg->argc; i++) + xfree(msg->argv[i]); + } xfree(msg->argv); xfree(msg->blrtsimage); xfree(msg->ckpt_dir); diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c index 7181723f3132ff451a73cacd365ba70339bba6bf..902974b25580f6211e96a405ed3a39ecce9a8aa8 100644 --- a/src/slurmctld/job_mgr.c +++ b/src/slurmctld/job_mgr.c @@ -5972,17 +5972,32 @@ static void _pack_default_job_details(struct job_record *job_ptr, int i; struct job_details *detail_ptr = job_ptr->details; char *cmd_line = NULL; + char *tmp = NULL; + uint32_t len = 0; if(protocol_version >= SLURM_2_2_PROTOCOL_VERSION) { if (detail_ptr) { packstr(detail_ptr->features, buffer); packstr(detail_ptr->work_dir, buffer); packstr(detail_ptr->dependency, buffer); + if (detail_ptr->argv) { + /* Determine size needed for a string + containing all arguments */ for (i=0; detail_ptr->argv[i]; i++) { - if (cmd_line) - xstrcat(cmd_line, " "); - xstrcat(cmd_line, detail_ptr->argv[i]); + len += strlen(detail_ptr->argv[i]); + } + len += i; + + cmd_line = xmalloc(len*sizeof(char)); + tmp = cmd_line; + for (i=0; detail_ptr->argv[i]; i++) { + if (i != 0) { + *tmp = ' '; + tmp++; + } + strcpy(tmp,detail_ptr->argv[i]); + tmp += strlen(detail_ptr->argv[i]); } packstr(cmd_line, buffer); xfree(cmd_line); diff --git a/src/slurmctld/proc_req.c b/src/slurmctld/proc_req.c index 5a669129a67f3c7ac1cae02c14704388427c4793..d90c701d03b9e6c4fb7d787ec927b02bcf1c6fa7 100644 --- a/src/slurmctld/proc_req.c +++ b/src/slurmctld/proc_req.c @@ -3519,7 +3519,7 @@ inline static void _slurm_rpc_checkpoint_task_comp(slurm_msg_t * msg) /* Copy an array of type char **, xmalloc() the array and xstrdup() the * strings in the array */ extern char ** -xduparray(uint16_t size, char ** array) +xduparray(uint32_t size, char ** array) { int i; char ** result; @@ -3537,7 +3537,7 @@ xduparray(uint16_t size, char ** array) /* Like xduparray(), but performs one xmalloc(). The output format of this * must be identical to _read_data_array_from_file() */ static char ** -_xduparray2(uint16_t size, char ** array) +_xduparray2(uint32_t size, char ** array) { int i, len = 0; char *ptr, ** result; diff --git a/src/slurmctld/proc_req.h b/src/slurmctld/proc_req.h index 5e335dba8f3a75a30c90ad1c7264d40d689a353d..6f5f252d40a89e9ea8403e7c013cfffe92da2c25 100644 --- a/src/slurmctld/proc_req.h +++ b/src/slurmctld/proc_req.h @@ -74,7 +74,7 @@ extern int slurm_fail_job(uint32_t job_id); /* Copy an array of type char **, xmalloc() the array and xstrdup() the * strings in the array */ -extern char **xduparray(uint16_t size, char ** array); +extern char **xduparray(uint32_t size, char ** array); #endif /* !_HAVE_PROC_REQ_H */ diff --git a/src/slurmctld/slurmctld.h b/src/slurmctld/slurmctld.h index fde9c5a3906e7caac96fd69404d80c3120b8fc14..7876f8bef38d596f90ce8bd592c268642b4852e4 100644 --- a/src/slurmctld/slurmctld.h +++ b/src/slurmctld/slurmctld.h @@ -383,7 +383,7 @@ struct feature_record { * can be purged after initiation */ struct job_details { uint16_t acctg_freq; /* accounting polling interval */ - uint16_t argc; /* count of argv elements */ + uint32_t argc; /* count of argv elements */ char **argv; /* arguments for a batch job script */ time_t begin_time; /* start at this time (srun --begin), * resets to time first eligible diff --git a/src/slurmd/slurmstepd/slurmstepd_job.h b/src/slurmd/slurmstepd/slurmstepd_job.h index dfcae09ae5109c62ae51168b2d475d537d0f4cca..5dd5a7a127a5c65e90a0d87e966f6e15424f791e 100644 --- a/src/slurmd/slurmstepd/slurmstepd_job.h +++ b/src/slurmd/slurmstepd/slurmstepd_job.h @@ -106,7 +106,7 @@ typedef struct task_info { bool exited; /* true if task has exited */ int estatus; /* this task's exit status */ - int argc; + uint32_t argc; char **argv; } slurmd_task_info_t; @@ -123,7 +123,7 @@ typedef struct slurmd_job { uint32_t job_mem; /* MB of memory reserved for the job */ uint32_t step_mem; /* MB of memory reserved for the step */ uint16_t cpus; /* number of cpus to use for this job */ - uint16_t argc; /* number of commandline arguments */ + uint32_t argc; /* number of commandline arguments */ char **env; /* job environment */ char **argv; /* job argument vector */ char *cwd; /* path to current working directory */