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
[#2156] Replace variable length arrays with alloca()
(main)
#2181
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look fine, but I'm not sold on the use of alloca
yet.
I don't have any experience with it, but reading about it indicates we should probably rethink using it.
The main thing is that we're replacing VLAs with alloca
, which seems incorrect.
Thoughts?
I'm not sure I understand the problem. |
Right. I'm concerned about stack overflow and undefined behavior. From
The amount of stack space needed is unknown for the some/all of the VLAs. Here's another link on it: https://stackoverflow.com/a/1018865/5818611 Another thing that comes to mind is if something weird happens as a result of using |
The NOTES section of the man page makes me slightly nervous too. |
Looking at the comments in the stackoverflow answer you linked, it appears that VLAs have the exact same problems as What do you find concerning in the NOTES section? |
That section states its use is discouraged. I take that as the dev must be sure that function is the correct choice for the task and it doesn't leave room for stack overflow. |
If my understanding is correct, given our usage, if a stack overflow would occur with |
That's a fair point. Please run the test suite to confirm everything is still good. |
All tests fail for tip of main, so they fail here too. |
That's unexpected. Was anything reported that indicates the reason for the failures? |
So I forgot that the testing environment will report that all tests fail for plugin tests regardless of how many actually fail, and it turns out that on tip of main, only most tests fail. I think it may have something to do with irods/irods#7502. I'll open an issue about that. For this PR, all tests did actually fail, and it appeared to be due to a signature mismatch. I figured out that this was due to a difference in how I don't like clang-format's suggestion for the |
Are the failing tests you're referring to part of the irods/irods test suite or this repo's test suite?
Agreed. Wrap it in |
They're all from this repo |
Are the tests that fail expected? I don't remember that being the case. |
I don't think so. I think they're failing because they weren't updated to expect the deprecation message introduced in irods/irods#7502. I'm still looking into it. There may be other tests failing for different reasons. |
Got it. Will come back once you've learned more. |
Changing the tests to expect the deprecation message fixed some of them, but another one, |
alloca()
, and add missing curl include to request_context.h
(main)alloca()
, and add missing curl include to request_context.h
, and fix some tests (main)
I've opened #2184 to cover the remaining test failures. The cause of the failure wasn't evident to me so I'm going to leave that work to someone else so I can get back to working on buildsystem and packaging stuff. |
If there are no objections, I'm going to # this and the 4-3-stable PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm okay with the changes since alloca
presents nothing more dangerous than VLAs. I just saw one thing in the tests.
Deferring to @korydraughn, though.
Let's hold on pounding. We need to determine why the tests are failing. Once that's handled we can proceed. |
alloca()
, and add missing curl include to request_context.h
, and fix some tests (main)alloca()
(main)
Going to wait until after 4.3.2 to merge this PR. |
I've confirmed that tests pass now. If there are no objections, I will # this PR and the 4-3-stable PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pound it.
#'d |
Addresses #2156 (for real this time)