I had replaced an init_input() call with an assert because my refactoring as part of fixing a different problem suggested that call was no longer needed. And no unit tests failed and the resulting binary worked for me. The code in question needs considerably more refactoring and renaming of some of the functions to improve clarity. But for the moment I've conditionally reintroduced the init_input() call and added a unit test to keep this from regressing in the future.
Your commit seems to have fix the issue for simple double calls but I still experience some issue with read in some context.
I first discovered this issue when running complex read based scripts such as fishline/tests/run.fish. It seems that with this fix, it now crashes after the first call to read in __fishline_test and no longer the second time this function is called.
This test script creates 2 functions and pass them as arguments to read for each subsection we want to test, we are doing so with:
read -R func_right -p func_left
I've done some testing to pin down the issue, and I saw that it now segv when calling read with with either -P, -R or -p with no variable to assign to.
For example running read -P ">" a would work while read -P ">" will segfault.
Thanks for the second failure report, @0rax. That problem, however, is unrelated to the original problem or commit 5dc78dd. The second problem is due to commit d383e3b. I'll open a new issue for that problem.
@krader1961 oh right, it just went to the next issue then, just telling that your last commit uncovered it !
I am using it pretty much as a way to preview a prompt, this making it pretty much a side-effect (just print and ignore input), so when called without any variable name after I am expecting that either no variable is assigned or as for bash's read a default variable such as REPLY might be filled that I will ignore afterwards.
Though as seen in your new issue, I am completely fine with forcing a variable name to be set when calling read if it's what follow fish's philosophy. This will make a script using read backward compatible but will still be a forward breaking change for older calls.
In my case, I will push my change to the repository to make sure a variable is set even though I am not using it.
Description of the bug:
When running multiple read in a row without creating a full interactive session, fish will abort.
This can be reproduced by launching:
or executing a script such as:
Note that this issue is also seen when running it as:
This produce the following output:
The complete output of my test can be seen here: https://gist.github.com/0rax/d7392b40f61c6081a12ccc93c664d3eb
This was not present in Fish v2.5 and has been tested on ArchLinux + Fish v2.5.0.
Bug seen on:
brew install fish)
apk add fish@edge)
brew install --build-from-source fish --HEAD)
The text was updated successfully, but these errors were encountered: