On Mon, Mar 10, 2025 at 12:55:51PM -0500, Eric Sandeen wrote: > Zorro noticed that on systems using nss-altfiles, some tests failed when > trying to parse /etc/passwd directly. The "getent" command does the > right thing in this case, so let's use it as long as it's available. > > Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx> > --- > > diff --git a/common/rc b/common/rc > index 6592c835..50312331 100644 > --- a/common/rc > +++ b/common/rc > @@ -2621,7 +2621,11 @@ _yp_active() > _cat_passwd() > { > [ $(_yp_active) -eq 0 ] && ypcat passwd > - cat /etc/passwd > + if type getent &>/dev/null; then If you want to be really nitpicky, 'type' isn't defined for posix shells; you're supposed to use command[1]: if command -v getent &>/dev/null; then I don't care that much since fstests is wholly dependent on bashisms so: Reviewed-by: "Darrick J. Wong" <djwong@xxxxxxxxxx> if you decide to change it or not. --D [1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html > + getent passwd > + else > + cat /etc/passwd > + fi > } > > # cat the group file > @@ -2629,7 +2633,11 @@ _cat_passwd() > _cat_group() > { > [ $(_yp_active) -eq 0 ] && ypcat group > - cat /etc/group > + if type getent &>/dev/null; then > + getent group > + else > + cat /etc/group > + fi > } > > # check if a user exists in the system > >