In Linux one of the default mount option for ext? fsext? fs is 'nogrpid'nogrpid | sysvgroups'sysvgroups'. So the first touch untouch un, creates a file with group id equal to fsgidfsgid of the creating process where fsgidfsgid = egidegid.
chmod g+s .chmod g+s ., makes subsequent file/dir creation inherit group id from the parent folder and if the created thing is a dirdirectory it too gets g+sg+s set as its parent.
Here touch deuxtouch deux, creates deuxdeux, with group canardcanard.
TheThis semantics changes if mount option was 'grpid'grpid | bsdgroups'bsdgroups' in that case, new file / dir creation would inherit group id from its parent folder even without setting g+sg+s for the parent itself.