Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newline characters changed to \n in bitrise.yml view #168

Open
koral-- opened this issue Jun 21, 2017 · 13 comments
Open

Newline characters changed to \n in bitrise.yml view #168

koral-- opened this issue Jun 21, 2017 · 13 comments

Comments

@koral--
Copy link

koral-- commented Jun 21, 2017

I have a workflow with 2 script steps. One of them looks consistently in both Workflows and bitrise.yml tabs but 2nd one has newline characters replaced with \n.
image
image

Step have been added and edited using Workflows tab only. Content in that tab is the proper one.

@viktorbenei
Copy link
Contributor

Hi @koral--

This is unfortunately a bit out of our control. Both representations are correct from a YML spec perspective, and so it depends on the serializer how it serializes that string content.

Added the wontfix label as we probably won't have enough time to dig into the go yaml lib (https://github.com/go-yaml/yaml), but of course contributions / PRs are always welcome!

@koral--
Copy link
Author

koral-- commented Jun 21, 2017

Isn't it possible to just force particular style when content is modified in Workflow tab?
E.g. use multiline block beginning with |-.

@viktorbenei
Copy link
Contributor

If you find an option in the docs (http://godoc.org/gopkg.in/yaml.v2 / https://github.com/go-yaml/yaml) please let us know! ;)

@koral--
Copy link
Author

koral-- commented Jun 21, 2017

I guess PR should go there. Even if such will be made that lib does not seem to be contributor friendly: several dozens of issues and PRs opened for months and this: go-yaml/yaml#261

@viktorbenei
Copy link
Contributor

It's quite a stable lib, we never had any issue with it, that might explain the lack of activity there, but of course there's always room for improvement.. To be honest this is like the de factor Go standard YAML lib, switching to any other would be quite a risk

@koral--
Copy link
Author

koral-- commented Jun 21, 2017

I've managed to determine the scenario in which content is "squashed".
It happens when there is a chain of whitespaces at the end of an input beginning with space character. For example: one space, space + newline etc.
It does not happen when there are newlines only.

I guess that if there are only spaces a the end, text may be intentionally enclosed with double quotes to preserve it and this is only valid solution.

However, if there are spaces followed by newlines both block and quoted text can be used.
Right?

@viktorbenei
Copy link
Contributor

I guess that if there are only spaces a the end, text may be intentionally enclosed with double quotes to preserve it and this is only valid solution.

That would make sense. Technically it'd be possible to keep the line ending spaces in the non double quoted form I believe, but the double quoted form is definitely more reliable / less error prone as a serialized form.

However, if there are spaces followed by newlines both block and quoted text can be used. Right?

I think technically that should be possible.

@koral--
Copy link
Author

koral-- commented Jun 21, 2017

I've just checked case when trailing sequence of whitespaces contains spaces between newlines and quotes were also used.

So, to sum up, it seems that the only feasible action for this is to fill an issue on https://github.com/go-yaml/yaml asking them to prefer block notation if text ends with newline character or in other words use quotes only if space is at the end but not in any position of trailing whitespace sequence.

@viktorbenei
Copy link
Contributor

So, to sum up, it seems that the only feasible action for this is to fill an issue on https://github.com/go-yaml/yaml

Indeed. I believe we tried to find another YAML lib for Go initially when we saw this same issue, but did not find any suitable alternative.

@doomsayer13
Copy link
Contributor

@koral-- are you still facing the issue?

@koral--
Copy link
Author

koral-- commented Sep 18, 2018

Yep, just checked and it is still present. Moreover, it seems that now text is a single, quoted line always if there is any whitespace at the end including single newline.

@jbweimar
Copy link

jbweimar commented Jun 25, 2020

This is still an issue and super-annoying. Unfortunately, Bitrise seems to have many of these little bugs (also UI/UX issues) that might cause our company to choose another option.

@paramaggarwal
Copy link

Workaround: Just avoid having a space at the end of any line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants