Skip to content

Commit 756a030

Browse files
authored
Merge pull request #5161 from grondo/fix-shell-mustache-sym
shell: add missing `flux_` prefix to `shell_mustache_render(3)`
2 parents 1e66f16 + 8e1acab commit 756a030

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

src/shell/output.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ shell_output_setup_type_file (struct shell_output *out,
814814
return -1;
815815
}
816816

817-
if (!(ofp->path = shell_mustache_render (out->shell, path)))
817+
if (!(ofp->path = flux_shell_mustache_render (out->shell, path)))
818818
return -1;
819819

820820
if (flux_shell_getopt_unpack (out->shell, "output",

src/shell/shell.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -980,8 +980,13 @@ static int get_protocol_fd (int *pfd)
980980
return 0;
981981
}
982982

983-
char *shell_mustache_render (flux_shell_t *shell, const char *fmt)
983+
char *flux_shell_mustache_render (flux_shell_t *shell, const char *fmt)
984984
{
985+
if (!shell) {
986+
/* Note: shell->mr and fmt checked in mustache_render */
987+
errno = EINVAL;
988+
return NULL;
989+
}
985990
return mustache_render (shell->mr, fmt);
986991
}
987992

@@ -1537,7 +1542,8 @@ static int frob_command (flux_shell_t *shell, flux_cmd_t *cmd)
15371542
for (int i = 0; i < flux_cmd_argc (cmd); i++) {
15381543
if (strstr (flux_cmd_arg (cmd, i), "{{")) { // possibly mustachioed
15391544
char *narg;
1540-
if (!(narg = shell_mustache_render (shell, flux_cmd_arg (cmd, i)))
1545+
if (!(narg = flux_shell_mustache_render (shell,
1546+
flux_cmd_arg (cmd, i)))
15411547
|| flux_cmd_argv_insert (cmd, i, narg) < 0) {
15421548
free (narg);
15431549
return -1;

src/shell/shell.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ int flux_shell_log_setlevel (int level, const char *dest);
403403

404404
/* Expand mustache template. Caller must free the result.
405405
*/
406-
char *shell_mustache_render (flux_shell_t *shell, const char *fmt);
406+
char *flux_shell_mustache_render (flux_shell_t *shell, const char *fmt);
407407

408408

409409
#ifdef __cplusplus

t/shell/plugins/invalid-args.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,11 @@ static int shell_cb (flux_plugin_t *p,
194194
ok (flux_shell_task_next (NULL) == NULL && errno == EINVAL,
195195
"flux_shell_task_next (NULL) returns EINVAL");
196196

197+
ok (flux_shell_mustache_render (NULL, NULL) == NULL && errno == EINVAL,
198+
"flux_shell_mustache_render (NULL, NULL) returns EINVAL");
199+
ok (flux_shell_mustache_render (shell, NULL) == NULL && errno == EINVAL,
200+
"flux_shell_mustache_render (shell, NULL) returns EINVAL");
201+
197202
if (strcmp (topic, "shell.init") == 0) {
198203
ok (flux_shell_current_task (NULL) == NULL && errno == EINVAL,
199204
"flux_shell_current_task with NULL shell returns EINVAL");

0 commit comments

Comments
 (0)