Bug #19173
Updated by Nicolas CHARLES over 3 years ago
Brace yourself for this bug description.
Using multiple "\" in a class parameter leads to inconsitent behaviour
h2. Technique editor
|_.Number of \|_.Value|_.File edited|_.State of edition|_.Report|_.State of report|
| 1 | /tmp/escapedfilebyfileonlyone\s | /tmp/escapedfilebyfileonlyone\s | OK | /tmp/escapedfilebyfileonlyone\s | OK |
| 2 | /tmp/escapedfilebyfiletwice\\s | /tmp/escapedfilebyfiletwice\s | NOK | /tmp/escapedfilebyfiletwice\s | NOK |
| 3 | /tmp/escapedfilebyfile\\\s | /tmp/escapedfilebyfile\\s | NOK | /tmp/escapedfilebyfile\\s | NOK |
and you get the idea
h2. Rudder built-in techniques
Used with Technique Check generic file content
/tmp/file\\\sthrice
executing command
<pre>
sed -i 's#next if .*issuer_cn.*Let.*Encrypt.*#next if ($info->{\x27issuer_o\x27} !~ /Let\x27s\s\\\s+Encrypt/i);#g'
</pre>
breaks reporting, as it is seen as missing, and there is an unexpected reports with same value but a \ less
Error is around the \\\s
Missing report is
<pre>
\s\\\sEncryp
</pre>
and unexpected is
<pre>
\s\\sEncryp
</pre>
It's because the evaluation of the command replaces \\ by \, resulting in a bad report
h3. Workaround
Note that using the generic method @File replace lines@ with parameters:
<pre>
Line: (\s+next if \(\$info->){'issuer_cn'}( !~ \/Let's\\\\s\\+Encrypt\/i\);)
Replacement: ${match.1}{'issuer_cn'}${match.2}
</pre>
works as expected.