Skip to content

Commit b4e1c07

Browse files
committed
fix(scripts): prevent octal interpretation in feature number parsing
When --number 027 was passed, printf '%03d' interpreted it as octal, converting 027 (octal) to 23 (decimal). Now forces base-10 with 10# prefix. Bug: User passes --number 027, gets feature 023 instead of 027 Root cause: printf %03d treats leading zeros as octal notation Fix: Use $((10#$BRANCH_NUMBER)) to force decimal interpretation Example: - Before: --number 027 → octal 027 → decimal 23 → feature 023 - After: --number 027 → decimal 27 → feature 027 Note: PowerShell version does not have this bug because [int] type conversion in PowerShell does not treat leading zeros as octal.
1 parent f65bf6c commit b4e1c07

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/bash/create-new-feature.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@ if [ -z "$BRANCH_NUMBER" ]; then
246246
fi
247247
fi
248248

249-
FEATURE_NUM=$(printf "%03d" "$BRANCH_NUMBER")
249+
# Force base-10 interpretation to prevent octal conversion (027 → 23)
250+
FEATURE_NUM=$(printf "%03d" "$((10#$BRANCH_NUMBER))")
250251
BRANCH_NAME="${FEATURE_NUM}-${BRANCH_SUFFIX}"
251252

252253
# GitHub enforces a 244-byte limit on branch names

0 commit comments

Comments
 (0)