From a84b8b0d7d9f246b6dc49951a70d9325381758b9 Mon Sep 17 00:00:00 2001 From: "Mark A. Grondona" Date: Tue, 15 Aug 2023 16:50:04 -0700 Subject: [PATCH 1/2] flux-top: display empty title for instances that are not jobs Problem: When the flux-top(1) title generation was updated to use the idf58() convenience function in 2d2cf72, the check for FLUX_JOBID_ANY was dropped, resulting in windows titled with the F58 representation of FLUX_JOBID_ANY when flux-top(1) is connected to an instance that is not a job. This can be confusing to the user. Use an empty string for the title when connecting to an instance that does not have a Flux jobid. Fixes #5392 --- src/cmd/top/top.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/top/top.c b/src/cmd/top/top.c index 9d1e7511135e..3608a801e452 100644 --- a/src/cmd/top/top.c +++ b/src/cmd/top/top.c @@ -226,7 +226,7 @@ static flux_jobid_t get_jobid (flux_t *h) static char * build_title (struct top *top, const char *title) { if (!title) - title = idf58 (top->id); + title = top->id == FLUX_JOBID_ANY ? "" : idf58 (top->id); return strdup (title); } From c80a8a20c7f1cd82579141b41d3f348e62efcf53 Mon Sep 17 00:00:00 2001 From: "Mark A. Grondona" Date: Tue, 15 Aug 2023 17:03:17 -0700 Subject: [PATCH 2/2] testsuite: ensure flux-top(1) doesn't display FLUX_JOBID_ANY title Problem: No tests in the testsuite ensure that flux-top(1) does not display the F58 representation of FLUX_JOBID_ANY as the window title when connected to an instance that is not a Flux job. Add a simple test that verifies FLUX_JOBID_ANY does not appear as the flux-top(1) title. --- t/t2801-top-cmd.t | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/t/t2801-top-cmd.t b/t/t2801-top-cmd.t index 7fb469f5cdb8..9c9813524fcb 100755 --- a/t/t2801-top-cmd.t +++ b/t/t2801-top-cmd.t @@ -61,6 +61,13 @@ test_expect_success 'flux-top summary shows no jobs initially' ' grep "0 running" nojobs.out && grep "0 failed" nojobs.out ' +# Note: jpXCZedGfVQ is the base58 representation of FLUX_JOBID_ANY. We +# grep for this value without f or ƒ in case build environment influences +# presence of one of the other. +# +test_expect_success 'flux-top does not display FLUX_JOBID_ANY jobid in title' ' + test_must_fail grep jpXCZedGfVQ nojobs.out +' test_expect_success 'run a test job to completion' ' flux submit --wait -n1 flux start /bin/true >jobid && job_list_wait_state $(cat jobid) INACTIVE