Remove escaping of backslashes to support literal ${var} #218
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
THIS IS A BACKWARDS INCOMPATIBLE CHANGE. THE PR IS IN DRAFT MODE TO SEE IF IT
ACTUALLY AFFECTS REAL USE CASES AND TO THINK ABOUT MAKING IT OPT IN.
Automatic escaping of backslashes made it impossible to write
${var}
to aU-Boot variable. When doing this, you have to remember that
fwup
evaluatesvariable substitution twice - once when making the .fw file and once when
applying it. You obviously have to escape the
$
when creating the .fw file.That made sense. Then to survive the apply step, you'd think that you could
double escape the
$
. You'd be wrong, though, sincefwup
was escaping thebackslashes that you were adding. Therefore, the variable substitution was
guaranteed to happen since you couldn't double escape a
$
.Amazingly, this behavior was never tested in the regression tests. When you run
into it, it's weird enough to be pretty confusing, imho. Hopefully that and how
rare should have been in real uses cases makes this something that no one
actually did.
This changes string processing to not automatically escape backslashes so that
it is possible to escape a
$
through to the end. This allows you to write aU-Boot environment variable with a
${var}
in it. This locks down stringprocessing behaviors by adding unit tests.