Skip to content

Commit f3a8513

Browse files
gfraiteurclaude
andcommitted
Fix Unix mountpoints code to be POSIX sh-compatible.
The previous Unix mountpoints code used bash-specific features (here-string `<<<` and `read -ra` for arrays) which caused errors when Dockerfile uses `/bin/sh` instead of bash. Changed to POSIX-compliant syntax: - Use `set -- $MOUNTPOINTS` to split colon-separated paths into positional parameters - Use `$@` to iterate instead of bash arrays - Save/restore IFS properly - Works with `/bin/sh`, dash, and other minimal shells Error fixed: - `/bin/sh: 1: Syntax error: redirection unexpected` Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 8099fe6 commit f3a8513

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

DockerBuild.ps1

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -942,14 +942,17 @@ RUN if (`$env:MOUNTPOINTS) { ``
942942
}
943943
else
944944
{
945-
# Unix container (bash/sh)
945+
# Unix container (POSIX sh-compatible)
946946
$mountpointsCode = @"
947947
948948
# Create directories for mountpoints
949949
ARG MOUNTPOINTS
950950
RUN if [ -n "`$MOUNTPOINTS" ]; then \
951-
IFS=':' read -ra mounts <<< "`$MOUNTPOINTS"; \
952-
for dir in "`${mounts[@]}"; do \
951+
OLD_IFS="`$IFS"; \
952+
IFS=':'; \
953+
set -- `$MOUNTPOINTS; \
954+
IFS="`$OLD_IFS"; \
955+
for dir in "`$@"; do \
953956
if [ -n "`$dir" ]; then \
954957
echo "Creating directory `$dir."; \
955958
mkdir -p "`$dir"; \

src/PostSharp.Engineering.BuildTools/Resources/DockerBuild.ps1

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -942,14 +942,17 @@ RUN if (`$env:MOUNTPOINTS) { ``
942942
}
943943
else
944944
{
945-
# Unix container (bash/sh)
945+
# Unix container (POSIX sh-compatible)
946946
$mountpointsCode = @"
947947
948948
# Create directories for mountpoints
949949
ARG MOUNTPOINTS
950950
RUN if [ -n "`$MOUNTPOINTS" ]; then \
951-
IFS=':' read -ra mounts <<< "`$MOUNTPOINTS"; \
952-
for dir in "`${mounts[@]}"; do \
951+
OLD_IFS="`$IFS"; \
952+
IFS=':'; \
953+
set -- `$MOUNTPOINTS; \
954+
IFS="`$OLD_IFS"; \
955+
for dir in "`$@"; do \
953956
if [ -n "`$dir" ]; then \
954957
echo "Creating directory `$dir."; \
955958
mkdir -p "`$dir"; \

0 commit comments

Comments
 (0)