bug-bash
[Top][All Lists]
Advanced

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

Re: problem with bash script loading


From: Paulo Nogueira
Subject: Re: problem with bash script loading
Date: Sat, 5 Jan 2019 08:28:45 +0000 (WET)
User-agent: Alpine 2.21 (LFD 202 2017-01-01)



On Sat, 29 Dec 2018, Chet Ramey wrote:


http://lists.gnu.org/archive/html/bug-bash/2018-09/msg00023.html



 Not sure if I understood everything, so allow me to quote you,
 from
 http://lists.gnu.org/archive/html/bug-bash/2018-09/msg00024.html

... It's been there
even since I wrote the buffered input code in 1992, and it's more about
making sure parent and child shells have a consistent view of the script
in case the child expects to read from it. It's about being careful, not
explicitly allowing self-modifying scripts.


 What occurred to me is the following: suppose a script s1 starts
 being executed, by forking say, and then s1 is overwritten; bash
 detects this and re-reads the file. OK, then exactly where does
 bash continue executing the script s1 if changes were made
 throughout the file, even before the current location pointer?
 (in relative terms, of course)

 Does it count the number of bytes? The number of records?
 I cannot see any consistent way. It seems impossible, in
 general, to avoid at least one of the following cases:

 (1) executing commands that are present in at least one of
    the files, but which (in a given situation) wouldn't be
    executed if either file were to be run as a whole

 (2) executing commands that are *not* present in either file
    (ie, the older and newer versions of s1), for example
    "garbage" commands that make the execution abort

 Both cases may lead, for instance, to the deletion of files
 that had never been intended to be deleted, and so on...

 And that, if true, would make your consistency argument kind
 of secondary, so to say (in my opinion, of course).

 Best regards,
  Paulo Nogueira




reply via email to

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