Bug #5283
closedUnhelpful feedback with special string template characters
Description
Hi,
I've tried to use the following promise:
vars: "foo[BAR]" string => "$(const.dollar)([ -f /baz ] && /bin/xargs -a /baz || :)"; files: "/Kegeruneku" edit_line => set_quoted_values("pony.foo");
to insert "$([ -f /baz ] && /bin/xargs -a /baz || :)" in a file.
The policy regeneration failed with a useless error message in the web ui, showing basically an invalid syntax message for all characters in the technique.
Now I know that "&" must be escaped to "\&", but rudder didn't help me. :P
Thanks.
The java exception in the webapp log is huge:
problem parsing template 'anonymous' line 45:18: expecting '<', found 'F' at com.normation.stringtemplate.language.NormationAmpersandTemplateLexer.nextToken(NormationAmpersandTemplateLexer.java:144) at antlr.TokenBuffer.fill(TokenBuffer.java:69) at antlr.TokenBuffer.LA(TokenBuffer.java:80) at antlr.LLkParser.LA(LLkParser.java:52) at org.antlr.stringtemplate.language.TemplateParser.template(TemplateParser.java:103) at org.antlr.stringtemplate.StringTemplate.breakTemplateIntoChunks(StringTemplate.java:850) at org.antlr.stringtemplate.StringTemplate.setTemplate(StringTemplate.java:441) at org.antlr.stringtemplate.StringTemplate.<init>(StringTemplate.java:299) at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl$$anonfun$writePromisesFiles$1.apply(Cf3PromisesFileWriterServiceImpl.scala:199) at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl$$anonfun$writePromisesFiles$1.apply(Cf3PromisesFileWriterServiceImpl.scala:196) at scala.collection.immutable.HashSet$HashSet1.foreach(HashSet.scala:153) at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:306) at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl.writePromisesFiles(Cf3PromisesFileWriterServiceImpl.scala:196) [...] problem parsing template 'anonymous' line 45:18: expecting '<', found 'F' at com.normation.stringtemplate.language.NormationAmpersandTemplateLexer.nextToken(NormationAmpersandTemplateLexer.java:144) at antlr.TokenBuffer.fill(TokenBuffer.java:69) at antlr.TokenBuffer.LA(TokenBuffer.java:80) at antlr.LLkParser.LA(LLkParser.java:52) at org.antlr.stringtemplate.language.TemplateParser.template(TemplateParser.java:103) at org.antlr.stringtemplate.StringTemplate.breakTemplateIntoChunks(StringTemplate.java:850) at org.antlr.stringtemplate.StringTemplate.setTemplate(StringTemplate.java:441) at org.antlr.stringtemplate.StringTemplate.<init>(StringTemplate.java:299) at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl$$anonfun$writePromisesFiles$1.apply(Cf3PromisesFileWriterServiceImpl.scala:199) at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl$$anonfun$writePromisesFiles$1.apply(Cf3PromisesFileWriterServiceImpl.scala:196) at scala.collection.immutable.HashSet$HashSet1.foreach(HashSet.scala:153) at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:306) at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl.writePromisesFiles(Cf3PromisesFileWriterServiceImpl.scala:196) at com.normation.rudder.services.policies.RudderCf3PromisesFileWriterServiceImpl$$anonfun$com$normation$rudder$services$policies$RudderCf3PromisesFileWriterServiceImpl$$prepareRulesForAgents$2$$anonfun$apply$12.apply(RudderPromiseWriterServiceImpl.scala:198) at com.normation.rudder.services.policies.RudderCf3PromisesFileWriterServiceImpl$$anonfun$com$normation$rudder$services$policies$RudderCf3PromisesFileWriterServiceImpl$$prepareRulesForAgents$2$$anonfun$apply$12.apply(RudderPromiseWriterServiceImpl.scala:197) at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772) at scala.collection.immutable.Map$Map4.foreach(Map.scala:181) at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771) at com.normation.rudder.services.policies.RudderCf3PromisesFileWriterServiceImpl$$anonfun$com$normation$rudder$services$policies$RudderCf3PromisesFileWriterServiceImpl$$prepareRulesForAgents$2.apply(RudderPromiseWriterServiceImpl.scala:197) [...] problem parsing template 'anonymous' line 45:18: expecting '<', found 'F' at com.normation.stringtemplate.language.NormationAmpersandTemplateLexer.nextToken(NormationAmpersandTemplateLexer.java:144) at antlr.TokenBuffer.fill(TokenBuffer.java:69) at antlr.TokenBuffer.LA(TokenBuffer.java:80) at antlr.LLkParser.LA(LLkParser.java:52) at org.antlr.stringtemplate.language.TemplateParser.template(TemplateParser.java:103) at org.antlr.stringtemplate.StringTemplate.breakTemplateIntoChunks(StringTemplate.java:850) at org.antlr.stringtemplate.StringTemplate.setTemplate(StringTemplate.java:441) at org.antlr.stringtemplate.StringTemplate.<init>(StringTemplate.java:299) at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl$$anonfun$writePromisesFiles$1.apply(Cf3PromisesFileWriterServiceImpl.scala:199) at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl$$anonfun$writePromisesFiles$1.apply(Cf3PromisesFileWriterServiceImpl.scala:196) at scala.collection.immutable.HashSet$HashSet1.foreach(HashSet.scala:153) at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:306) at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl.writePromisesFiles(Cf3PromisesFileWriterServiceImpl.scala:196) [...] problem parsing template 'anonymous' line 45:18: expecting '<', found 'F' at com.normation.stringtemplate.language.NormationAmpersandTemplateLexer.nextToken(NormationAmpersandTemplateLexer.java:144) at antlr.TokenBuffer.fill(TokenBuffer.java:69) at antlr.TokenBuffer.LA(TokenBuffer.java:80) at antlr.LLkParser.LA(LLkParser.java:52) at org.antlr.stringtemplate.language.TemplateParser.template(TemplateParser.java:103) at org.antlr.stringtemplate.StringTemplate.breakTemplateIntoChunks(StringTemplate.java:850) at org.antlr.stringtemplate.StringTemplate.setTemplate(StringTemplate.java:441) at org.antlr.stringtemplate.StringTemplate.<init>(StringTemplate.java:299) at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl$$anonfun$writePromisesFiles$1.apply(Cf3PromisesFileWriterServiceImpl.scala:199) at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl$$anonfun$writePromisesFiles$1.apply(Cf3PromisesFileWriterServiceImpl.scala:196) at scala.collection.immutable.HashSet$HashSet1.foreach(HashSet.scala:153) at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:306) at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl.writePromisesFiles(Cf3PromisesFileWriterServiceImpl.scala:196) [...]
Updated by François ARMAND over 10 years ago
Thank you, that is a really nice stacktrace. I'm wondering why the world don't like java so much, it is really trying hard to be friendly.
So, there is two problem:
- we never ever want a Rudder user to see a stacktrace. We are trying to keep them happy, stacktrace does not fullfill that job.
=> handle that kind of error in a nice message that helps the user.
- we should NOT make standard CFEngine not working on Rudder. That's just the worst surprise effect possible. As an Rudder user, I want to be able to just copy/paste my working CFEngine promise to start a Technique. This is tracked in #5284.
Updated by Benoît PECCATTE over 9 years ago
- Category set to Web - Config management
- Target version set to 2.10.14
Updated by Vincent MEMBRÉ over 9 years ago
- Target version changed from 2.10.14 to 2.10.15
Updated by Vincent MEMBRÉ over 9 years ago
- Target version changed from 2.10.15 to 2.10.16
Updated by Vincent MEMBRÉ over 9 years ago
- Target version changed from 2.10.16 to 2.10.17
Updated by Vincent MEMBRÉ over 9 years ago
- Target version changed from 2.10.17 to 2.10.18
Updated by Vincent MEMBRÉ about 9 years ago
- Target version changed from 2.10.18 to 2.10.19
Updated by Vincent MEMBRÉ about 9 years ago
- Target version changed from 2.10.19 to 2.10.20
Updated by Vincent MEMBRÉ about 9 years ago
- Target version changed from 2.10.20 to 277
Updated by Vincent MEMBRÉ about 9 years ago
- Target version changed from 277 to 2.11.18
Updated by Vincent MEMBRÉ almost 9 years ago
- Target version changed from 2.11.18 to 2.11.19
Updated by Vincent MEMBRÉ almost 9 years ago
- Target version changed from 2.11.19 to 2.11.20
Updated by Vincent MEMBRÉ over 8 years ago
- Target version changed from 2.11.20 to 2.11.21
Updated by Vincent MEMBRÉ over 8 years ago
- Target version changed from 2.11.21 to 2.11.22
Updated by Vincent MEMBRÉ over 8 years ago
- Target version changed from 2.11.22 to 2.11.23
Updated by Vincent MEMBRÉ over 8 years ago
- Target version changed from 2.11.23 to 2.11.24
Updated by Vincent MEMBRÉ over 8 years ago
- Target version changed from 2.11.24 to 308
Updated by Vincent MEMBRÉ over 8 years ago
- Target version changed from 308 to 3.1.14
Updated by Vincent MEMBRÉ about 8 years ago
- Target version changed from 3.1.14 to 3.1.15
Updated by Vincent MEMBRÉ about 8 years ago
- Target version changed from 3.1.15 to 3.1.16
Updated by Vincent MEMBRÉ about 8 years ago
- Target version changed from 3.1.16 to 3.1.17
Updated by Vincent MEMBRÉ about 8 years ago
- Target version changed from 3.1.17 to 3.1.18
Updated by Vincent MEMBRÉ almost 8 years ago
- Target version changed from 3.1.18 to 3.1.19
Updated by François ARMAND over 7 years ago
- Description updated (diff)
- Severity set to Minor - inconvenience | misleading | easy workaround
- User visibility set to Infrequent - complex configurations | third party integrations
- Priority set to 0
Updated by Vincent MEMBRÉ over 7 years ago
- Target version changed from 3.1.19 to 3.1.20
Updated by Vincent MEMBRÉ over 7 years ago
- Target version changed from 3.1.20 to 3.1.21
Updated by François ARMAND over 7 years ago
- Severity changed from Minor - inconvenience | misleading | easy workaround to Major - prevents use of part of Rudder | no simple workaround
- Priority changed from 0 to 21
Updated by Vincent MEMBRÉ over 7 years ago
- Target version changed from 3.1.21 to 3.1.22
Updated by Vincent MEMBRÉ over 7 years ago
- Target version changed from 3.1.22 to 3.1.23
Updated by Vincent MEMBRÉ over 7 years ago
- Target version changed from 3.1.23 to 3.1.24
- Priority changed from 34 to 35
Updated by Vincent MEMBRÉ about 7 years ago
- Target version changed from 3.1.24 to 3.1.25
Updated by Vincent MEMBRÉ about 7 years ago
- Target version changed from 3.1.25 to 387
Updated by Vincent MEMBRÉ about 7 years ago
- Target version changed from 387 to 4.1.10
- Priority changed from 35 to 36
Updated by Vincent MEMBRÉ almost 7 years ago
- Target version changed from 4.1.10 to 4.1.11
Updated by Vincent MEMBRÉ over 6 years ago
- Target version changed from 4.1.11 to 4.1.12
- Priority changed from 36 to 37
Updated by Vincent MEMBRÉ over 6 years ago
- Target version changed from 4.1.12 to 4.1.13
Updated by Vincent MEMBRÉ over 6 years ago
- Target version changed from 4.1.13 to 4.1.14
- Priority changed from 37 to 38
Updated by Benoît PECCATTE over 6 years ago
- Target version changed from 4.1.14 to 4.1.15
Updated by Vincent MEMBRÉ about 6 years ago
- Target version changed from 4.1.15 to 4.1.16
Updated by Vincent MEMBRÉ about 6 years ago
- Target version changed from 4.1.16 to 4.1.17
- Priority changed from 38 to 39
Updated by Vincent MEMBRÉ about 6 years ago
- Target version changed from 4.1.17 to 4.1.18
Updated by Vincent MEMBRÉ almost 6 years ago
- Target version changed from 4.1.18 to 4.1.19
Updated by Alexis Mousset almost 6 years ago
- Target version changed from 4.1.19 to 4.1.20
Updated by Alexis Mousset over 5 years ago
- Target version changed from 4.1.20 to 588
- Priority changed from 39 to 41
Updated by Nicolas CHARLES over 5 years ago
- Target version changed from 588 to 5.0.13
- Severity changed from Major - prevents use of part of Rudder | no simple workaround to Minor - inconvenience | misleading | easy workaround
- Priority changed from 41 to 22
this is most likely still the case, but we do have a linter for that #2933
Updated by Nicolas CHARLES over 5 years ago
- Related to Bug #2933: The use of "&&" prevent Rudder to generate promises if not escaped, then a test in the techniques is needed added
Updated by Vincent MEMBRÉ over 5 years ago
- Target version changed from 5.0.13 to 5.0.14
Updated by Vincent MEMBRÉ about 5 years ago
- Target version changed from 5.0.14 to 5.0.15
Updated by François ARMAND about 5 years ago
- Effort required set to Very Small
- Priority changed from 22 to 50
We should just catch that exception and write a nice message like "Perhaps you forgot to escape an &" (and then the exception message)
Updated by François ARMAND about 5 years ago
- Status changed from New to Resolved
It now reports:
problem parsing template 'anonymous' line 1:51: unexpected char: '&'
Which seems perfectly fine.