Skip to contentSkip to conversation

common/{filter,quota}, xfs/1{06,52}: fix grep pattern

PATCH Superseded Murphy Zhou 3 participants 4 messages May 16, 2023 – May 17, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/{filter,quota}, xfs/1{06,52}: fix grep pattern

Newer(3.9) grep is complaining about these unnecessary backslashes before # and -, and breaking the golden output.

---
 common/filter | 2 +-
 common/quota  | 2 +-
 tests/xfs/106 | 4 ++--
 tests/xfs/152 | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)
common/filter +1 -1
index 3e3fea7e..f10ba78a 100644
@@ -293,7 +293,7 @@ _filter_project_quota()
 	# until the GETNEXTQUOTA ioctl came into use.  Filter it out.
 	# But if you specify a name for ID 0, that means you want to
 	# deal with it by yourself, this function won't filter it out.
-	_filter_quota | grep -v "^\#0 \|^(null) "
+	_filter_quota | grep -v "^#0 \|^(null) "
 }
 
 # Account for different "ln" failure messages
common/quota +1 -1
index 96b8d044..0a526e07 100644
@@ -191,7 +191,7 @@ _scratch_enable_pquota()
 _require_setquota_project()
 {
 	setquota --help 2>&1 | \
-		grep -q "\-P, \-\-project[[:space:]]*set limits for project"
+		grep -q "\-P, \--project[[:space:]]*set limits for project"
 	if [ "$?" -ne 0 ];then
 		_notrun "setquota doesn't support project quota (-P)"
 	fi
tests/xfs/106 +2 -2
index fc2281af..388873bd 100755
@@ -59,13 +59,13 @@ clean_files()
 
 filter_quot()
 {
-	_filter_quota | grep -v "root \|\#0 " \
+	_filter_quota | grep -v "root \|#0 " \
 		| sed -e '/#[0-9]*/s/#[0-9]*/#ID/g'
 }
 
 filter_report()
 {
-	_filter_quota | grep -v "^root \|^\#0 " \
+	_filter_quota | grep -v "^root \|^#0 " \
 		| sed -e '/^#[0-9]*/s/^#[0-9]*/#ID/g'
 }
 
tests/xfs/152 +2 -2
index dd33801d..325a05c1 100755
@@ -98,13 +98,13 @@ clean_files()
 
 filter_quot()
 {
-	_filter_quota | grep -v "root \|\#0 " \
+	_filter_quota | grep -v "root \|#0 " \
 		| sed -e '/#[0-9]*/s/#[0-9]*/#ID/g'
 }
 
 filter_report()
 {
-	_filter_quota | grep -v "^root \|^\#0 " \
+	_filter_quota | grep -v "^root \|^#0 " \
 		| sed -e '/^#[0-9]*/s/^#[0-9]*/#ID/g'
 }
 
Signature · 1 line
2.31.1
#1 lore raw
Quoted 2 lines · Murphy Zhou

Newer(3.9) grep is complaining about these unnecessary backslashes before # and -, and breaking the golden output.

Better to show what kind of warning output breaks the golden image at here.

Quoted 27 lines
---
 common/filter | 2 +-
 common/quota  | 2 +-
 tests/xfs/106 | 4 ++--
 tests/xfs/152 | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)
common/filter +1 -1
index 3e3fea7e..f10ba78a 100644
@@ -293,7 +293,7 @@ _filter_project_quota()
 	# until the GETNEXTQUOTA ioctl came into use.  Filter it out.
 	# But if you specify a name for ID 0, that means you want to
 	# deal with it by yourself, this function won't filter it out.
-	_filter_quota | grep -v "^\#0 \|^(null) "
+	_filter_quota | grep -v "^#0 \|^(null) "
 }
 
 # Account for different "ln" failure messages
common/quota +0 -0
index 96b8d044..0a526e07 100644

common/quota _scratch_enable_pquota() · line 194

Quoted 5 lines
common/quota +1 -1
@@ -191,7 +191,7 @@ _scratch_enable_pquota()
 _require_setquota_project()
 {
 	setquota --help 2>&1 | \
-		grep -q "\-P, \-\-project[[:space:]]*set limits for project"
+		grep -q "\-P, \--project[[:space:]]*set limits for project"

I think this change isn't enough, might still trigger the "grep: warning:
stray \ before -" warning. Better to change this line as:

  grep -q -- "-P, --project[[:space:]]*set limits for project"

Please confirm if it helps.

Thanks,
Zorro

Quoted 46 lines
common/quota +0 -0
 	if [ "$?" -ne 0 ];then
 		_notrun "setquota doesn't support project quota (-P)"
 	fi
tests/xfs/106 +2 -2
index fc2281af..388873bd 100755
@@ -59,13 +59,13 @@ clean_files()
 
 filter_quot()
 {
-	_filter_quota | grep -v "root \|\#0 " \
+	_filter_quota | grep -v "root \|#0 " \
 		| sed -e '/#[0-9]*/s/#[0-9]*/#ID/g'
 }
 
 filter_report()
 {
-	_filter_quota | grep -v "^root \|^\#0 " \
+	_filter_quota | grep -v "^root \|^#0 " \
 		| sed -e '/^#[0-9]*/s/^#[0-9]*/#ID/g'
 }
 
tests/xfs/152 +2 -2
index dd33801d..325a05c1 100755
@@ -98,13 +98,13 @@ clean_files()
 
 filter_quot()
 {
-	_filter_quota | grep -v "root \|\#0 " \
+	_filter_quota | grep -v "root \|#0 " \
 		| sed -e '/#[0-9]*/s/#[0-9]*/#ID/g'
 }
 
 filter_report()
 {
-	_filter_quota | grep -v "^root \|^\#0 " \
+	_filter_quota | grep -v "^root \|^#0 " \
 		| sed -e '/^#[0-9]*/s/^#[0-9]*/#ID/g'
 }
 
Signature · 1 line
2.31.1
#2 lore raw
Quoted 29 lines · Zorro Lang
Quoted 2 lines · Murphy Zhou

Newer(3.9) grep is complaining about these unnecessary backslashes before # and -, and breaking the golden output.

Better to show what kind of warning output breaks the golden image at here.

Quoted 21 lines
---
 common/filter | 2 +-
 common/quota  | 2 +-
 tests/xfs/106 | 4 ++--
 tests/xfs/152 | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)
common/filter +1 -1
index 3e3fea7e..f10ba78a 100644
@@ -293,7 +293,7 @@ _filter_project_quota()
      # until the GETNEXTQUOTA ioctl came into use.  Filter it out.
      # But if you specify a name for ID 0, that means you want to
      # deal with it by yourself, this function won't filter it out.
-     _filter_quota | grep -v "^\#0 \|^(null) "
+     _filter_quota | grep -v "^#0 \|^(null) "
 }
 
Quoted 14 lines

common/quota _scratch_enable_pquota() · line 194

Quoted 11 lines
common/filter +0 -0
 # Account for different "ln" failure messages
