Skip to contentSkip to conversation

scripts/decode_stacktrace: Match basepath using shell prefix operator, not regex

PATCH New Nicolas Boichat 1 participant 1 message May 18, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/decode_stacktrace: Match basepath using shell prefix operator, not regex

The basepath may contain special characters, which would confuse the regex matcher. ${var#prefix} does the right thing.

Fixes 67a28de47faa8358 ("scripts/decode_stacktrace: only strip base path when a prefix of the path")

---

I'm not sure how people normally use this script, but this seems to break even with a simple full path as parameter (e.g. /home/.../kernel/).

 scripts/decode_stacktrace.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/decode_stacktrace.sh +1 -1
index bcdd45df3f5127a..e042acedcc0332c 100755
@@ -85,7 +85,7 @@ parse_symbol() {
 	fi
 
 	# Strip out the base of the path
-	code=${code//^$basepath/""}
+	code=${code#$basepath/}
 
 	# In the case of inlines, move everything to same line
 	code=${code//$'\n'/' '}
Signature · 1 line
2.21.0.1020.gf2820cf01a-goog