bug-bash
[Top][All Lists]
Advanced

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

Re: Issues with exported functions


From: Gabriel Corona
Subject: Re: Issues with exported functions
Date: Thu, 25 Sep 2014 21:57:59 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

> I'd much rather prefer the use of an invalid shell name (such as
> f()=...) than a valid shell name (BASH_FUNCTION_foo=()...).

Using a BASH_ prefix has some advantages:

 * Anyone setting such a variable, might expect it could change the
   behaviour of bash. Any script allowing setting untrusted BASH_
   variables to untrusted values should probably expect bad things to
   happen.

 * Anyone seeing such a variable (in env) might expect it to change
   the behaviour of bash. If I see foo(), in env I would probably not
   think "Of course, it will change bash behaviour."

 * It avoids name clashes: whateversh might want to use foo() for its
   own (different) purpose.

Maybe both could be used, BASH_FUNCTION_foo()?

Is there any portability issue with using '()' on some OSes?

-- 
Gabriel



reply via email to

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