Skip to contentSkip to conversation

Revert "dracut-functions: $_x should exist, no need to test."

PATCH In review Chao Wang 3 participants 3 messages Aug 1, 2012 – Aug 2, 2012 2 messages not in the archive

lore
Share & tools
lore

Chao Wang

author
#0 lore raw

PATCH 1/1 Revert "dracut-functions: $_x should exist, no need to test."

This reverts commit b2d225a6698607bbcb73b6e6d12fbfc5be014102.

When there's no /sys/dev/block/$2/slaves/*/dev/ exists, $_x will be assigned with '/sys/dev/block/$2/slaves/*/dev/', this is invalid. That commit will lead to some warn msg like:
cat: /sys/dev/block/8:16/slaves/*/dev: No such file or directory
cat: /sys/dev/block/8:32/slaves/*/dev: No such file or directory

---
 dracut-functions.sh | 1 +
 1 file changed, 1 insertion(+)
dracut-functions.sh +1 -0
index a299bbb..2ad8f4a 100755
@@ -423,6 +423,7 @@ check_block_and_slaves() {
     fi
     [[ -d /sys/dev/block/$2/slaves ]] || return 1
     for _x in /sys/dev/block/$2/slaves/*/dev; do
+        [[ -f $_x ]] || continue
         check_block_and_slaves $1 $(cat "$_x") && return 0
     done
     return 1
Signature · 1 line
1.7.11.3

A message that is not in the archive (sent off-list or not yet received): 1343791422-8391-1-git-send-email-chaowang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#2 lore raw
Quoted 2 lines · Chao Wang

This reverts commit b2d225a6698607bbcb73b6e6d12fbfc5be014102.

For the record, your original commit could work after setting:

shopt -s nullglob

For failing globs this expands to empty string and the loop is never executed. All kinds of such checks could go away in any bash-expecting script.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 11 lines · Michal Soltys
Quoted 2 lines · Chao Wang

This reverts commit b2d225a6698607bbcb73b6e6d12fbfc5be014102.

For the record, your original commit could work after setting:

shopt -s nullglob

For failing globs this expands to empty string and the loop is never executed. All kinds of such checks could go away in any bash-expecting script.

Good to know! Thank you!

-Chao