public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/27747] New: Inconsistent file pointer fgets with multiprocess
@ 2021-04-17 4:31 gigacms at gmail dot com
2021-04-17 6:38 ` [Bug libc/27747] " schwab@linux-m68k.org
2021-04-17 7:42 ` gigacms at gmail dot com
0 siblings, 2 replies; 3+ messages in thread
From: gigacms at gmail dot com @ 2021-04-17 4:31 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=27747
Bug ID: 27747
Summary: Inconsistent file pointer fgets with multiprocess
Product: glibc
Version: 2.31
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: libc
Assignee: unassigned at sourceware dot org
Reporter: gigacms at gmail dot com
CC: drepper.fsp at gmail dot com
Target Milestone: ---
Created attachment 13373
--> https://sourceware.org/bugzilla/attachment.cgi?id=13373&action=edit
source code, compiled binary, stdoutput of testcase
Hi!
In multiprocess environment, file pointer express wrong and inconsistent seek
position after using fgets.
test case is in attachment and have 3 point sequence:
1. file open
2. fork
3. fgets & printf (each process)
I tried to see memory using GDB, there are empty memory(set 0) such as
_IO_read_base.
It seems about file lock. But I can't assure it.
My input was the string follow: "one\ntwo\nthree\nfour"
So, expected result is 2nd of executed output below.
[ stdout of testcase ]
-----------------------------------------------
liberty@ubuntu:~/glibc/test$ ./fgets_fork_inner
13252 0
0 0
0 4
13252 4
0 (null)
13252 one
liberty@ubuntu:~/glibc/test$ ./fgets_fork_inner
13254 0
13254 4
13254 one
0 4
0 8
0 two
liberty@ubuntu:~/glibc/test$ ./fgets_fork_inner
13256 0
0 0
13256 4
13256 one
0 8
0 two
liberty@ubuntu:~/glibc/test$ ./fgets_fork_inner
13258 0
13258 4
13258 one
0 0
0 8
0 two
-----------------------------------------------
Libc Path:/usr/lib/x86_64-linux-gnu/libc-2.31.so
System Info: "Linux ubuntu 5.8.0-50-generic #56~20.04.1-Ubuntu SMP Mon Apr 12
21:46:35 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux"
Thank you.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libc/27747] Inconsistent file pointer fgets with multiprocess
2021-04-17 4:31 [Bug libc/27747] New: Inconsistent file pointer fgets with multiprocess gigacms at gmail dot com
@ 2021-04-17 6:38 ` schwab@linux-m68k.org
2021-04-17 7:42 ` gigacms at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: schwab@linux-m68k.org @ 2021-04-17 6:38 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=27747
Andreas Schwab <schwab@linux-m68k.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |NOTABUG
--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
You need to follow the processes described in this section:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_05_01
Accessing the same stream in both processes after fork is undefined otherwise.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libc/27747] Inconsistent file pointer fgets with multiprocess
2021-04-17 4:31 [Bug libc/27747] New: Inconsistent file pointer fgets with multiprocess gigacms at gmail dot com
2021-04-17 6:38 ` [Bug libc/27747] " schwab@linux-m68k.org
@ 2021-04-17 7:42 ` gigacms at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: gigacms at gmail dot com @ 2021-04-17 7:42 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=27747
--- Comment #2 from Minseong <gigacms at gmail dot com> ---
(In reply to Andreas Schwab from comment #1)
> You need to follow the processes described in this section:
>
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.
> html#tag_15_05_01
>
> Accessing the same stream in both processes after fork is undefined
> otherwise.
Oh I see. Thanks a lot!
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-17 7:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-17 4:31 [Bug libc/27747] New: Inconsistent file pointer fgets with multiprocess gigacms at gmail dot com
2021-04-17 6:38 ` [Bug libc/27747] " schwab@linux-m68k.org
2021-04-17 7:42 ` gigacms at gmail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).