3 ms·
Have had a similar issue when adding git revisions to YAML documents. The problem is that if a YAML parser sees a string like this: "0123e04" It interprets i
by zomglings 6y ago
Have had a similar issue when adding git revisions to YAML documents.
The problem is that if a YAML parser sees a string like this:
"0123e04"
It interprets it as a number: 123 * 10^4
Our hacky solution was to prefix the revision hashes like sha-0123e04, but still this was quite annoying.
After that experience, I have stopped using YAML for any of my own configuration. Have started preferring putting my configurations in code. And when I don't want that, have found JSON good enough for my purposes.
- deleted 6y ago[deleted]
- BlueTemplar 6y agoBut hashes are numbers, not strings, so is it really only YAML at fault ?
- zomglings 6y agoHashes are NOT numbers in base 10 scientific notation, which is how the hash that I showed you would be interpreted by YAML. The point is that this behavior is sporadic. It doesn't apply consistently across all git hashes, which is the real problem. It is easy to be caught unawares by this behavior.
- BlueTemplar 6y agoYes, I got that, but why have you declared a hash, which is a number, though a different kind of number than a base 10 scientific notation, as a string ?
- zomglings 6y agoBecause we were not using any numerical properties of the hash. We were not adding it to other hashes, seeing if it was greater than or less than other hashes, etc. Literally the only thing we were doing was passing it between shell commands, helm charts, Kubernetes deployments and then back (if we needed to debug). It sounds like you have a more attractive alternative in this case than to treat hashes as strings. Would love to hear it.
- BlueTemplar 6y agoIn the same thread : https://news.ycombinator.com/item?id=26679590 https://news.ycombinator.com/item?id=26679590 Concise encoding seems to have an hex-int type ?
- zomglings 6y agoProblem is that we were using Kubernetes + helm, which means that we were bound to whatever configuration language they use.
- BlueTemplar 6y agoSo the fault is on them.