Skip to content

Commit daa7a41

Browse files
author
John L. Villalovos
committed
Export the 'short_source' function & don't keep PS4 in sudo
Export the 'short_source' function so that it will be present in the environment for child shell scripts. Do this because we are passing PS4 to the child shell scripts and it is using 'short_source' Don't do an 'env_keep' in the sudoers file for PS4, since it is difficult to also pass along the 'short_source' function. Change-Id: I9781010d6eb336d02939c7fd47f18bedeae5ccc6 Closes-Bug: #1563443
1 parent 8d27280 commit daa7a41

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

functions

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ function short_source {
4141
file=${file#$RC_DIR/}
4242
printf "%-40s " "$file:${called[1]}:${called[0]}"
4343
}
44+
# PS4 is exported to child shells and uses the 'short_source' function, so
45+
# export it so child shells have access to the 'short_source' function also.
46+
export -f short_source
4447

4548

4649
# Retrieve an image from a URL and upload into Glance.

stack.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ echo "$STACK_USER ALL=(root) NOPASSWD:ALL" >$TEMPFILE
240240
# see them by forcing ``PATH``
241241
echo "Defaults:$STACK_USER secure_path=/sbin:/usr/sbin:/usr/bin:/bin:/usr/local/sbin:/usr/local/bin" >> $TEMPFILE
242242
echo "Defaults:$STACK_USER !requiretty" >> $TEMPFILE
243-
echo "Defaults env_keep += PS4" >> $TEMPFILE
244243
chmod 0440 $TEMPFILE
245244
sudo chown root:root $TEMPFILE
246245
sudo mv $TEMPFILE /etc/sudoers.d/50_stack_sh

tools/create_userrc.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ function short_source {
2222
file=${file#$RC_DIR/}
2323
printf "%-40s " "$file:${called[1]}:${called[0]}"
2424
}
25+
# PS4 is exported to child shells and uses the 'short_source' function, so
26+
# export it so child shells have access to the 'short_source' function also.
27+
export -f short_source
2528

2629
set -o xtrace
2730

0 commit comments

Comments
 (0)