Bug 892674
Summary: | broken ncurses output after upgrading from F17 to F18 | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Jaromír Cápík <jcapik> | ||||
Component: | ncurses | Assignee: | Miroslav Lichvar <mlichvar> | ||||
Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | high | Docs Contact: | |||||
Priority: | high | ||||||
Version: | rawhide | CC: | dickey, mlichvar, ovasik | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2013-01-30 13:44:56 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Jaromír Cápík
2013-01-07 15:09:01 UTC
Created attachment 674121 [details]
curs_test.c
Note: Jim confirmed the issue persists with the latest upstream sources ... The cause is from my changes here: http://invisible-island.net/ncurses/NEWS.html#t20120825 + change output buffering scheme, using buffer maintained by ncurses rather than stdio, to avoid problems with SIGTSTP handling (report by Brian Bloniarz). Mixing stdio calls with ncurses calls has not really ever been supported. The terminfo layer has putp, which the example uses in one case, but uses the stdio putchar in another. The latter is buffered, the former currently is not. (Note that setupterm takes a file descriptor parameter, and there's been no documentation asserting that it is buffered I/O). Since it is likely to be a rare application which can justify the mix, I would expect the applications to do an fflush(stdout) before resuming with ncurses. The same issue will happen with other mixes of stdio and ncurses calls. For the given example, the straightforward solution would be to use putp, and stay within the library's documented interfaces. hmm - the manpage claims that The putp routine calls tputs(str, 1, putchar). Note that the output of putp always goes to stdout, not to the fildes specified in setupterm. However that (use of putchar) has not been true for some time. I can look up that, if it's an issue - several years at any rate. It's been an internal function owned by ncurses to solve other signal-handling issues. For SIGTSTP, there was no other solution that I could see. The 20120825 patch basically replaced the way buffering was done, without introducing new I/O streams. Hello Thomas. This is unfortunately quite commonly seen scenario. Developers often build their software on top of undocumented features (because it somehow works) and then cry when such undocumented features stop working. Jim has seen your response and wrote a patch, that modifies the top tool to avoid mixing stdio and ncurses calls and feels satisfied about that. Anyway ... more tools like that could exist and if the previous undocumented behaviour can be easily achieved in ncurses without having a negative performance impact and if that doesn't go against your conviction, I would say it's more generous to do the change in ncurses. What do you think? Thank you. Regards, Jaromir. At the moment I'm considering modifying ncurses so that putp and the other low-level calls http://invisible-island.net/ncurses/man/curs_terminfo.3x.html are buffered, while those from the ncurses library use the newer scheme. That would solve both problems (I think). That's great. Thank you. J. no problem... I made that change yesterday - http://lists.gnu.org/archive/html/bug-ncurses/2013-01/msg00007.html Ahoj Mirku. Do you think it would be possible to introduce the changes made by Thomas to F19/Rawhide? Please, let me know. Thanks, Jaromir. Definitely, I'm planning to update the ncurses package soon. I made updates yesterday for this in mvcur (I noticed that dots_mvcur test-program was still incorrect). The other test-programs look ok, though I'm thinking how to document the limitations of this hybrid approach. ncurses-5.9-8.20130126.fc19 was built for rawhide. Thanks. |