Skip to contentSkip to conversation

xfs/019: extend protofile test

PATCH In review Catherine Hoang 4 participants 9 messages Mar 17, 2022 – Mar 28, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs/019: extend protofile test

This test creates an xfs filesystem and verifies that the filesystem matches what is specified by the protofile.

This patch extends the current test to check that a protofile can specify setgid mode on directories. Also, check that the created symlink isn’t broken.

---
 tests/xfs/019     |  6 ++++++
 tests/xfs/019.out | 12 +++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)
tests/xfs/019 +6 -0
index 3dfd5408..535b7af1 100755
@@ -73,6 +73,10 @@ $
 setuid -u-666 0 0 $tempfile
 setgid --g666 0 0 $tempfile
 setugid -ug666 0 0 $tempfile
+directory_setgid d-g755 3 2
+file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_5 ---755 3 1 $tempfile
+$
+: back in the root
 block_device b--012 3 1 161 162 
 char_device c--345 3 1 177 178
 pipe p--670 0 0
@@ -114,6 +118,8 @@ _verify_fs()
 		| xargs $here/src/lstat64 | _filter_stat)
 	diff -q $SCRATCH_MNT/bigfile $tempfile.2 \
 		|| _fail "bigfile corrupted"
+	diff -q $SCRATCH_MNT/symlink $tempfile.2 \
+		|| _fail "symlink broken"
 
 	echo "*** unmount FS"
 	_full "umount"
tests/xfs/019.out +11 -1
index 19614d9d..8584f593 100644
@@ -7,7 +7,7 @@ Wrote 2048.00Kb (value 0x2c)
  File: "."
  Size: <DSIZE> Filetype: Directory
  Mode: (0777/drwxrwxrwx) Uid: (3) Gid: (1)
-Device: <DEVICE> Inode: <INODE> Links: 3 
+Device: <DEVICE> Inode: <INODE> Links: 4 
 
  File: "./bigfile"
  Size: 2097152 Filetype: Regular File
@@ -54,6 +54,16 @@ Device: <DEVICE> Inode: <INODE> Links: 1
  Mode: (0755/-rwxr-xr-x) Uid: (3) Gid: (1)
 Device: <DEVICE> Inode: <INODE> Links: 1 
 
+ File: "./directory_setgid"
+ Size: <DSIZE> Filetype: Directory
+ Mode: (2755/drwxr-sr-x) Uid: (3) Gid: (2)
+Device: <DEVICE> Inode: <INODE> Links: 2 
+
+ File: "./directory_setgid/file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_5"
+ Size: 5 Filetype: Regular File
+ Mode: (0755/-rwxr-xr-x) Uid: (3) Gid: (2)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+
  File: "./pipe"
  Size: 0 Filetype: Fifo File
  Mode: (0670/frw-rwx---) Uid: (0) Gid: (0)
Signature · 1 line
2.25.1
#1 lore raw
Quoted 9 lines · Catherine Hoang

This test creates an xfs filesystem and verifies that the filesystem matches what is specified by the protofile.

This patch extends the current test to check that a protofile can specify setgid mode on directories. Also, check that the created symlink isn’t broken.

---

Any specific reason to add this test? Likes uncovering some one known bug/fix?

Thanks,
Zorro

Quoted 61 lines
 tests/xfs/019     |  6 ++++++
 tests/xfs/019.out | 12 +++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)
tests/xfs/019 +6 -0
index 3dfd5408..535b7af1 100755
@@ -73,6 +73,10 @@ $
 setuid -u-666 0 0 $tempfile
 setgid --g666 0 0 $tempfile
 setugid -ug666 0 0 $tempfile
+directory_setgid d-g755 3 2
+file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_5 ---755 3 1 $tempfile
+$
+: back in the root
 block_device b--012 3 1 161 162 
 char_device c--345 3 1 177 178
 pipe p--670 0 0
@@ -114,6 +118,8 @@ _verify_fs()
 		| xargs $here/src/lstat64 | _filter_stat)
 	diff -q $SCRATCH_MNT/bigfile $tempfile.2 \
 		|| _fail "bigfile corrupted"
+	diff -q $SCRATCH_MNT/symlink $tempfile.2 \
+		|| _fail "symlink broken"
 
 	echo "*** unmount FS"
 	_full "umount"
