<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8994">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">ast_coredumper:  Fix output directory and variable precedence<br><br>The OUTPUTDIR variable in ast_debug_tools.conf.sample is now set<br>to "/tmp" instead of "/some/directory".<br><br>Variables set on the command line or that are already in the<br>environment now take predecence over variables set in the config files.<br><br>ASTERISK-27846<br>Reported by: Ted G<br><br>Change-Id: Ie8baec52d531886bf5849ec1d59bb59dc87ad387<br>---<br>M configs/samples/ast_debug_tools.conf.sample<br>M contrib/scripts/ast_coredumper<br>2 files changed, 17 insertions(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/94/8994/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/configs/samples/ast_debug_tools.conf.sample b/configs/samples/ast_debug_tools.conf.sample<br>index 1c4827f..0f90f85 100644<br>--- a/configs/samples/ast_debug_tools.conf.sample<br>+++ b/configs/samples/ast_debug_tools.conf.sample<br>@@ -24,7 +24,7 @@<br> # For output from existing core files, the default is the<br> # directory that the core file is found in.  For core files<br> # produced from a running process, the default is /tmp.<br>-OUTPUTDIR=/some/directory<br>+OUTPUTDIR=/tmp<br> <br> # Date command for the "running" coredump and tarballs.<br> # DATEFORMAT will be executed to get the timestamp.<br>diff --git a/contrib/scripts/ast_coredumper b/contrib/scripts/ast_coredumper<br>index 38d95cc..c74b369 100755<br>--- a/contrib/scripts/ast_coredumper<br>+++ b/contrib/scripts/ast_coredumper<br>@@ -225,10 +225,22 @@<br> declare -a COREDUMPS<br> declare -a ARGS_COREDUMPS<br> <br>-# Read config files from least important to most important<br>-[ -f /etc/asterisk/ast_debug_tools.conf ] && source /etc/asterisk/ast_debug_tools.conf<br>-[ -f ~/ast_debug_tools.conf ] && source ~/ast_debug_tools.conf<br>-[ -f ./ast_debug_tools.conf ] && source ./ast_debug_tools.conf<br>+# readconf reads a bash-sourceable file and sets variables<br>+# that havn't already been set.  This allows variables set<br>+# on the command line or that are already in the environment<br>+# to take precedence over those read from the file.<br>+readconf() {<br>+        while read line ; do<br>+         v=${line%%=*}<br>+                [ ! -v ${v} ] && eval $line || :<br>+     done <<< $( sed -r -e "/\s*#/d" -e "/^\s*$/d" $1 )<br>+}<br>+<br>+# Read config files from most important to least important.<br>+# Variable set on the command line or environment always take precedence.<br>+[ -f ./ast_debug_tools.conf ] && readconf ./ast_debug_tools.conf<br>+[ -f ~/ast_debug_tools.conf ] && readconf ~/ast_debug_tools.conf<br>+[ -f /etc/asterisk/ast_debug_tools.conf ] && readconf /etc/asterisk/ast_debug_tools.conf<br> <br> # For *BSD, the preferred gdb may be in /usr/local/bin so we<br> # need to search for one that supports python.<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8994">change 8994</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/8994"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ie8baec52d531886bf5849ec1d59bb59dc87ad387 </div>
<div style="display:none"> Gerrit-Change-Number: 8994 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>