Skip to content

batch: Recognize the +W modifier in -T (case-sensitive lookup bug) - #9141

Open
Esteban82 wants to merge 1 commit into
masterfrom
fix-batch-modifier-W
Open

batch: Recognize the +W modifier in -T (case-sensitive lookup bug)#9141
Esteban82 wants to merge 1 commit into
masterfrom
fix-batch-modifier-W

Conversation

@Esteban82

@Esteban82 Esteban82 commented Aug 24, 2026

Copy link
Copy Markdown
Member

Description of proposed changes

batch's -T option documents +W as a modifier but this doesn't work. I got this error ERROR: No jobs specified! - exiting.

Fix: add W to both separator strings ("psw""pswW") so it's recognized on par with the other modifiers, matching the documented behavior.

Tested with:

printf '1\tAlphaWord\tBetaWord\n' > timefile.txt

cat << 'EOF' > main.sh
gmt begin
	echo "WORD0=${BATCH_WORD0}"
	echo "WORD1=${BATCH_WORD1}"
gmt end
EOF

gmt batch main.sh -Ttimefile.txt+W -Nbugtest -V -Z

Without this fix: ERROR: No jobs specified! - exiting.
With this fix: WORD0=AlphaWord / WORD1=BetaWord

Assisted-by: Claude Sonnet 5 (extra effort)

The modifier separator list passed to gmt_first_modifier/gmt_getmodopt
in the -T parsing of batch was "psw" (all lowercase). Since strchr()
is case-sensitive, the documented +W modifier (force TAB-only word
splitting of the timefile's trailing text) could never match:
- "-T<file>+W" alone: the modifier was silently dropped with a
  warning, and "+W" ended up appended to the stored filename, so the
  timefile was never found ("No jobs specified! - exiting.").
- "-T<file>+p<n>+W" combined: parsing hit a hard
  "Unrecognized modifier +W" error.

Add 'W' to both separator strings so it is recognized alongside
p/s/w, matching what batch.rst already documents.
@Esteban82
Esteban82 requested review from a team, joa-quim and seisman August 24, 2026 02:15
@Esteban82
Esteban82 marked this pull request as ready for review August 24, 2026 02:16
@Esteban82 Esteban82 added the add-changelog Add PR to the changelog label Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add-changelog Add PR to the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant