mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] about getpwent functions family
@ 2025-10-29  7:44 Sebastien Marie
  2025-10-29  8:34 ` A. Wilcox
  2025-10-29 17:27 ` Rich Felker
  0 siblings, 2 replies; 4+ messages in thread
From: Sebastien Marie @ 2025-10-29  7:44 UTC (permalink / raw)
  To: musl

Hi,

I am using alpine linux (which is using musl libc) and I am trying to
build xen-api [1].

xen-api is using getpwent_r (and getspent_r but let's focus on
getpwent_r) function in unixpwd [2], a simple C library with OCaml
bindings to support updating Unix account passwords in /etc/passwd and
/etc/shadow.

I am looking for rational or previous discussion about inclusion or not
of such GNU extension functions in musl.

fgetpwent and putpwent, which are also GNU extension, are already
present.

If there is no objection, I would look to provide patches for adding
getpwent_r() and/or fgetpwent_r() (and {,f}getspent_r counterpart).

Thanks.
-- 
Sebastien Marie

[1] https://github.com/xapi-project/xen-api
[2] https://github.com/xapi-project/xen-api/tree/master/unixpwd

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [musl] about getpwent functions family
  2025-10-29  7:44 [musl] about getpwent functions family Sebastien Marie
@ 2025-10-29  8:34 ` A. Wilcox
  2025-10-31  2:28   ` Demi Marie Obenour
  2025-10-29 17:27 ` Rich Felker
  1 sibling, 1 reply; 4+ messages in thread
From: A. Wilcox @ 2025-10-29  8:34 UTC (permalink / raw)
  To: musl, Sebastien Marie

On Oct 29, 2025, at 2:44 AM,
Sebastien Marie <semarie@kapouay.eu.org> wrote:
> 
> Hi,
> 
> I am using alpine linux (which is using musl libc) and I am trying to
> build xen-api [1].
> 
> xen-api is using getpwent_r (and getspent_r but let's focus on
> getpwent_r) function in unixpwd [2], a simple C library with OCaml
> bindings to support updating Unix account passwords in /etc/passwd and
> /etc/shadow.
> 
> I am looking for rational or previous discussion about inclusion or not
> of such GNU extension functions in musl.
> 
> fgetpwent and putpwent, which are also GNU extension, are already
> present.
> 
> If there is no objection, I would look to provide patches for adding
> getpwent_r() and/or fgetpwent_r() (and {,f}getspent_r counterpart).
> 
> Thanks.
> -- 
> Sebastien Marie
> 
> [1] https://github.com/xapi-project/xen-api
> [2] https://github.com/xapi-project/xen-api/tree/master/unixpwd

Hi Sebastien,

You may want to look in to libnsss[1], probably compiled with
`-DNSSS_DISABLE_SWITCH` so it only uses Unix files.

Best,
-Anna

[1]: https://skarnet.org/software/nsss/libnsss/index.html

—
Anna Wilcox (she/her)
SW Engineering: C++/Rust, DevOps, POSIX, Py/Ruby
Wilcox Technologies Inc.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [musl] about getpwent functions family
  2025-10-29  7:44 [musl] about getpwent functions family Sebastien Marie
  2025-10-29  8:34 ` A. Wilcox
@ 2025-10-29 17:27 ` Rich Felker
  1 sibling, 0 replies; 4+ messages in thread
From: Rich Felker @ 2025-10-29 17:27 UTC (permalink / raw)
  To: Sebastien Marie; +Cc: musl

On Wed, Oct 29, 2025 at 08:44:24AM +0100, Sebastien Marie wrote:
> Hi,
> 
> I am using alpine linux (which is using musl libc) and I am trying to
> build xen-api [1].
> 
> xen-api is using getpwent_r (and getspent_r but let's focus on
> getpwent_r) function in unixpwd [2], a simple C library with OCaml
> bindings to support updating Unix account passwords in /etc/passwd and
> /etc/shadow.
> 
> I am looking for rational or previous discussion about inclusion or not
> of such GNU extension functions in musl.
> 
> fgetpwent and putpwent, which are also GNU extension, are already
> present.
> 
> If there is no objection, I would look to provide patches for adding
> getpwent_r() and/or fgetpwent_r() (and {,f}getspent_r counterpart).

The reason there's no getpwent_r is that it does nothing to solve the
problem with normal getpwent: it's still non-thread-safe and
non-library-safe, because it iterator it uses is global state. All it
does is give you the strictly-worse klunky buffer handling, but still
with the need to use locking.

fgetpwent_r solves this, but it doesn't abstract the source of
records. There's no interface to setup or tear down iterators; it
works directly on FILE* and only supports reading records from a
classic passwd file.

Rich

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [musl] about getpwent functions family
  2025-10-29  8:34 ` A. Wilcox
@ 2025-10-31  2:28   ` Demi Marie Obenour
  0 siblings, 0 replies; 4+ messages in thread
From: Demi Marie Obenour @ 2025-10-31  2:28 UTC (permalink / raw)
  To: musl, A. Wilcox, Sebastien Marie


[-- Attachment #1.1.1: Type: text/plain, Size: 1322 bytes --]

On 10/29/25 04:34, A. Wilcox wrote:
> On Oct 29, 2025, at 2:44 AM,
> Sebastien Marie <semarie@kapouay.eu.org> wrote:
>>
>> Hi,
>>
>> I am using alpine linux (which is using musl libc) and I am trying to
>> build xen-api [1].
>>
>> xen-api is using getpwent_r (and getspent_r but let's focus on
>> getpwent_r) function in unixpwd [2], a simple C library with OCaml
>> bindings to support updating Unix account passwords in /etc/passwd and
>> /etc/shadow.
>>
>> I am looking for rational or previous discussion about inclusion or not
>> of such GNU extension functions in musl.
>>
>> fgetpwent and putpwent, which are also GNU extension, are already
>> present.
>>
>> If there is no objection, I would look to provide patches for adding
>> getpwent_r() and/or fgetpwent_r() (and {,f}getspent_r counterpart).
>>
>> Thanks.
>> -- 
>> Sebastien Marie
>>
>> [1] https://github.com/xapi-project/xen-api
>> [2] https://github.com/xapi-project/xen-api/tree/master/unixpwd
> 
> Hi Sebastien,
> 
> You may want to look in to libnsss[1], probably compiled with
> `-DNSSS_DISABLE_SWITCH` so it only uses Unix files.
> 
> Best,
> -Anna
> 
> [1]: https://skarnet.org/software/nsss/libnsss/index.html

I recommend spawning a subprocess instead.
-- 
Sincerely,
Demi Marie Obenour (she/her/hers)

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-10-31  2:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-29  7:44 [musl] about getpwent functions family Sebastien Marie
2025-10-29  8:34 ` A. Wilcox
2025-10-31  2:28   ` Demi Marie Obenour
2025-10-29 17:27 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).