tests/xfs/019.out +11 -1
index 19614d9d..8584f593 100644
@@ -7,7 +7,7 @@ Wrote 2048.00Kb (value 0x2c)
  File: "."
  Size: <DSIZE> Filetype: Directory
  Mode: (0777/drwxrwxrwx) Uid: (3) Gid: (1)
-Device: <DEVICE> Inode: <INODE> Links: 3 
+Device: <DEVICE> Inode: <INODE> Links: 4 
 
  File: "./bigfile"
  Size: 2097152 Filetype: Regular File
@@ -54,6 +54,16 @@ Device: <DEVICE> Inode: <INODE> Links: 1
  Mode: (0755/-rwxr-xr-x) Uid: (3) Gid: (1)
 Device: <DEVICE> Inode: <INODE> Links: 1 
 
+ File: "./directory_setgid"
+ Size: <DSIZE> Filetype: Directory
+ Mode: (2755/drwxr-sr-x) Uid: (3) Gid: (2)
+Device: <DEVICE> Inode: <INODE> Links: 2 
+
+ File: "./directory_setgid/file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_5"
+ Size: 5 Filetype: Regular File
+ Mode: (0755/-rwxr-xr-x) Uid: (3) Gid: (2)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+
  File: "./pipe"
  Size: 0 Filetype: Fifo File
  Mode: (0670/frw-rwx---) Uid: (0) Gid: (0)
Signature · 1 line
2.25.1
#2 lore raw
Quoted 10 lines · Zorro Lang
Quoted 7 lines · Catherine Hoang

This test creates an xfs filesystem and verifies that the filesystem matches what is specified by the protofile.

This patch extends the current test to check that a protofile can specify setgid mode on directories. Also, check that the created symlink isn’t broken.

Quoted 8 lines
Quoted 2 lines

---

Any specific reason to add this test? Likes uncovering some one known bug/fix?

Thanks,
Zorro

Hi Zorro,

We’ve been exploring alternate uses for protofiles and noticed a few holes in the testing.

Thanks,
Catherine

Quoted 63 lines
Quoted 62 lines

tests/xfs/019 | 6 ++++++
tests/xfs/019.out | 12 +++++++++++-

2 files changed, 17 insertions(+), 1 deletion(-)
tests/xfs/019 +0 -0
index 3dfd5408..535b7af1 100755
@@ -73,6 +73,10 @@ $

setuid -u-666 0 0 $tempfile
setgid --g666 0 0 $tempfile
setugid -ug666 0 0 $tempfile

tests/xfs/019 +4 -0
+directory_setgid d-g755 3 2
+file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_5 ---755 3 1 $tempfile
+$
+: back in the root

block_device b--012 3 1 161 162
char_device c--345 3 1 177 178
pipe p--670 0 0

tests/xfs/019 +2 -0
@@ -114,6 +118,8 @@ _verify_fs()
 		| xargs $here/src/lstat64 | _filter_stat)
 	diff -q $SCRATCH_MNT/bigfile $tempfile.2 \
 		|| _fail "bigfile corrupted"
+	diff -q $SCRATCH_MNT/symlink $tempfile.2 \
+		|| _fail "symlink broken"
 
 	echo "*** unmount FS"
 	_full "umount"
tests/xfs/019.out +1 -1
index 19614d9d..8584f593 100644
@@ -7,7 +7,7 @@ Wrote 2048.00Kb (value 0x2c)
 File: "."
 Size: <DSIZE> Filetype: Directory
 Mode: (0777/drwxrwxrwx) Uid: (3) Gid: (1)
-Device: <DEVICE> Inode: <INODE> Links: 3 
+Device: <DEVICE> Inode: <INODE> Links: 4 
 
 File: "./bigfile"
 Size: 2097152 Filetype: Regular File
@@ -54,6 +54,16 @@ Device: <DEVICE> Inode: <INODE> Links: 1
 Mode: (0755/-rwxr-xr-x) Uid: (3) Gid: (1)

Device: <DEVICE> Inode: <INODE> Links: 1

+ File: "./directory_setgid"
+ Size: <DSIZE> Filetype: Directory
+ Mode: (2755/drwxr-sr-x) Uid: (3) Gid: (2)

tests/xfs/019.out +7 -0
+Device: <DEVICE> Inode: <INODE> Links: 2 
+
+ File: "./directory_setgid/file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_5"
+ Size: 5 Filetype: Regular File
+ Mode: (0755/-rwxr-xr-x) Uid: (3) Gid: (2)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+
 File: "./pipe"
 Size: 0 Filetype: Fifo File
 Mode: (0670/frw-rwx---) Uid: (0) Gid: (0)
Signature · 1 line
2.25.1
#3 lore raw
Quoted 16 lines · Catherine Hoang
Quoted 16 lines · Zorro Lang
Quoted 9 lines · Catherine Hoang

This test creates an xfs filesystem and verifies that the filesystem matches what is specified by the protofile.

This patch extends the current test to check that a protofile can specify setgid mode on directories. Also, check that the created symlink isn’t broken.

---

Any specific reason to add this test? Likes uncovering some one known bug/fix?

Quoted 7 lines
Quoted 2 lines

Thanks,
Zorro

Hi Zorro,

We’ve been exploring alternate uses for protofiles and noticed a few holes in the testing.

That's great, but better to show some details in the patch/commit, likes a commit id of xfsprogs?/kernel? (if there's one) which fix the bug you metioned, to help others to know what's this change trying to cover.

Thanks,
Zorro

Quoted 67 lines

Thanks,
Catherine

Quoted 63 lines
Quoted 62 lines

tests/xfs/019 | 6 ++++++
tests/xfs/019.out | 12 +++++++++++-

2 files changed, 17 insertions(+), 1 deletion(-)
tests/xfs/019 +0 -0
index 3dfd5408..535b7af1 100755
@@ -73,6 +73,10 @@ $

setuid -u-666 0 0 $tempfile
setgid --g666 0 0 $tempfile
setugid -ug666 0 0 $tempfile

tests/xfs/019 +4 -0
+directory_setgid d-g755 3 2
+file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_5 ---755 3 1 $tempfile
+$
+: back in the root

block_device b--012 3 1 161 162
char_device c--345 3 1 177 178
pipe p--670 0 0

tests/xfs/019 +2 -0
@@ -114,6 +118,8 @@ _verify_fs()
 		| xargs $here/src/lstat64 | _filter_stat)
 	diff -q $SCRATCH_MNT/bigfile $tempfile.2 \
 		|| _fail "bigfile corrupted"
+	diff -q $SCRATCH_MNT/symlink $tempfile.2 \
+		|| _fail "symlink broken"
 
 	echo "*** unmount FS"
 	_full "umount"
tests/xfs/019.out +1 -1
index 19614d9d..8584f593 100644
@@ -7,7 +7,7 @@ Wrote 2048.00Kb (value 0x2c)
 File: "."
 Size: <DSIZE> Filetype: Directory
 Mode: (0777/drwxrwxrwx) Uid: (3) Gid: (1)
-Device: <DEVICE> Inode: <INODE> Links: 3 
+Device: <DEVICE> Inode: <INODE> Links: 4 
 
 File: "./bigfile"
 Size: 2097152 Filetype: Regular File
@@ -54,6 +54,16 @@ Device: <DEVICE> Inode: <INODE> Links: 1
 Mode: (0755/-rwxr-xr-x) Uid: (3) Gid: (1)

Device: <DEVICE> Inode: <INODE> Links: 1

+ File: "./directory_setgid"
+ Size: <DSIZE> Filetype: Directory
+ Mode: (2755/drwxr-sr-x) Uid: (3) Gid: (2)

tests/xfs/019.out +7 -0
+Device: <DEVICE> Inode: <INODE> Links: 2 
+
+ File: "./directory_setgid/file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_5"
+ Size: 5 Filetype: Regular File
+ Mode: (0755/-rwxr-xr-x) Uid: (3) Gid: (2)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+
 File: "./pipe"
 Size: 0 Filetype: Fifo File
 Mode: (0670/frw-rwx---) Uid: (0) Gid: (0)
Signature · 1 line
2.25.1
#4 lore raw
Quoted 20 lines · Zorro Lang
Quoted 19 lines · Catherine Hoang
Quoted 18 lines · Zorro Lang
Quoted 9 lines · Catherine Hoang

This test creates an xfs filesystem and verifies that the filesystem matches what is specified by the protofile.

This patch extends the current test to check that a protofile can specify setgid mode on directories. Also, check that the created symlink isn’t broken.

---

Any specific reason to add this test? Likes uncovering some one known bug/fix?

Thanks,
Zorro

Quoted 8 lines
Quoted 4 lines

Hi Zorro,

We’ve been exploring alternate uses for protofiles and noticed a few holes in the testing.

That's great, but better to show some details in the patch/commit, likes a commit id of xfsprogs?/kernel? (if there's one) which fix the bug you metioned, to help others to know what's this change trying to cover.

I think this patch is adding a check that protofile lines are actually being honored (in the case of the symlink file) and checking that setgid on a directory is not carried over into new children unless the protofile explicitly marks the children setgid.

IOWs, this isn't adding a regression test for a fix in xfsprogs, it's increasing test coverage.

--D

Quoted 71 lines

Thanks,
Zorro

Quoted 67 lines

Thanks,
Catherine

Quoted 63 lines
Quoted 62 lines

tests/xfs/019 | 6 ++++++
tests/xfs/019.out | 12 +++++++++++-

2 files changed, 17 insertions(+), 1 deletion(-)
tests/xfs/019 +0 -0
index 3dfd5408..535b7af1 100755
@@ -73,6 +73,10 @@ $

setuid -u-666 0 0 $tempfile
setgid --g666 0 0 $tempfile
setugid -ug666 0 0 $tempfile

tests/xfs/019 +4 -0
+directory_setgid d-g755 3 2
+file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_5 ---755 3 1 $tempfile
+$
+: back in the root

block_device b--012 3 1 161 162
char_device c--345 3 1 177 178
pipe p--670 0 0

tests/xfs/019 +2 -0
@@ -114,6 +118,8 @@ _verify_fs()
 		| xargs $here/src/lstat64 | _filter_stat)
 	diff -q $SCRATCH_MNT/bigfile $tempfile.2 \
 		|| _fail "bigfile corrupted"
+	diff -q $SCRATCH_MNT/symlink $tempfile.2 \
+		|| _fail "symlink broken"
 
 	echo "*** unmount FS"
 	_full "umount"
tests/xfs/019.out +1 -1
index 19614d9d..8584f593 100644
@@ -7,7 +7,7 @@ Wrote 2048.00Kb (value 0x2c)
 File: "."
 Size: <DSIZE> Filetype: Directory
 Mode: (0777/drwxrwxrwx) Uid: (3) Gid: (1)
-Device: <DEVICE> Inode: <INODE> Links: 3 
+Device: <DEVICE> Inode: <INODE> Links: 4 
 
 File: "./bigfile"
 Size: 2097152 Filetype: Regular File
@@ -54,6 +54,16 @@ Device: <DEVICE> Inode: <INODE> Links: 1
 Mode: (0755/-rwxr-xr-x) Uid: (3) Gid: (1)

Device: <DEVICE> Inode: <INODE> Links: 1

+ File: "./directory_setgid"
+ Size: <DSIZE> Filetype: Directory
+ Mode: (2755/drwxr-sr-x) Uid: (3) Gid: (2)

tests/xfs/019.out +7 -0
+Device: <DEVICE> Inode: <INODE> Links: 2 
+
+ File: "./directory_setgid/file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_5"
+ Size: 5 Filetype: Regular File
+ Mode: (0755/-rwxr-xr-x) Uid: (3) Gid: (2)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+
 File: "./pipe"
 Size: 0 Filetype: Fifo File
 Mode: (0670/frw-rwx---) Uid: (0) Gid: (0)
Signature · 1 line
2.25.1
#5 lore raw
Quoted 30 lines · Darrick J. Wong
Quoted 20 lines · Zorro Lang
Quoted 19 lines · Catherine Hoang
Quoted 18 lines · Zorro Lang
Quoted 9 lines · Catherine Hoang

This test creates an xfs filesystem and verifies that the filesystem matches what is specified by the protofile.

This patch extends the current test to check that a protofile can specify setgid mode on directories. Also, check that the created symlink isn’t broken.

---

Any specific reason to add this test? Likes uncovering some one known bug/fix?

Thanks,
Zorro

Quoted 8 lines
Quoted 4 lines

