Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #262682
| From | Greg Wooledge <greg@wooledge.org> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: 12.2: fork() causing getline() to repeat stdin endlessly |
| Date | 2023-10-24 21:30 +0200 |
| Message-ID | <Hsvgd-AgV-3@gated-at.bofh.it> (permalink) |
| References | <Hs961-lT5-9@gated-at.bofh.it> <Hs9z4-miQ-5@gated-at.bofh.it> <HshZD-rGt-9@gated-at.bofh.it> <Hss8F-yoW-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Oct 24, 2023 at 11:01:55PM +0700, Max Nikulin wrote: > On 24/10/2023 12:18, tom kronmiller wrote: > > so I unbuffered stdin and that seemed to make it happy. > > It might be performance killer. Even fflush(NULL) before fork() may be > better. > > https://stackoverflow.com/questions/50110992/why-does-forking-my-process-cause-the-file-to-be-read-infinitely > "Why does forking my process cause the file to be read infinitely" Ooh, that's got an *excellent* answer. > glibc bug report was closed as invalid > https://sourceware.org/bugzilla/show_bug.cgi?id=23151 > > I am curious why macOS behaves differently. It would have been nice if the glibc developer had explained a bit, but of course we aren't owed any explanations. At this point, we can conclude that the bug is in fact in the OP's C program. The underlying C compiler, C library, and Linux kernel are all behaving within specs. At this point I still don't know *why* glibc rewinds stdin intermittently on exit(). Apparently Mac OS X doesn't, or at least didn't at the time the answer was written (2018). I guess there must be some reason for it, and it's not just randomly pranking people, even if I don't understand the reason. This has been a most educational thread.
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: 12.2: fork() causing getline() to repeat stdin endlessly "Thomas Schmitt" <scdbackup@gmx.net> - 2023-10-23 10:50 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly "Thomas Schmitt" <scdbackup@gmx.net> - 2023-10-23 11:20 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly Greg Wooledge <greg@wooledge.org> - 2023-10-23 15:40 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly jleonard@slimy.com (Jon Leonard) - 2023-10-23 16:20 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly tom kronmiller <twk.personal@gmail.com> - 2023-10-23 16:40 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly Greg Wooledge <greg@wooledge.org> - 2023-10-23 17:20 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly gene heskett <gheskett@shentel.net> - 2023-10-23 18:40 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly <tomas@tuxteam.de> - 2023-10-23 20:10 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly tom kronmiller <twk.personal@gmail.com> - 2023-10-23 21:50 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly "Thomas Schmitt" <scdbackup@gmx.net> - 2023-10-23 22:20 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly Greg Wooledge <greg@wooledge.org> - 2023-10-23 22:30 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly "Thomas Schmitt" <scdbackup@gmx.net> - 2023-10-23 22:50 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly Greg Wooledge <greg@wooledge.org> - 2023-10-23 23:00 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly tom kronmiller <twk.personal@gmail.com> - 2023-10-24 07:20 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly Max Nikulin <manikulin@gmail.com> - 2023-10-24 18:10 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly Greg Wooledge <greg@wooledge.org> - 2023-10-24 21:30 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly conover@panix.com (John Conover) - 2023-10-25 01:00 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly jleonard@slimy.com (Jon Leonard) - 2023-10-25 04:20 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly Max Nikulin <manikulin@gmail.com> - 2023-10-25 04:40 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly <tomas@tuxteam.de> - 2023-10-25 06:30 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly tom kronmiller <twk.personal@gmail.com> - 2023-10-25 07:40 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly tom kronmiller <twk.personal@gmail.com> - 2023-10-25 08:00 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly Max Nikulin <manikulin@gmail.com> - 2023-10-23 18:30 +0200
Re: 12.2: fork() causing getline() to repeat stdin endlessly Stefan Monnier <monnier@iro.umontreal.ca> - 2023-10-24 05:00 +0200
csiph-web