Skip to contentSkip to conversation

umr: Completion: Fix regex for PCI bus names

PATCH New Luben Tuikov 1 participant 1 message May 18, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 umr: Completion: Fix regex for PCI bus names

Fix regex for PCI bus names. Previously we may see something like this:
0000:0b:00.0 master=pci:0000:0b:00.0
while the correct output should be this:
0000:0b:00.0
This commit fixes the regex to do just this.

---
 scripts/umr-completion.bash | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/umr-completion.bash +2 -2
index bd0b61b2d38831..0b8beab97b9aec 100644
@@ -128,10 +128,10 @@ _umr_comp_gpu()
     for F in ${INSTANCE[*]} ; do
 	PCI_BUS_DIR_NAMES+=("/sys/kernel/debug/dri/$F/name")
     done
-    PCI_BUS_IDS=( `sudo cat ${PCI_BUS_DIR_NAMES[*]} | sed -E -e 's/^.* (dev=(.*)) .*$/\2/g' | sort | uniq` )
+    PCI_BUS_IDS=( `sudo cat ${PCI_BUS_DIR_NAMES[*]} | sed -E -e 's/^.* (dev=([:.[:xdigit:]]+)) .*$/\2/g' | sort | uniq` )
 
     for F in ${INSTANCE[*]} ; do
-	local PCI_ID=`sudo cat  "/sys/kernel/debug/dri/$F/name" | sed -E -e 's/^.* (dev=(.*)) .*$/\2/g'`
+	local PCI_ID=`sudo cat  "/sys/kernel/debug/dri/$F/name" | sed -E -e 's/^.* (dev=([:.[:xdigit:]]+)) .*$/\2/g'`
 	local DEV_ID=`cat /sys/class/pci_bus/${PCI_ID%:??.?}/device/$PCI_ID/device`
 	local DEV_ID_NAME=`grep -i $DEV_ID ${UMR_DATABASE_PATH}/pci.did | awk '{ print $2; }' | sed -E -e 's/.asic//g'`
 	TEMP_ASIC_NAMES+=($DEV_ID_NAME)

base-commit: 513ea1dc11b4c0fd0c94910bf09dd84517febcae

Signature · 1 line
2.35.1.291.gdab1b7905d