Hi Zorro,

We’ve been exploring alternate uses for protofiles and noticed a few holes in the testing.

That's great, but better to show some details in the patch/commit, likes a commit id of xfsprogs?/kernel? (if there's one) which fix the bug you metioned, to help others to know what's this change trying to cover.

Quoted 7 lines

I think this patch is adding a check that protofile lines are actually being honored (in the case of the symlink file) and checking that setgid on a directory is not carried over into new children unless the protofile explicitly marks the children setgid.

IOWs, this isn't adding a regression test for a fix in xfsprogs, it's increasing test coverage.

Oh, understand, I have no objection with this patch, just thought it covers a known bug :) If it's good to you too, let's ACK it.

Thanks,
Zorro

Quoted 75 lines

--D

Quoted 71 lines

Thanks,
Zorro

Quoted 67 lines

Thanks,
Catherine

Quoted 63 lines
Quoted 62 lines

tests/xfs/019 | 6 ++++++
tests/xfs/019.out | 12 +++++++++++-

2 files changed, 17 insertions(+), 1 deletion(-)
tests/xfs/019 +0 -0
index 3dfd5408..535b7af1 100755
@@ -73,6 +73,10 @@ $

setuid -u-666 0 0 $tempfile
setgid --g666 0 0 $tempfile
setugid -ug666 0 0 $tempfile

tests/xfs/019 +4 -0
+directory_setgid d-g755 3 2
+file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_5 ---755 3 1 $tempfile
+$
+: back in the root

block_device b--012 3 1 161 162
char_device c--345 3 1 177 178
pipe p--670 0 0

tests/xfs/019 +2 -0
@@ -114,6 +118,8 @@ _verify_fs()
 		| xargs $here/src/lstat64 | _filter_stat)
 	diff -q $SCRATCH_MNT/bigfile $tempfile.2 \
 		|| _fail "bigfile corrupted"
+	diff -q $SCRATCH_MNT/symlink $tempfile.2 \
+		|| _fail "symlink broken"
 
 	echo "*** unmount FS"
 	_full "umount"
tests/xfs/019.out +1 -1
index 19614d9d..8584f593 100644
@@ -7,7 +7,7 @@ Wrote 2048.00Kb (value 0x2c)
 File: "."
 Size: <DSIZE> Filetype: Directory
 Mode: (0777/drwxrwxrwx) Uid: (3) Gid: (1)
-Device: <DEVICE> Inode: <INODE> Links: 3 
+Device: <DEVICE> Inode: <INODE> Links: 4 
 
 File: "./bigfile"
 Size: 2097152 Filetype: Regular File
@@ -54,6 +54,16 @@ Device: <DEVICE> Inode: <INODE> Links: 1
 Mode: (0755/-rwxr-xr-x) Uid: (3) Gid: (1)

Device: <DEVICE> Inode: <INODE> Links: 1

+ File: "./directory_setgid"
+ Size: <DSIZE> Filetype: Directory
+ Mode: (2755/drwxr-sr-x) Uid: (3) Gid: (2)

tests/xfs/019.out +7 -0
+Device: <DEVICE> Inode: <INODE> Links: 2 
+
+ File: "./directory_setgid/file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_5"
+ Size: 5 Filetype: Regular File
+ Mode: (0755/-rwxr-xr-x) Uid: (3) Gid: (2)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+
 File: "./pipe"
 Size: 0 Filetype: Fifo File
 Mode: (0670/frw-rwx---) Uid: (0) Gid: (0)
Signature · 1 line
2.25.1
Reviewed-by
#6 lore raw
Quoted 36 lines · Zorro Lang
Quoted 35 lines · Darrick J. Wong
Quoted 20 lines · Zorro Lang
Quoted 19 lines · Catherine Hoang
Quoted 18 lines · Zorro Lang
Quoted 9 lines · Catherine Hoang

This test creates an xfs filesystem and verifies that the filesystem matches what is specified by the protofile.

This patch extends the current test to check that a protofile can specify setgid mode on directories. Also, check that the created symlink isn’t broken.

---

Any specific reason to add this test? Likes uncovering some one known bug/fix?

Thanks,
Zorro

Quoted 8 lines
Quoted 4 lines

Hi Zorro,

