On 08/27/2014 07:07 PM, bogun.dmit...@gmail.com wrote: > > Expected result: > Block "source" for files already listed in "${BASH_SOURCE}". Perhaps this > behavior and "changed" behavior should be switched by option in "set" > command.
No. Recursive sourcing is useful, don't prohibit it artificially. Detecting which cases of user input would cause stack overflow is equivalent to solving the Halting Problem, which is not practical. So our choices are to either cripple the user unnecessarily, or do a better job in at least detecting after the fact when the user did something dumb. > > Or at least suitable error message if recursive "source" loop detected. GNU libsigsegv is a library which provides the means for applications to give a NICE error message when user input causes stack overflow. For example, both m4 and gawk use it so that a stack recursion exits gracefully rather than with a segfault and core dump (after all, it's the user's fault for putting in bad input, not a bug in the program). Maybe it's worth investigating if bash could link with it? -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature