Skip to content

Run the file storage sample's scripts on macOS's bash 3.2 - #51

Merged
paolosalvatori merged 1 commit into
mainfrom
web-app-file-storage-macos-bash
Nov 4, 2026
Merged

paolosalvatori merged 1 commit into
mainfrom
web-app-file-storage-macos-bash

Conversation

@paolosalvatori

@paolosalvatori paolosalvatori commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

macOS ships bash 3.2 as /bin/bash. The scripts of the web-app-file-storage sample, in both its .NET and its Python version, used the ${value,,} and ${value^^} case conversions, which need bash 4. Run on a Mac the way the README says (./01-deploy-resources.sh), they failed with "bad substitution" and carried on with empty values: 00-variables.sh left the ACR name empty, so every later step addressed a registry with no name.

The repository README says the scripts run unchanged on Linux, macOS and WSL; with this change, the scripts of this sample do.

Part of SMF-1050

Changes

  • 00-variables.sh (both versions) defines two helpers, lowercase and uppercase, which convert case with tr and run on every bash, and builds ACR_NAME with lowercase.
  • 01-deploy-resources.sh, 04-push-docker-image.sh and 05-deploy-app.sh (both versions) call them where they used ${value,,} and ${value^^}: to normalize the provisioning mode and the protocol, to print the protocol, and to tag and push the image.
  • The shebangs stay #!/bin/bash, and nothing else changes. The other samples still use the bash 4 forms; this pull request covers only this sample.

Tests

  • With GNU bash 3.2.57, the version macOS ships, built from the GNU source after checking its signature: 00-variables.sh from main fails with ${PREFIX,,}acr${SUFFIX,,}: bad substitution and leaves ACR_NAME empty; the one from this branch sets localacrtest, as bash 5 does. Every script of the sample, both cluster scripts and tests/test-vacation-planner.sh parse under bash 3.2.
  • Both versions end to end against LocalStack for Azure (localstack/localstack-azure:latest), static provisioning over SMB, with every script run by bash 3.2: scripts/01-system-assigned-managed-identity.sh, the sample's 01, 02, 04 and 05 scripts, and tests/test-vacation-planner.sh. Python: cluster in 342 s, deploy in 148 s, test passed. .NET: cluster in 343 s, deploy in 110 s, test passed. No "bad substitution" in any log; the scripts printed [localacrtest] and provisioning over [SMB].
  • The CI of this pull request runs both versions on Linux, with bash 5.
  • Not run: on a Mac, or against Azure.

🤖 Generated with Claude Code

macOS ships bash 3.2 as /bin/bash. The ${value,,} and ${value^^} expansions need bash 4: under bash 3.2
they fail with "bad substitution" and the scripts carry on with empty values, for example an empty ACR
name. The .NET and Python scripts now convert case with two small helpers in 00-variables.sh, lowercase
and uppercase, which use tr and run on every bash.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 4, 2026 08:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the Bash 3.2 compatibility changes in the file-storage sample scripts.

No open issues 🎉

What changed in this PR

This PR removes Bash 4-only case conversions from the .NET and Python file-storage sample scripts, making those conversions compatible with macOS’s Bash 3.2.

Changes:

  • Add tr-based lowercase and uppercase helpers and use them to construct ACR names.
  • Replace case conversions in provisioning options, protocol messages, and Docker image tagging and pushing.
  • Keep existing shebangs and limit changes to the file-storage sample.
File Description
samples/​web-app-file-storage/​python/​scripts/​05-deploy-app.sh Use the uppercase helper in the deployment message.
samples/​web-app-file-storage/​python/​scripts/​04-push-docker-image.sh Use the lowercase helper for Docker image references.
samples/​web-app-file-storage/​python/​scripts/​01-deploy-resources.sh Use helpers to normalize options and display the protocol.
samples/​web-app-file-storage/​python/​scripts/​00-variables.sh Define compatible case helpers and update ACR naming.
samples/​web-app-file-storage/​dotnet/​scripts/​05-deploy-app.sh Use the uppercase helper in the deployment message.
samples/​web-app-file-storage/​dotnet/​scripts/​04-push-docker-image.sh Use the lowercase helper for Docker image references.
samples/​web-app-file-storage/​dotnet/​scripts/​01-deploy-resources.sh Use helpers to normalize options and display the protocol.
samples/​web-app-file-storage/​dotnet/​scripts/​00-variables.sh Define compatible case helpers and update ACR naming.

Review effort: Balanced

@paolosalvatori
paolosalvatori merged commit 18a76eb into main Nov 4, 2026
5 checks passed
@paolosalvatori
paolosalvatori deleted the web-app-file-storage-macos-bash branch November 4, 2026 08:47
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.

2 participants