#!/bin/sh
set -e

rm -rf dir
mkdir dir

echo foo > dir/test.txt

# Any supplementary group that is not the "default" gid
chgrp audio dir
chmod g+s dir

stat dir/test.txt # file has "default" gid
patch dir/test.txt << 'EOF'
--- dir/test.txt
+++ dir/test.txt
@@ -1 +1 @@
-foo
+bar
EOF
stat dir/test.txt # file has gid of the supplementary group
