-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
First steps of splitting io_data_t #487
Conversation
Copy constructor of io_data_t is removed.
This looks like a great first step, but I want to be sure we test it carefully. |
@ridiculousfish I haven't written test cases against memory code (fish is the first C++ project I contribute seriously), so I wonder what exactly should be tested against. Perhaps:
|
By testing, I mean integration testing. Here's an example of a problem I introduced when I tried to clean this stuff up before (in commit 61686af): #269 . It popped up only when using fish_config with tmux - yikes. After review, here's one potential source of trouble I spotted. In Also, the The last suggestion I have is to prefer to pass Overall, if this change proves correct, it will be an excellent improvement and I'll be thrilled. I'm going to merge it so we can get testing and exposure. |
Thank you! |
It appears that commit 8b10b0a broke my prompt (which is simple):
The color no longer appears. This most likely means that the output from builtins is not being correctly interleaved with the output from external commands. I am going to back out this change until we have a fix. |
@ridiculousfish That's weird, it works for me here. No regression in |
A reduced test case is:
this should output '1 2', but instead it outputs '2 1'. Tested on Ubuntu and OS X. |
@ridiculousfish Ah, this is interesting! I'm looking into it. |
Reverted here: 77f1b1f |
I've locked down the bug to the behavior change of
When I restore the copy behavior, But after looking through the code for quite a while, I still don't have a clue. @ridiculousfish What do you suspect may be causing this? |
My usual approach for these kinds of problems is to step through it in a
|
@JanKanis ok, I'll try a debugger. The tricky part is where to break at... |
I'd say to start at where you made the critical change.
|
I speculate it's due to this code at the bottom of
This removes the IO redirections in It's possible that code never actually did anything in fish 1.x, because the redirections were always copied, so nothing was ever removed. But I want to make sure we understand what that code does and why, or convince ourselves that it does nothing, before we modify it. IO redirections are one of the most mysterious parts of fish (at least to me). |
@ridiculousfish Ha, removing the removing fixes it. :) I guess it affects the behavior of Also, I'd bet that it did nothing before, but I'll double check. |
Update:
|
It seems that:
|
I've further confirmed that the
|
First steps towards #484.
By using shared_ptr to manage io_data_t and avoid copying io_data_t, better destruction semantics is achieved.
io_buffer_destroy
will be converted into a virtual destructor a bit later (after splitting io_buffer_t, of course).