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


Groups > gnu.bash.bug > #14403

declare(1) not executing inside source'd script

Path csiph.com!goblin3!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From sales@eec.com
Newsgroups gnu.bash.bug
Subject declare(1) not executing inside source'd script
Date Fri, 27 Jul 2018 00:26:51 -0400 (EDT)
Lines 43
Approved bug-bash@gnu.org
Message-ID <mailman.4324.1532699925.1292.bug-bash@gnu.org> (permalink)
NNTP-Posting-Host lists.gnu.org
X-Trace usenet.stanford.edu 1532699926 3821 208.118.235.17 (27 Jul 2018 13:58:46 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
X-Provags-ID V03:K1:FX8ucCCTF8xHQOoE47642rphCaNsn+foOof2fOcJR5Qe2bvFhnO uki7QKFWkHR0aRZTqYob/9vKGwmJYUyEMzNKb7ZN8bej01joKr4EdRoq9cm428vcdnfFIwF uIhZCNAtHzGv7rwx2I3UUz/gBuWIkxGX9UiVc679pDIQQw3fKOnTN5mnqSVDjMCrhZ5Zpog 2PgAVrG/6H++xURjp2n7w==
X-UI-Out-Filterresults notjunk:1;V01:K0:fLUATcTy/LI=:lrPLbdfOqtOhIoshw6wUkg Wp2gJl4kxJMacMnz3cYWv5X3EhYidujbMmLrrmsPUSdHoSdch1SVE3vylLaNBtfnUj5xVZgpm 4Xlg6HEWkEqzxSoGwpZvrOf/7U2uUZvNwjNE68uEgry9/by9yfV48WEez5RuMQ8W0kGByn0cj OTnGmn5Fo0du2SQ9ntuD74u67l3twb3nbG97Vblau2m7KjYM37HxoFll5eXcz7XNw+AMgfbAE YQF8ocTkqNFYgzw0rzDBAi3+Pi5tN6tYB55YqJypIFYr15LPNMLRy1EbCTQSMgxGHYnO785Tz 5kxSkgjo5CxE8617n53oyb9dZ0YLiPOIlJiBqe5PrG5/W0yaS//SY3uD2zBjCZTYra3cfyE0k 7g9vB3bYjtqWIrcoCSdPWAJ43bXUl/9i4Fjh8SzogPdmTWYsbhZ0i5SJYW1lpAraApK7nqGlV 9qP/Vjg68OHr1LOKMQUPuz4OPcSlZpVDzhAyOrscTrT6YPmZw85Ap8V8UESmdYrbzU++6CiNq 3AAEQdb0Qq9QuNl7Rv1xNnqJSCFK22EwjbdDbj9a+XdNAeerhDnpdDYDWTw5qrPKDkXo5EUIE RUHeZBrOh32SIqh3nOaYvUe26l4mrrOIjbGntkSprLeb5/1N61faUKqe42S7KroANsPt4Z5d8 Q63YHUbCq0X2NhUaYaK5GMcoz01tPGRbFR4IabksJ/zhmnF1EanFi8QCHBMqNE5VmlLA=
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-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:14403

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 sales@eec.com - 2018-07-27 00:26 -0400

csiph-web