bug-gnulib
[Top][All Lists]
Advanced

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

Re: getpass documentation


From: Bruno Haible
Subject: Re: getpass documentation
Date: Fri, 16 May 2008 13:32:57 +0200
User-agent: KMail/1.5.4

Simon Josefsson wrote:
> This makes the gnulib 'getpass' module (not the 'getpass-gnu' module)
> rather difficult to use: how do you know whether to de-allocate the
> returned string or not?  It depends on whether the system function or
> the gnulib replacement was used.

Good point.

> Another way of looking at this is that
> there is a memory leak in the gnulib 'getpass' module.

It's hard to argue this way: getpass() is not specified by a standard.

> diff --git a/doc/glibc-functions/getpass.texi 
> b/doc/glibc-functions/getpass.texi
> index b805cf5..561b89c 100644
> --- a/doc/glibc-functions/getpass.texi
> +++ b/doc/glibc-functions/getpass.texi
> @@ -6,6 +6,13 @@ Gnulib module: ---
>  
>  Portability problems fixed by Gnulib:
>  @itemize
> address@hidden
> +This implementation returns password of arbitrary length, other
> +implementations truncate it to PASS_MAX or 8 characters.
> address@hidden
> +This implementation allocate the password using malloc, other
> +implementations may return a pointer to a static buffer which must not
> +be de-allocated.
>  @end itemize
>  

The way you wrote it here, it is not clear which module provides "this
implementation". The "Gnulib module" field is "---"...

Can you change the "Gnulib module" field to "getpass or getpass-gnu" and
then set up a 3-way structure like in doc/posix-functions/snprintf.texi?
The goal is to make clear to the reader which module he needs if he wants
a particular portability problem fixed.

Another, minor point is: "This implementation returns password of arbitrary
length" is incorrect English syntax for me. "a password"? "passwords"?

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]