Skip to content

Fix Linux/bash compatibility in sequential tests#12

Merged
jnasbyupgrade merged 5 commits intoPostgres-Extensions:masterfrom
jnasbyupgrade:linux-compat
Mar 25, 2026
Merged

Fix Linux/bash compatibility in sequential tests#12
jnasbyupgrade merged 5 commits intoPostgres-Extensions:masterfrom
jnasbyupgrade:linux-compat

Conversation

@jnasbyupgrade
Copy link
Copy Markdown
Contributor

Related pgxntool PR: Postgres-Extensions/pgxntool#23

Changes

03-setup-final.bats: portable sed + clean repo state

  • Replace BSD-only sed -i '' with portable sed -i.bak + rm; sed -i '' is valid on GNU sed but has different argument parsing — using -i.bak works on both
  • Commit deps.sql after updating so the repo stays clean on subsequent test runs (eliminates the stale skip "deps.sql already updated")

04-pgtle.bats: portable stat for mtime checks

  • Replace BSD-only stat -f %m (primary) with GNU-first stat -c %Y with BSD fallback
  • Fixes mtime-based rebuild detection tests on Linux

Shebang portability (scripts)

  • Replace #!/bin/bash with #!/usr/bin/env bash in bin/create-worktree.sh and .claude/skills/ scripts

jnasbyupgrade and others added 4 commits March 18, 2026 18:07
Delete `pgxntool-test.source` which was left behind when .source
support was removed in c30cdc5. Remove the "can copy expected output
file to test/output" test from `make-test.bats` that referenced it.

Changes only in pgxntool-test. No related changes in pgxntool.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- `03-setup-final.bats`: replace BSD-only `sed -i ''` with portable
  `sed -i.bak` + `rm`; commit `deps.sql` after updating so repo stays
  clean on subsequent runs (removes stale skip)
- `04-pgtle.bats`: use GNU-first `stat -c %Y` with BSD `stat -f %m`
  fallback for mtime checks

Companion to pgxntool d472ba3

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Avoids hardcoding /bin/bash which breaks on systems where bash lives
elsewhere (some BSDs, NixOS, Homebrew on macOS). Documents the rule
in CLAUDE.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jnasbyupgrade added a commit to Postgres-Extensions/pgxntool that referenced this pull request Mar 25, 2026
Related pgxntool-test PR:
Postgres-Extensions/pgxntool-test#12

## Changes

**bash 3.2 syntax fix (`pgtle.sh`)**
- Replace `${#ARRAY[@]:-0}` with `${#ARRAY[@]}` throughout `pgtle.sh`
- `${#ARRAY[@]:-0}` is a fatal syntax error ("bad substitution") in bash
3.2 — the `:-` default modifier cannot be applied to an array length
expression
- `${#ARRAY[@]}` correctly returns 0 for empty arrays in all bash
versions

**DOCS deduplication (`base.mk`)**
- Deduplicate `DOCS` when adding generated HTML, preventing duplicate
install entries when HTML is already included by the wildcard

**Shebang portability (all shell scripts)**
- Replace `#!/bin/bash` with `#!/usr/bin/env bash` in `pgtle.sh`,
`build_meta.sh`, and `lib.sh`
- `/bin/bash` fails on systems where bash lives elsewhere (some BSDs,
NixOS, Homebrew on macOS)
@jnasbyupgrade jnasbyupgrade merged commit fe06d23 into Postgres-Extensions:master Mar 25, 2026
jnasbyupgrade added a commit to jnasbyupgrade/pgxntool-test that referenced this pull request Mar 25, 2026
Resolve conflicts from upstream's Linux/bash compatibility fix (Postgres-Extensions#12):
- CLAUDE.md: keep both Template Requirements and Shell Script Standards sections
- .claude/settings.json: merge permissions (add run-tests.sh, Skill(test);
  keep make/utility permissions; drop duplicates)
- 03-setup-final.bats: keep setup_file() approach for deps.sql update,
  fix portability (sed -i.bak instead of BSD-only sed -i '')
- make-test.bats: adopt upstream's simplified version (pgxntool-test.source
  deleted, no longer needed)
@jnasbyupgrade jnasbyupgrade deleted the linux-compat branch April 6, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant