bugGforth - Bugs: bug #62878, fork()'ed and then exit()'ing...

 
 

bug #62878: fork()'ed and then exit()'ing child procs are manipulating history file

Submitter:  Stephan Rudlof <hartrock>
Submitted:  Mon 08 Aug 2022 03:40:16 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  paysan
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 08 Aug 2022 03:57:25 PM UTC, comment #2: 

Works like a charm :-)

Blindingly fast fix :-)

Stephan Rudlof <hartrock>
Mon 08 Aug 2022 03:48:20 PM UTC, comment #1: 

Needs to add a history flush-file drop into the command line write word.

Fixed in checkin b798b773

Bernd Paysan <paysan>
Group administrator
Mon 08 Aug 2022 03:40:16 PM UTC, original submission:  

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).
Stephan Rudlof <hartrock>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by paysan (Posted a comment)
  • -email is unavailable- added by hartrock (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-08-08 paysan Open/ClosedOpen Closed
    2022-08-08 paysan StatusNone Fixed
        Assigned toNone paysan

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code