common/quota +1 -1
index 96b8d044..0a526e07 100644
@@ -191,7 +191,7 @@ _scratch_enable_pquota()
 _require_setquota_project()
 {
      setquota --help 2>&1 | \
-             grep -q "\-P, \-\-project[[:space:]]*set limits for project"
+             grep -q "\-P, \--project[[:space:]]*set limits for project"

I think this change isn't enough, might still trigger the "grep: warning:
stray \ before -" warning. Better to change this line as:

In my test, it works well. No more warnings.

Thanks,

Quoted 55 lines
  grep -q -- "-P, --project[[:space:]]*set limits for project"

Please confirm if it helps.

Thanks,
Zorro

Quoted 46 lines
common/quota +0 -0
      if [ "$?" -ne 0 ];then
              _notrun "setquota doesn't support project quota (-P)"
      fi
tests/xfs/106 +2 -2
index fc2281af..388873bd 100755
@@ -59,13 +59,13 @@ clean_files()
 
 filter_quot()
 {
-     _filter_quota | grep -v "root \|\#0 " \
+     _filter_quota | grep -v "root \|#0 " \
              | sed -e '/#[0-9]*/s/#[0-9]*/#ID/g'
 }
 
 filter_report()
 {
-     _filter_quota | grep -v "^root \|^\#0 " \
+     _filter_quota | grep -v "^root \|^#0 " \
              | sed -e '/^#[0-9]*/s/^#[0-9]*/#ID/g'
 }
 
tests/xfs/152 +2 -3
index dd33801d..325a05c1 100755
@@ -98,13 +98,13 @@ clean_files()
 
 filter_quot()
 {
-     _filter_quota | grep -v "root \|\#0 " \
+     _filter_quota | grep -v "root \|#0 " \
              | sed -e '/#[0-9]*/s/#[0-9]*/#ID/g'
 }
 
 filter_report()
 {
-     _filter_quota | grep -v "^root \|^\#0 " \
+     _filter_quota | grep -v "^root \|^#0 " \
              | sed -e '/^#[0-9]*/s/^#[0-9]*/#ID/g'
 }
 
--

2.31.1

#3 lore raw

Oops, wrong email used. Sorry for the noise.

Quoted 105 lines · Murphy Zhou
Quoted 29 lines · Zorro Lang
Quoted 2 lines · Murphy Zhou

Newer(3.9) grep is complaining about these unnecessary backslashes before # and -, and breaking the golden output.

Better to show what kind of warning output breaks the golden image at here.

Quoted 21 lines
---
 common/filter | 2 +-
 common/quota  | 2 +-
 tests/xfs/106 | 4 ++--
 tests/xfs/152 | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)
common/filter +1 -1
index 3e3fea7e..f10ba78a 100644
@@ -293,7 +293,7 @@ _filter_project_quota()
      # until the GETNEXTQUOTA ioctl came into use.  Filter it out.
      # But if you specify a name for ID 0, that means you want to
      # deal with it by yourself, this function won't filter it out.
-     _filter_quota | grep -v "^\#0 \|^(null) "
+     _filter_quota | grep -v "^#0 \|^(null) "
 }
 
Quoted 14 lines

common/quota _scratch_enable_pquota() · line 194

Quoted 11 lines
common/filter +0 -0
 # Account for different "ln" failure messages
common/quota +1 -1
index 96b8d044..0a526e07 100644
@@ -191,7 +191,7 @@ _scratch_enable_pquota()
 _require_setquota_project()
 {
      setquota --help 2>&1 | \
-             grep -q "\-P, \-\-project[[:space:]]*set limits for project"
+             grep -q "\-P, \--project[[:space:]]*set limits for project"

I think this change isn't enough, might still trigger the "grep: warning:
stray \ before -" warning. Better to change this line as:

In my test, it works well. No more warnings.

Thanks,

Quoted 55 lines
  grep -q -- "-P, --project[[:space:]]*set limits for project"

Please confirm if it helps.

Thanks,
Zorro

Quoted 46 lines
common/quota +0 -0
      if [ "$?" -ne 0 ];then
              _notrun "setquota doesn't support project quota (-P)"
      fi
tests/xfs/106 +2 -2
index fc2281af..388873bd 100755
@@ -59,13 +59,13 @@ clean_files()
 
 filter_quot()
 {
-     _filter_quota | grep -v "root \|\#0 " \
+     _filter_quota | grep -v "root \|#0 " \
              | sed -e '/#[0-9]*/s/#[0-9]*/#ID/g'
 }
 
 filter_report()
 {
-     _filter_quota | grep -v "^root \|^\#0 " \
+     _filter_quota | grep -v "^root \|^#0 " \
              | sed -e '/^#[0-9]*/s/^#[0-9]*/#ID/g'
 }
 
tests/xfs/152 +2 -3
index dd33801d..325a05c1 100755
@@ -98,13 +98,13 @@ clean_files()
 
 filter_quot()
 {
-     _filter_quota | grep -v "root \|\#0 " \
+     _filter_quota | grep -v "root \|#0 " \
              | sed -e '/#[0-9]*/s/#[0-9]*/#ID/g'
 }
 
 filter_report()
 {
-     _filter_quota | grep -v "^root \|^\#0 " \
+     _filter_quota | grep -v "^root \|^#0 " \
              | sed -e '/^#[0-9]*/s/^#[0-9]*/#ID/g'
 }
 
--

2.31.1