Browse Source

Don't enforce debuging and verbosity modes on import

Also don't rely on running the value; ie. sec risk.
Alois Mahdal 4 years ago
parent
commit
cfb2e0f7cd
1 changed files with 5 additions and 5 deletions
  1. 5
    5
      src/include-bash/pretty.sh

+ 5
- 5
src/include-bash/pretty.sh View File

@@ -5,7 +5,7 @@ shellfu import exit
5 5
 #
6 6
 # Application debug mode
7 7
 #
8
-PRETTY_DEBUG=${PRETTY_DEBUG:-false}
8
+PRETTY_DEBUG=${PRETTY_DEBUG:-}
9 9
 
10 10
 #
11 11
 # List of module/function names to exclude from debuging
@@ -24,7 +24,7 @@ PRETTY_DEBUG_EXCLUDE=${PRETTY_DEBUG_EXCLUDE:-}
24 24
 #
25 25
 # Application verbosity mode
26 26
 #
27
-PRETTY_VERBOSE=${PRETTY_VERBOSE:-false}
27
+PRETTY_VERBOSE=${PRETTY_VERBOSE:-}
28 28
 
29 29
 #
30 30
 # Name of pretty-printer module
@@ -76,7 +76,7 @@ debug() {
76 76
     #     debug "var1=$var1" "var2=$var2" "result=$result"
77 77
     #     debug -v var1 var2 result
78 78
     #
79
-    $PRETTY_DEBUG || return 0
79
+    test "$PRETTY_DEBUG" == true || return 0
80 80
     _pretty__echo "$@"
81 81
 }
82 82
 
@@ -214,7 +214,7 @@ think() {
214 214
     # Use "-l" to split every parameter to separate line, (useful
215 215
     # or longer warnings)
216 216
     #
217
-    $PRETTY_VERBOSE || return 0
217
+    test "$PRETTY_VERBOSE" == true || return 0
218 218
     _pretty__echo "$@"
219 219
 }
220 220
 
@@ -428,7 +428,7 @@ _pretty__echo_trace() {
428 428
     #
429 429
     # Print "decorated" call trace (only in debug mode)
430 430
     #
431
-    $PRETTY_DEBUG || return 0
431
+    test "$PRETTY_DEBUG" == true || return 0
432 432
     local depth
433 433
     echo "== trace =="
434 434
     for depth in $(seq 0 ${#FUNCNAME}); do