Giter Site home page Giter Site logo

Comments (1)

exkrexpexfex avatar exkrexpexfex commented on May 28, 2024

Far seems to use getpwent() when generating the list
Simple test on latest MacOS

	while ((pw = getpwent()) != NULL)
		std::cout << pw->pw_name << " " << pw->pw_uid << "\n";`

shows duplicates when output is sorted

daemon 1
daemon 1
nobody 4294967294
nobody 4294967294
root 0
root 0

Documentation man getpwent states that the information is obtained from opendirectoryd
With fairly default configuration with no external directories added

% odutil show nodenames             
Nodenames:

Name              State  Refs Type External Locked Hidden 
----------------- ------ ---- ---- -------- ------ ------ 
/Active Directory Online 1                  X      X      
/Configure        Online 1                  X      X      
/Contacts         Online 3                                
/LDAPv3           Online 1                  X      X      
/Local            Online 2                  X      X      
/Local/Default    Online 63                 X             
/Platform SSO     Online 1                  X             
/Search           Online 26                               

username nobody is found in two locations

 % dscl localhost -list /Search/Users |grep nobody
nobody
 % dscl localhost -list /Local/Default/Users |grep nobody
nobody

That's probably the source of duplicates on Mac.
Also FreeBSD man page for getpwent explicitly states "The getpwent() and getpwent_r() functions make
no attempt to suppress duplicate information if multiple sources are
specified in nsswitch.conf(5)"
So the issue is not Mac-specific. It seems to be good to remove duplicates from the list obtained from getpwent

from far2l.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.