jsonnet icon indicating copy to clipboard operation
jsonnet copied to clipboard

std.rstripChars functionality broken in v0.19.1

Open niels-s opened this issue 2 years ago • 2 comments

We tried to upgrade from 0.18.0 to 0.19.1, but we stumbled on a regression, it seems, in the std.rstripChars function.

When we try to remove a newline from our templated string

{
test: std.rstripChars(|||
               Made with ❤️ and [Grafonnet](https://github.com/grafana/grafonnet-lib). [Contribute to this dashboard on GitHub.com](https://github.com/onesignal/infra/blob/main/dashboards/%(filePath)s)
            ||| % { filePath: 'billing/main.dashboard.jsonnet' }, '\n')
}

The result in version 0.18.0 is correct:

{
   "test": "Made with ❤️ and [Grafonnet](https://github.com/grafana/grafonnet-lib). [Contribute to this dashboard on GitHub.com](https://github.com/onesignal/infra/blob/main/dashboards/billing/main.dashboard.jsonnet)"
}

However, after upgrading to version 0.19.1, this is the result:

{
   "test": "Made with ❤️ and [Grafonnet](https://github.com/grafana/grafonnet-lib). [Contribute to this dashboard on GitHub.com](https://github.com/onesignal/infra/blob/main/dashboards/billing/main.dashboard.json"
}

Another conclusion is the first link we add also seems to influence the result. If we compile

{
test: std.rstripChars(|||
              [Contribute to this dashboard on GitHub.com](https://github.com/onesignal/infra/blob/main/dashboards/%(filePath)s)
            ||| % { filePath: 'billing/main.dashboard.jsonnet' }, '\n')
}

It works and yields the same results in v0.18.0 and v0.19.1

{
   "test": "[Contribute to this dashboard on GitHub.com](https://github.com/onesignal/infra/blob/main/dashboards/billing/main.dashboard.jsonnet)"
}

niels-s avatar Nov 10 '22 14:11 niels-s

We'll need to investigate. Thanks for reporting.

sbarzowski avatar Nov 12 '22 10:11 sbarzowski

Tested that with different versions of jsonnet (0.18.0, 0.19.0, 0.19.1, latest version a3a1f0914dc3d2a6fd851edc8e5dc1ef52e372f7) and they all produce in the same correct result.

Tested on ubuntu 22.04.

netomi avatar Apr 17 '23 22:04 netomi

I haven't been able to reproduce this, and a previous commenter wasn't able to reproduce either. I'll close this as wontfix/not reproducible, but if you're still aware of it happening and can reproduce then please reopen it!

johnbartholomew avatar Mar 02 '24 23:03 johnbartholomew