geofffranks / spruce

A BOSH template merge tool
MIT License
426 stars 77 forks source link

spruce merge removes underscores (during grab) #358

Open matthewcosgrove opened 2 years ago

matthewcosgrove commented 2 years ago

Some old scripts using "spruce grab" just encountered a config with underscores for the first time where spruce just removed them and it causes the script to fail

Re-produced in the playground here when doing grab: https://play.spruce.cf/#bc2194107376bb46e672763321d0e896

Then noticed it is actually happening during the merge: https://play.spruce.cf/#dcb7aac2b37604ff4930e36c84726812

Is this expected behaviour? Any workarounds?

geofffranks commented 2 years ago

10_0_0_1 is actually a valid yaml number (underscores can be used instead of commas). If you quote the value, this issue should go away:

https://play.spruce.cf/#8a31fce07eb472288502aaee8d41461f

sorenisanerd commented 2 years ago

It's part of the YAML spec: https://yaml.org/type/int.html

It's surprisingly common. Java, for one, does the same thing: https://docs.oracle.com/javase/7/docs/technotes/guides/language/underscores-literals.html