[Top][All Lists]

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

SEGFAULT if bash script make "source" for itself

From: bogun.dmitriy
Subject: SEGFAULT if bash script make "source" for itself
Date: Wed, 27 Aug 2014 18:07:20 -0700

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: x86_64-pc-linux-gnu-gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-lin   ux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
-DHAVE_CONFIG_H   -I. -I./include -   I. -I./include -I./lib
-DSTANDARD_   UTILS_PATH='/bin:/usr/bin:/sbin:/usr/sbin'
-DSYS_BASHRC='/etc/bash/bashrc' -DSYS_BASH_LOGOUT='/etc/bash/bash_logout'
uname output: Linux dbogun-bt-laptop 3.14.14-gentoo #2 SMP Wed Aug 13
09:36:02 PDT 2014 x86_64 Intel(R) Core(TM) i5-331   7U CPU @ 1.70GHz
GenuineIntel GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.2
Patch Level: 45
Release Status: release

I write a script it should "source" some other script located in same
directory. But I make error in source command, and point not to other
script, but to original script... In other words I got recursive "source"
command. As a result I got SIGSEVG.

Here is significant part of my script, that lead to error.

# -- script start --

set -e

touch "$(dirname "${BASH_SOURCE[0]}")/test"
source "$(dirname "${BASH_SOURCE[0]}"/fail)"
# correct variant:
# source "$(dirname "${BASH_SOURCE[0]}")/fail"

# never got here
echo ok
# -- script end

Expected result:
Block "source" for files already listed in "${BASH_SOURCE}". Perhaps this
behavior and "changed" behavior should be switched by option in "set"

Or at least suitable error message if recursive "source" loop detected.

reply via email to

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