We’ve been exploring alternate uses for protofiles and noticed a few holes in the testing.

That's great, but better to show some details in the patch/commit, likes a commit id of xfsprogs?/kernel? (if there's one) which fix the bug you metioned, to help others to know what's this change trying to cover.

I think this patch is adding a check that protofile lines are actually being honored (in the case of the symlink file) and checking that setgid on a directory is not carried over into new children unless the protofile explicitly marks the children setgid.

Quoted 5 lines
Quoted 2 lines

IOWs, this isn't adding a regression test for a fix in xfsprogs, it's increasing test coverage.

Oh, understand, I have no objection with this patch, just thought it covers a known bug :) If it's good to you too, let's ACK it.

Yes!

--D

Quoted 80 lines

Thanks,
Zorro

Quoted 75 lines

--D

Quoted 71 lines

Thanks,
Zorro

Quoted 67 lines

Thanks,
Catherine

Quoted 63 lines
Quoted 62 lines

tests/xfs/019 | 6 ++++++
tests/xfs/019.out | 12 +++++++++++-

2 files changed, 17 insertions(+), 1 deletion(-)
tests/xfs/019 +0 -0
index 3dfd5408..535b7af1 100755
@@ -73,6 +73,10 @@ $

setuid -u-666 0 0 $tempfile
setgid --g666 0 0 $tempfile
setugid -ug666 0 0 $tempfile

tests/xfs/019 +4 -0
+directory_setgid d-g755 3 2
+file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_5 ---755 3 1 $tempfile
+$
+: back in the root

block_device b--012 3 1 161 162
char_device c--345 3 1 177 178
pipe p--670 0 0

tests/xfs/019 +2 -0
@@ -114,6 +118,8 @@ _verify_fs()
 		| xargs $here/src/lstat64 | _filter_stat)
 	diff -q $SCRATCH_MNT/bigfile $tempfile.2 \
 		|| _fail "bigfile corrupted"
+	diff -q $SCRATCH_MNT/symlink $tempfile.2 \
+		|| _fail "symlink broken"
 
 	echo "*** unmount FS"
 	_full "umount"
tests/xfs/019.out +1 -1
index 19614d9d..8584f593 100644
@@ -7,7 +7,7 @@ Wrote 2048.00Kb (value 0x2c)
 File: "."
 Size: <DSIZE> Filetype: Directory
 Mode: (0777/drwxrwxrwx) Uid: (3) Gid: (1)
-Device: <DEVICE> Inode: <INODE> Links: 3 
+Device: <DEVICE> Inode: <INODE> Links: 4 
 
 File: "./bigfile"
 Size: 2097152 Filetype: Regular File
@@ -54,6 +54,16 @@ Device: <DEVICE> Inode: <INODE> Links: 1
 Mode: (0755/-rwxr-xr-x) Uid: (3) Gid: (1)

Device: <DEVICE> Inode: <INODE> Links: 1

+ File: "./directory_setgid"
+ Size: <DSIZE> Filetype: Directory
+ Mode: (2755/drwxr-sr-x) Uid: (3) Gid: (2)

tests/xfs/019.out +7 -0
+Device: <DEVICE> Inode: <INODE> Links: 2 
+
+ File: "./directory_setgid/file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_5"
+ Size: 5 Filetype: Regular File
+ Mode: (0755/-rwxr-xr-x) Uid: (3) Gid: (2)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+
 File: "./pipe"
 Size: 0 Filetype: Fifo File
 Mode: (0670/frw-rwx---) Uid: (0) Gid: (0)
Signature · 1 line
2.25.1
#7 lore raw
Quoted 42 lines · Darrick J. Wong
Quoted 39 lines · Zorro Lang
Quoted 37 lines · Darrick J. Wong
Quoted 20 lines · Zorro Lang
Quoted 19 lines · Catherine Hoang
Quoted 18 lines · Zorro Lang
Quoted 9 lines · Catherine Hoang

This test creates an xfs filesystem and verifies that the filesystem matches what is specified by the protofile.

This patch extends the current test to check that a protofile can specify setgid mode on directories. Also, check that the created symlink isn’t broken.

---

Any specific reason to add this test? Likes uncovering some one known bug/fix?

Thanks,
Zorro

Quoted 8 lines
Quoted 4 lines

