Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14405

declare(1) not executing inside source'd script

Path csiph.com!goblin3!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From frank@eec.com
Newsgroups gnu.bash.bug
Subject declare(1) not executing inside source'd script
Date Fri, 27 Jul 2018 00:26:06 -0400 (EDT)
Lines 43
Approved bug-bash@gnu.org
Message-ID <mailman.4326.1532699926.1292.bug-bash@gnu.org> (permalink)
NNTP-Posting-Host lists.gnu.org
X-Trace usenet.stanford.edu 1532699927 3823 208.118.235.17 (27 Jul 2018 13:58:47 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
X-detected-operating-system by eggs.gnu.org: Mac OS X [generic] [fuzzy]
X-Received-From 65.32.113.132
X-Mailman-Approved-At Fri, 27 Jul 2018 09:58:44 -0400
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:14405

Show key headers only | View raw


Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_GNU_SOURCE -DRECYCLES_PIDS -DDEFAULT_PATH_VALUE='/usr/local/bin:/usr/bin'  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1  -m64 -mtune=generic -Wno-parentheses -Wno-format-security
uname output: Linux student.eeconsulting.net 3.10.0-693.11.6.el7.x86_64 #1 SMP Thu Jan 4 01:06:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

Bash Version: 4.4
Patch Level: 23
Release Status: release

Description:
	A script contains a function definition followed by
	    declare -fx funcname
	but the declare(1) doesn't execute and the function
	is not exported after source'ing the file.  In addition,
	executing 'declare -p -F | grep "funcname"' does not
	produce any output (making me think that declare(1)
	isn't being executed at all).

Repeat-By:
	$ cat <<__EOF__ >/tmp/bashbug.bash
	> function myfunc {
	>     echo "Running..."
	> }
	> declare -fx myfunc
	> declare -p -F | grep "myfunc"
	> __EOF__
	$ source /tmp/bashbug.bash

	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.

Fix:
	Strangely, if I create another script that sources
	the first one, then execute the declare commands in
	that second script, everything works when I source
	the second file?!

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

declare(1) not executing inside source'd script frank@eec.com - 2018-07-27 00:26 -0400

csiph-web