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

Another crazy bug the automatic tester found #59

Closed
rix0rrr opened this issue Dec 12, 2018 · 2 comments
Closed

Another crazy bug the automatic tester found #59

rix0rrr opened this issue Dec 12, 2018 · 2 comments
Labels
bug Something isn't working

Comments

@rix0rrr
Copy link

rix0rrr commented Dec 12, 2018

Hi Eemeli,

It's me again! :)

Just ran the autotester on 1.1.0 and it came up with the following:

{"key1":{"key1":{"key1":"","key2":""},"key2":[]},"key2":[[">####################################\"##########################'####\\P#"]]}
--[ roundtrips to ]--->
{"key1":{"key1":{"key1":"","key2":""},"key2":[]},"key2":[[">####################################\"##########################'####\\ 
#"]]}

Repro:

const YAML = require('yaml');
const assert = require('assert');


const input = {"key1":{"key1":{"key1":"","key2":""},"key2":[]},"key2":[[">####################################\"##########################'####\\P#"]]};

const stringified = YAML.stringify(input);
console.log("------------\n" + stringified + "\n-----------------_");
const parsed = YAML.parse(stringified);

console.log(JSON.stringify(parsed));

assert.deepEqual(input, parsed);

YAML output:

key1:
  key1:
    key1: ""
    key2: ""
  key2:
    []
key2:
  - - ">####################################\"##########################'####\\
      \P#"
@eemeli eemeli added the bug Something isn't working label Dec 13, 2018
@eemeli eemeli closed this as completed in 80b78be Dec 13, 2018
@eemeli
Copy link
Owner

eemeli commented Dec 13, 2018

As it turns out, the fix for #57 was also a fix for #48. Both fixes together however meant that now when an escaped backslash \\ ended up exactly at the end of a line, it got split apart. The solution was to revert the earlier hacky fix in favour of the later proper-er fix.

@rix0rrr
Copy link
Author

rix0rrr commented Dec 15, 2018

I've been running it for about a day, and it hasn't found anything more since. So that's encouraging :).

dubzzz added a commit to dubzzz/yaml that referenced this issue Dec 20, 2018
This commit is a follow up of the issues opened by @rix0rrr recently:
- eemeli#56
- eemeli#57
- eemeli#59
dubzzz added a commit to dubzzz/yaml that referenced this issue Dec 21, 2018
eemeli pushed a commit that referenced this issue Dec 23, 2018
This commit is a follow up of the issues opened by @rix0rrr recently:
- #56
- #57
- #59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants