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

Fix nested arrays (by reworking array handling) #465

Merged
merged 4 commits into from
Oct 23, 2023

Conversation

ijackson
Copy link
Contributor

@ijackson ijackson commented Oct 4, 2023

Fixes #464.

Copy link
Collaborator

@polarathene polarathene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a proper review, but verified it fixes the issue 👍

@matthiasbeyer (friendly ping) will hopefully have some time to spare to review / merge the bugfix.

Copy link
Collaborator

@matthiasbeyer matthiasbeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one nitpick

src/ser.rs Outdated Show resolved Hide resolved
@matthiasbeyer
Copy link
Collaborator

matthiasbeyer commented Oct 23, 2023

Squashed the fixup commits for you and signed off with my own signoff because you didn't. I assume that you're alright with the signoff and its implications. Also, if you want, feel free to add your signoff to the commits as well!

@matthiasbeyer matthiasbeyer added the hacktoberfest-accepted Accepted PR for hacktoberfest label Oct 23, 2023
@matthiasbeyer
Copy link
Collaborator

matthiasbeyer commented Oct 23, 2023

Meh. CI broke because a dependency of ours does no longer build with 1.66.0.

I'll file a PR to update MSRV, after that is merged please rebase this (and signoff your commits while you're at it! 😆 ) please!

@ijackson
Copy link
Contributor Author

Squashed the fixup commits for you and signed off with my own signoff because you didn't. I assume that you're alright with the signoff and its implications. Also, if you want, feel free to add your signoff to the commits as well!

I think by signoff you mean that you want my confirmation on the statements in the Developer Certificate of Origin , v1.1 presumably? I'm happy to confirm that all those statements apply to all of my contributions to config-rs, thanks.

You may want to copy DEVELOPER-CERTIFICATE into your tree. Otherwise it's slightly ambiguous what Signed-off-by means: what is the committer signing off on?

@matthiasbeyer
Copy link
Collaborator

I think by signoff you mean that you want my confirmation on the statements in the Developer Certificate of Origin , v1.1 presumably?

Yes!

You may want to copy DEVELOPER-CERTIFICATE into your tree. Otherwise it's slightly ambiguous what Signed-off-by means: what is the committer signing off on?

Ah, I thought that was the case. Good catch, I'll do this ASAP!

@ijackson
Copy link
Contributor Author

I read in #483 (comment) that you're not intending a release any time soon. That's awkward for us. We need this bugfix for a feature we want to release at least a preview of fairly soon. Our current workaround is not really suitable. If you don't intend to release soon with this fix, we may need to publish a forked crate to crates.io, which I would rather avoid!

@matthiasbeyer
Copy link
Collaborator

matthiasbeyer commented Oct 23, 2023

Do I read this correctly that this PR is what you'd need for your project?
You're currently using 0.13.3 I assume?

Is there a chance that we can backport the fix to the release-0.13.x branch and publish 0.13.4 with the fix only?
Would that be a solution for you?


I just did a quick test run. All the commits from this PR seem to apply cleanly to the release branch and tests run green.
So I'd love to see a backport of this PR (after it goes in). I can also do the backport myself, if you want. I would say as long as CI is green, there are no breaking changes, so releasing a patch version should be fine, shouldn't it? 😆 Please speak up if you think that these patches cannot be in a patch release for whatever reason though!

Have all the various versions of sequences (arrays and various forms
of tuple) all go via ser::SerializeSeq.

This reduces some duplication.  And, we're about to change the
implementation.

Signed-off-by: Ian Jackson <[email protected]>
We're going to want to do something more complicated.

In particular, to handle nested arrays properly, we need to do some
work at the start and end of each array.

The `new` and (inherent) `end` methods of this newtype is where that
work will be done.

Signed-off-by: Ian Jackson <[email protected]>
Change the representation of our "current location".  Previously it
was a list of increasingly-long full paths, but excepting the putative
final array index.

Now we just record the individual elements. and assemble the whole
path just before calling .set().  This saves a little memory on the
whole since the entries in keys are now a bit shorter.

It is much less confusing.  (There are perhaps still further
opportunities to use Rust's type system to better advantage to
eliminuate opportunities for bugs.)

Arrays that appear other than at the top level are now handled
correctly.  This includes nested arrays, and arrays containing
structs, etc.

Signed-off-by: Ian Jackson <[email protected]>
@ijackson
Copy link
Contributor Author

Rebased, thanks.

Yes, a backport of this to the release branch would be perfect for us. I can make an MR for that right away if you like.

@ijackson
Copy link
Contributor Author

Not sure I understand why the MSRV CI test is still failing. Did I rebase onto the wrong thing?

@matthiasbeyer
Copy link
Collaborator

matthiasbeyer commented Oct 23, 2023

I can make an MR for that right away if you like.

Please do! ❤️ But after this PR went in and with cherry-pick -x so that the picked commits refer the commits in master!

@matthiasbeyer
Copy link
Collaborator

Not sure I understand why the MSRV CI test is still failing. Did I rebase onto the wrong thing?

You did not rebase on latest master...

@ijackson
Copy link
Contributor Author

I think my push didn't take or something? Done now I think. Sorry.

@matthiasbeyer
Copy link
Collaborator

I think my push didn't take or something? Done now I think. Sorry.

Nah don't worry! 👍

@matthiasbeyer matthiasbeyer merged commit 8e4fb6f into mehcode:master Oct 23, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Accepted PR for hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nested arrays badly mangled
3 participants