Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Frank Newsgroups: gnu.bash.bug Subject: Re: declare(1) not executing inside source'd script Date: Fri, 27 Jul 2018 11:28:55 -0400 Lines: 61 Approved: bug-bash@gnu.org Message-ID: References: <20180727042606.EFCD8120EA6@student.eeconsulting.net> <20180727141701.rt26jd6vymkf6uwb@eeg.ccf.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 (1.0) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: usenet.stanford.edu 1532705373 7275 208.118.235.17 (27 Jul 2018 15:29:33 GMT) X-Complaints-To: action@cs.stanford.edu Cc: frank@eec.com, bug-bash@gnu.org To: Greg Wooledge Envelope-to: bug-bash@gnu.org X-Mailer: iPhone Mail (15F79) In-Reply-To: <20180727141701.rt26jd6vymkf6uwb@eeg.ccf.org> X-Provags-ID: V03:K1:KF6nY9gF248VOeerS83sUL6Uyw4kh36CsqgWonRvJmwqlxCAACf zRqkeCZv6y6xPVaMDVSpa1q4/JROldR3LjDEAYaYMj2h+CaqQ93hElHw7Ce4kw6yndQH6du l2OXjbS8g/Xn9Z2rkzkSeL7MB8UhAF412uaI8FBfhVDGbnNg10jIZzmgxbFNSCDXBoPmZ+8 lgUl+yGr6FMuvAwp5+tbQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:RWl68rWqAD4=:5+6Kb3yzUtdIJIWqGvQP0c aWV4cxGq+jCVlulJFhdVHI/+NpQuBIDyeusmSOzcEJ55SK0S89RsBkbtqrxvROaobZR8INq/i OvrPYDOGPQve6CHLAkQYKeqJ4plqApuEvyr5xaCQM3LBSNsOljBkycslCJZlNo5WBcNLW/zi1 4CuMVknpHfT11UfetqYb9pB7gZVbsrxDve3O32AZgS9KzT6rhwggRVUUHDrCTahTi3S3z/ych wu2CwA0t8Ntff5BQvNNUxfmIKm+vvfC4I4iWSf2S0fRJW7QQNF0zxWZR+OF0Y3sjb27dcm4Ct Qgri/w4ekoUxw8NgcGwGo8fLVlboT7aOln9L5OpQrsDYW3xFzkly9+2h0tFlbEUeh4juHUmHK sJJFd7EMBaJGtCAnpqMIMv7y55OS6t3/qXquFgxMamkTjd8bRTbq/dDWz/KPsQt/qEXRe2qQE 9EmW/zYMJEogrQb51Wm99tUy6Z3RxCUrkBy+/4dpSBCmPE/0W1sTNmpkKqDOA7KWEL02HjBo/ djd7URTE6lVn8D3PVVXoPBT5zuKX86LjweCu2LjUglBGkbbzRjygDwdZk6sRRVimV+UDkTpn+ XPai71v9L6cLcSoZL98hxkRnqQVCbV6AqaJ++xN3YjCT0P3FRm19tr1ZFBVTz/h2vF5CihxSN QmkRX3EsSlTA5m0SfwQ/ogA78LRwhIedTDQtbIVCQyejl+sj8Dz9ARSIaMIIF9gwupIIVWjy9 YP/eTOopCRdHjnFm X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.208.4.197 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:14411 Hm. Strange. I will examine the environment for weirdness regarding BASH_E= NV or anything else that might be an issue. Given that it happens for me in= both the stock bash 4.2.46 and the locally built 4.4 (on CentOS 7.4), there= must be something common to both and thus external to the shell itself. I have installed bashdb on this system as well, but I don=E2=80=99t expect t= hat to have affected anything since it=E2=80=99s an add on that Bash shouldn= =E2=80=99t have noticed without the use of --debugger. Thanks for your help. PS: So the official line is to not specify the man section for builtins to t= he shell? I will not use section numbers in the future. :) -- Frank Edwards Edwards & Edwards Consulting, LLC Hours: 10A-6P ET Phone: (813) 406-0604 Sent from my iPhone. No electrons were harmed in the creation or transmissi= on of this message. > On Jul 27, 2018, at 10:17 AM, Greg Wooledge wrote: >=20 >> On Fri, Jul 27, 2018 at 12:26:06AM -0400, frank@eec.com wrote: >> Repeat-By: >> $ cat <<__EOF__ >/tmp/bashbug.bash >> > function myfunc { >> > echo "Running..." >> > } >> > declare -fx myfunc >> > declare -p -F | grep "myfunc" >> > __EOF__ >> $ source /tmp/bashbug.bash >>=20 >> The function is now defined, but is not exported. >> And the output of the last command never appears, >> but if the same command is executed now -- at >> the interactive shell prompt -- it does show that >> 'myfunc' is defined. >=20 > I cannot reproduce this, either in Debian's bash 4.4, or in bash 5.0-alpha= . >=20 > wooledg:~$ exec bash-5.0-alpha > wooledg:~$ cat foo > function myfunc { > echo "Running" > } > declare -fx myfunc > declare -p -F | grep myfunc > wooledg:~$ source ./foo > declare -fx myfunc > wooledg:~$ bash -c myfunc > Running >=20 > On my system, I see the output from "declare -p -F" upon sourcing the > file, and the function is definitely exported. I get the same results > using Debian's bash 4.4(.12) as well.