bug-gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #62878] fork()'ed and then exit()'ing child procs are manipulating


From: Stephan Rudlof
Subject: [bug #62878] fork()'ed and then exit()'ing child procs are manipulating history file
Date: Mon, 8 Aug 2022 11:40:19 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?62878>

                 Summary: fork()'ed and then exit()'ing child procs are
manipulating history file
                 Project: Gforth
               Submitter: hartrock
               Submitted: Mon 08 Aug 2022 03:40:16 PM UTC
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Mon 08 Aug 2022 03:40:16 PM UTC By: Stephan Rudlof <hartrock>
How to avoid fork()'ed and then exit()'ing child procs manipulating history
file?

sr@rs:~/Gforth$ rm ~/.local/share/gforth/history
sr@rs:~/Gforth$ cat ~/.local/share/gforth/history
cat: /home/sr/.local/share/gforth/history: No such file or directory
sr@rs:~/Gforth$ gforth
Gforth 0.7.9_20220807
Authors: Anton Ertl, Bernd Paysan, Jens Wilke et al., for more type `authors'
Copyright © 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `help' for basic help
see see
: see
  parse-name name-too-short? find-name dup 0= #-13 and throw name-see ; ok

sr@rs:~/Gforth$ cat ~/.local/share/gforth/history
see see
sr@rs:~/Gforth$ cat t_fork2.fs
require unix/libc.fs
: bazz \ good enough for testing purposes
    5 0 do
        fork()
        if \ child pid -> parent, or ..
            cr ." parent " getpid .
        else \ .. 0 -> child
            i 1000 * ms \ avoid mixing child output
            ." child " getpid .
            0 exit()
        then
    loop
;
sr@rs:~/Gforth$ gforth t_fork2.fs
Gforth 0.7.9_20220807
Authors: Anton Ertl, Bernd Paysan, Jens Wilke et al., for more type `authors'
Copyright © 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `help' for basic help
bazz
parent 30205 child 30220
parent 30205
parent 30205
parent 30205
parent 30205  ok
child 30221 child 30222 child 30223 child 30224
sr@rs:~/Gforth$ cat ~/.local/share/gforth/history
see see
bazz
bazz
bazz
bazz
bazz
bazz
sr@rs:~/Gforth$

* This behavior is a symptom of something easily leading to nasty effects in
CLI of parent proc (if trying to use history).
* There may be a mechanism for decoupling child procs from terminal input
stream (which I don't know).







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62878>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]