Problem with windows username that sometimes end in $#3
Conversation
I had a problem where on some windows users their AS_USER_NAME ends in a $ so this snippet fixes that.
There was a problem hiding this comment.
Pull request overview
This PR updates the RevInfo.var generation script to sanitize the AS_USER_NAME value before writing it as the builder string, addressing cases where Windows usernames may end with a $.
Changes:
- Modify the
builderfield generation to strip$characters from the username before writingRevInfo.var.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| buildDate : STRING[80] := '$(date +"%Y-%m-%d %H:%M:%S %z")'; | ||
| buildConfiguration : STRING[80] := '${AS_CONFIGURATION}'; | ||
| builder : STRING[80] := '${AS_USER_NAME}'; | ||
| builder : STRING[80] := '$(echo "${AS_USER_NAME}" | sed 's/\$//g')'; |
There was a problem hiding this comment.
The quoting in this line is broken: the outer single-quoted string for the .var value is terminated by the inner sed 's/\$//g', which will cause a shell syntax error and/or generate an invalid RevInfo.var. Use a quoting-safe approach (e.g., shell parameter expansion like ${AS_USER_NAME%\$} to strip a trailing $, or keep sed but quote it with double-quotes and escape $). Also consider stripping only a trailing $ rather than removing all $ characters.
| builder : STRING[80] := '$(echo "${AS_USER_NAME}" | sed 's/\$//g')'; | |
| builder : STRING[80] := '${AS_USER_NAME%\$}'; |
What:
changed to manipulate the string before adding it to the file.
Why:
Problem occurs when the username has a $ in it.