Hi Zorro,

We’ve been exploring alternate uses for protofiles and noticed a few holes in the testing.

That's great, but better to show some details in the patch/commit, likes a commit id of xfsprogs?/kernel? (if there's one) which fix the bug you metioned, to help others to know what's this change trying to cover.

I think this patch is adding a check that protofile lines are actually being honored (in the case of the symlink file) and checking that setgid on a directory is not carried over into new children unless the protofile explicitly marks the children setgid.

IOWs, this isn't adding a regression test for a fix in xfsprogs, it's increasing test coverage.

Quoted 7 lines
Quoted 2 lines

Oh, understand, I have no objection with this patch, just thought it covers a known bug :) If it's good to you too, let's ACK it.

Yes!

--D

Thanks Darrick!

Quoted 81 lines
Quoted 81 lines

Thanks,
Zorro

Quoted 75 lines

--D

Quoted 71 lines

Thanks,
Zorro

Quoted 67 lines

Thanks,
Catherine

Quoted 63 lines
Quoted 62 lines

tests/xfs/019 | 6 ++++++
tests/xfs/019.out | 12 +++++++++++-

2 files changed, 17 insertions(+), 1 deletion(-)
tests/xfs/019 +0 -0
index 3dfd5408..535b7af1 100755
@@ -73,6 +73,10 @@ $

setuid -u-666 0 0 $tempfile
setgid --g666 0 0 $tempfile
setugid -ug666 0 0 $tempfile

tests/xfs/019 +4 -0
+directory_setgid d-g755 3 2
+file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_5 ---755 3 1 $tempfile
+$
+: back in the root

block_device b--012 3 1 161 162
char_device c--345 3 1 177 178
pipe p--670 0 0

tests/xfs/019 +2 -0
@@ -114,6 +118,8 @@ _verify_fs()
 		| xargs $here/src/lstat64 | _filter_stat)
 	diff -q $SCRATCH_MNT/bigfile $tempfile.2 \
 		|| _fail "bigfile corrupted"
+	diff -q $SCRATCH_MNT/symlink $tempfile.2 \
+		|| _fail "symlink broken"
 
 	echo "*** unmount FS"
 	_full "umount"
tests/xfs/019.out +0 -0
index 19614d9d..8584f593 100644
@@ -7,7 +7,7 @@ Wrote 2048.00Kb (value 0x2c)

File: "."
Size: <DSIZE> Filetype: Directory
Mode: (0777/drwxrwxrwx) Uid: (3) Gid: (1)

tests/xfs/019.out +1 -1
-Device: <DEVICE> Inode: <INODE> Links: 3 
+Device: <DEVICE> Inode: <INODE> Links: 4 

File: "./bigfile"
Size: 2097152 Filetype: Regular File

tests/xfs/019.out +0 -0
@@ -54,6 +54,16 @@ Device: <DEVICE> Inode: <INODE> Links: 1
 Mode: (0755/-rwxr-xr-x) Uid: (3) Gid: (1)

Device: <DEVICE> Inode: <INODE> Links: 1

+ File: "./directory_setgid"
+ Size: <DSIZE> Filetype: Directory
+ Mode: (2755/drwxr-sr-x) Uid: (3) Gid: (2)

tests/xfs/019.out +7 -0
+Device: <DEVICE> Inode: <INODE> Links: 2 
+
+ File: "./directory_setgid/file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_5"
+ Size: 5 Filetype: Regular File
+ Mode: (0755/-rwxr-xr-x) Uid: (3) Gid: (2)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+

File: "./pipe"
Size: 0 Filetype: Fifo File
Mode: (0670/frw-rwx---) Uid: (0) Gid: (0)

Signature · 1 line
2.25.1
Reviewed-by Allison Henderson
#8 lore raw
In reply to Darrick J. Wong
Quoted 55 lines · Darrick J. Wong
Quoted 54 lines · Zorro Lang
Quoted 52 lines · Darrick J. Wong
Quoted 34 lines · Zorro Lang
Quoted 23 lines · Catherine Hoang
Quoted 23 lines

On Mar 22, 2022, at 6:36 PM, Zorro Lang <[email protected]> wrote:

Quoted 10 lines · Catherine Hoang

This test creates an xfs filesystem and verifies that the filesystem
matches what is specified by the protofile.

