/bin/sh: line 2: `BASH_FUNC_ttr%%': not a valid identifier

Brandon Allbery allbery.b at gmail.com
Thu Oct 9 17:07:45 PDT 2014


On Thu, Oct 9, 2014 at 5:41 PM, Barrie Stott <zen146410 at zen.co.uk> wrote:

> BASH_FUNC_ttr%%=() {  d="Jan 25: Feb 22: Mar 29: Apr 26: May 31: Jun 28:
> Sep 27: Oct 25: Dec 6";
> BASH_FUNC_usenosql%%=() {  PS1="\[\](nosql):\W \$ \[\]";
> BASH_FUNC_mymup2pdf%%=() {  mup-prog $@ > /tmp/x.ps
>
> ;
> BASH_FUNC_b12%%=() {  d=6;
>
> Yet, for all of these, ~/.bashrc has
> "function xxx {" instead of
> "BASH_FUNC_xxx%%=() {"
>

Yes. This is the patch for Shellshock.

My guess is, you have MacPorts' bash installed, and it is exporting
functions in that way to avoid random things being interpreted as functions
and eval-ed (aka Shellshock).

But there is also /bin/bash aka /bin/sh, which does not have the Shellshock
patch. It's trying to read those and define functions, but it doesn't know
that it needs to strip off the Shellshock wrapper before using them, so
it's trying to define functions that are both incorrect (having BASH_FUNC_
prefix) and invalid (trailing %%) because of the Shellshock wrappers around
the names.

Apple's not patching 10.6, so either you must build a new bash yourself and
copy it over /bin/bash (I do not recommend this) or apply the Debian /
FreeBSD patch to MacPorts' bash to stop it from exporting functions at all.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-users/attachments/20141009/28ef6ad1/attachment.html>


More information about the macports-users mailing list