Re: [PATCH] common/rc: use getent when available

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



On 3/11/25 10:30 AM, Darrick J. Wong wrote:
> 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:

Yup, I started with "command -v," realized it wasn't used anywhere else
in fstests, and that we always used "type" - so when in Rome, etc.

> Reviewed-by: "Darrick J. Wong" <djwong@xxxxxxxxxx>

Thanks,
-Eric
 
> if you decide to change it or not.
> 
> --D




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux