Skip to content

Added the ability to escape the '$' character before '(' as "$$" which will allow using the "$()" and "$(())" expressions of bash, sh, and other shells.#467

Merged
grafikrobot merged 3 commits into
bfgroup:mainfrom
ivan2201:main
Nov 24, 2025

Conversation

@ivan2201

@ivan2201 ivan2201 commented Oct 5, 2025

Copy link
Copy Markdown
Contributor

I implemented the ability to escape the "$" character as "$$" if it appears before the "(" character.
More precisely, every "$$" sequence preceding the "(" character will be treated as an escaped '$' character.

I proposed this escaping method based on writing SHELL scripts in Makefiles.
This allows the use of SHELL "$(...)" or "$((...))" expressions within bjam expressions such as "actions { ... }" or "[ SHELL ... ]".

It's changing "$$(" interpreting, for example b2 rule:
rule test {
value = zero ;
echo $$$$(value) ;
}
Old execution result:
$$$zero
New execution result:
$$(value)

However, I did not find any use of the "$$(" sequence in the b2 files in the boost develop branch.

Proposed changes

Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.

Types of changes

What types of changes does your code introduce?

Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Documentation content changes
  • Other (please describe):

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I searched the discussions
  • I searched the closed and open issues
  • I read the contribution guidelines
  • I added myself to the copyright attributions for significant changes
  • I checked that tests pass locally with my changes
  • I added tests that prove my fix is effective or that my feature works
  • I added necessary documentation (if appropriate)

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@ivan2201

ivan2201 commented Oct 9, 2025

Copy link
Copy Markdown
Contributor Author

It doesn't look like the pipeline error was related to my changes:

failure - unhandled exception {{{
b"PermissionError - [Errno 13] The process cannot access the file because it is being used by another process: 'C:\\\\Users\\\\VSSADM~1\\\\AppData\\\\Local\\\\Temp\\\\b2os2k7o_5'"
}}}
stacktrace {{{
b'at line 107 of D:\\a\\1\\s\\test\\test_all.py (run_tests)\n'
}}}

Is "Windows VS 2022 Test" pipeline can be restarted?

https://dev.azure.com/bfgroup/B2/_build/results?buildId=1544&view=logs&j=9d9f1044-8565-506c-f0ef-27b57a5df325&t=c8d70bf3-aa99-5445-a6f8-5caa8630d218&l=151

…-length "$$" character sequence ends with the "$(" sequence or the '(' character.

This allows the use of SHELL $(...) or $((...)) expressions within bjam expressions such as "actions { ... }" or "[ SHELL ... ]".
@grafikrobot grafikrobot self-assigned this Nov 23, 2025
@grafikrobot grafikrobot moved this to 🏗 In progress in BFG Tasks Nov 23, 2025
@grafikrobot grafikrobot merged commit 45a76a1 into bfgroup:main Nov 24, 2025
116 checks passed
@github-project-automation github-project-automation Bot moved this from 🏗 In progress to ✅ Done in BFG Tasks Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants