help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bash -x doesn't always show "exec"


From: John Hanks
Subject: bash -x doesn't always show "exec"
Date: Tue, 23 Mar 2021 18:00:41 -0500

Hi,

I'm troubleshooting some bash scripts and have an issue where when ran from
a normal ssh session the scripts work fine, but when ran from with a Slurm
managed job they fail. I traced this down to a point in the code where they
fork directions at runtime. The script has at the end:

set -o pipefail execfail
exec bats-exec-suite "${flags[@]}" "${filenames[@]}" |
bats_test_count_validator | "bats-format-${formatter}"
"${formatter_flags[@]}"

When executed on a vanilla ssh session connection it works and does this:

+ 22:38:48 /home/prd_rdip_mfish/local/libexec/bats-core/bats.debug:L213:  -
[3,0,0][[ -d
/hpc/projects/stv/mFish/UAT/dva_mfish/mfish/etl/tests/imports.bats ]]
+ 22:38:48 /home/prd_rdip_mfish/local/libexec/bats-core/bats.debug:L226:  -
[3,0,1]filenames+=("$filename")
+ 22:38:48 /home/prd_rdip_mfish/local/libexec/bats-core/bats.debug:L231:  -
[3,0,0]source /home/prd_rdip_mfish/local/lib/bats-core/validator.bash
+ 22:38:48 /home/prd_rdip_mfish/local/libexec/bats-core/bats.debug:L233:  -
[3,0,0]set -o pipefail execfail
+ 22:38:48 /home/prd_rdip_mfish/local/libexec/bats-core/bats.debug:L234:  -
[3,0,0]exec bats-exec-suite -x
/hpc/projects/stv/mFish/UAT/dva_mfish/mfish/etl/tests/imports.bats
+ 22:38:48 /home/prd_rdip_mfish/local/libexec/bats-core/bats.debug:L234:  -
[3,0,0]bats-format-pretty
+ 22:38:48 /home/prd_rdip_mfish/local/libexec/bats-core/bats.debug:L234:  -
[3,0,0]bats_test_count_validator

But within a slurm job (whether interactive or a batch job, think with a
pty or without one, either way same failure):

+ 22:37:17 /home/prd_rdip_mfish/local/libexec/bats-core/bats.debug:L213:  -
[3,0,0][[ -d
/hpc/projects/stv/mFish/UAT/dva_mfish/mfish/etl/tests/imports.bats ]]
+ 22:37:17 /home/prd_rdip_mfish/local/libexec/bats-core/bats.debug:L226:  -
[3,0,1]filenames+=("$filename")
+ 22:37:17 /home/prd_rdip_mfish/local/libexec/bats-core/bats.debug:L231:  -
[3,0,0]source /home/prd_rdip_mfish/local/lib/bats-core/validator.bash
+ 22:37:17 /home/prd_rdip_mfish/local/libexec/bats-core/bats.debug:L233:  -
[3,0,0]set -o pipefail execfail
+ 22:37:17 /home/prd_rdip_mfish/local/libexec/bats-core/bats.debug:L234:  -
[3,0,0]bats-format-pretty
+ 22:37:17 /home/prd_rdip_mfish/local/libexec/bats-core/bats.debug:L234:  -
[3,0,0]bats_test_count_validator

I've looked at diffs of "env" and "set" between these sessions, can't find
any significant difference between them. All files referenced are
available. shopt settings are identical on both. I can't find any reason
they behave differently at this point, but they do.

Any answers, advice or pointers to where I should be looking are
appreciated. I'm really confused as to how "bash -x" output can differ for
these lines of code. The Google queries I've come up with return a lot of
hits, but the relevant terms are just too generic to narrow things down to
a useful set.

Best,

griznog


reply via email to

[Prev in Thread] Current Thread [Next in Thread]