This patch extends the current test to check that a protofile can specify
setgid mode on directories. Also, check that the created symlink isn’t
broken.

Quoted 3 lines

Signed-off-by: Catherine Hoang < [email protected]>
---

Any specific reason to add this test? Likes uncovering some one known
bug/fix?

Quoted 8 lines
Quoted 2 lines

Thanks,
Zorro

Hi Zorro,

We’ve been exploring alternate uses for protofiles and noticed a few holes
in the testing.

Quoted 6 lines

That's great, but better to show some details in the patch/commit, likes
a commit id of xfsprogs?/kernel? (if there's one) which fix the bug you
metioned, to help others to know what's this change trying to cover.

I think this patch is adding a check that protofile lines are actually
being honored (in the case of the symlink file) and checking that setgid
on a directory is not carried over into new children unless the protofile explicitly marks the children setgid.

IOWs, this isn't adding a regression test for a fix in xfsprogs, it's
increasing test coverage.

Quoted 9 lines
Quoted 3 lines

Oh, understand, I have no objection with this patch, just thought it covers
a known bug :) If it's good to you too, let's ACK it.

Yes!

--D

This looks good to me as well. Feel free to add my rvb:

Thanks!
Allison

Quoted 75 lines
Quoted 75 lines

Thanks,
Zorro

Quoted 72 lines

--D

Quoted 70 lines

Thanks,
Zorro

Quoted 67 lines

Thanks,
Catherine

Quoted 65 lines
Quoted 65 lines

tests/xfs/019 | 6 ++++++
tests/xfs/019.out | 12 +++++++++++-

2 files changed, 17 insertions(+), 1 deletion(-)
tests/xfs/019 +0 -0
index 3dfd5408..535b7af1 100755
@@ -73,6 +73,10 @@ $

setuid -u-666 0 0 $tempfile setgid --g666 0 0 $tempfile setugid -ug666 0 0 $tempfile

tests/xfs/019 +4 -1
+directory_setgid d-g755 3 2
+file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_5 -
--755 3 1 $tempfile
+$
+: back in the root

block_device b--012 3 1 161 162 char_device c--345 3 1 177 178 pipe p--670 0 0

tests/xfs/019 +2 -0
@@ -114,6 +118,8 @@ _verify_fs()
 		| xargs $here/src/lstat64 | _filter_stat)
 	diff -q $SCRATCH_MNT/bigfile $tempfile.2 \
 		|| _fail "bigfile corrupted"
+	diff -q $SCRATCH_MNT/symlink $tempfile.2 \
+		|| _fail "symlink broken"
 
 	echo "*** unmount FS"
 	_full "umount"
tests/xfs/019.out +1 -1
index 19614d9d..8584f593 100644
@@ -7,7 +7,7 @@ Wrote 2048.00Kb (value 0x2c)
 File: "."
 Size: <DSIZE> Filetype: Directory
 Mode: (0777/drwxrwxrwx) Uid: (3) Gid: (1)
-Device: <DEVICE> Inode: <INODE> Links: 3 
+Device: <DEVICE> Inode: <INODE> Links: 4 
 
 File: "./bigfile"
 Size: 2097152 Filetype: Regular File
@@ -54,6 +54,16 @@ Device: <DEVICE> Inode: <INODE> Links:

1
Mode: (0755/-rwxr-xr-x) Uid: (3) Gid: (1)
Device: <DEVICE> Inode: <INODE> Links: 1

+ File: "./directory_setgid"
+ Size: <DSIZE> Filetype: Directory
+ Mode: (2755/drwxr-sr-x) Uid: (3) Gid: (2)

tests/xfs/019.out +3 -0
+Device: <DEVICE> Inode: <INODE> Links: 2 
+
+ File:

"./directory_setgid/file_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxx_5"
+ Size: 5 Filetype: Regular File
+ Mode: (0755/-rwxr-xr-x) Uid: (3) Gid: (2)

tests/xfs/019.out +2 -0
+Device: <DEVICE> Inode: <INODE> Links: 1 
+
 File: "./pipe"
 Size: 0 Filetype: Fifo File
 Mode: (0670/frw-rwx---) Uid: (0) Gid: (0)
Signature · 1 line
2.25.1