Package: manpages-dev
Version: 1.70-1
Severity: normal
Tags: patch

The getpwnam.3 manpages may confuse people to believe the pw_dir entry 
is the proper way to get the home directory of the current process,
not reading the referenced passwd(5) stating:

The home directory field provides the name of the initial working
directory.  Login uses this information to set the value of the HOME
environmental variable.

The (hopefully) attached patch hopefully clarifies this.

Hochachtungsvoll,
        Bernhard R. Link

-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)

Versions of packages manpages-dev depends on:
ii  manpages                      1.70-1     Manual pages about using a GNU/Lin

-- no debconf information
diff -r -u manpages-2.02.old/man3/getpwnam.3 manpages-2.02/man3/getpwnam.3
--- manpages-2.02.old/man3/getpwnam.3   Thu Aug 18 22:38:35 2005
+++ manpages-2.02/man3/getpwnam.3       Thu Aug 18 22:52:26 2005
@@ -92,7 +92,7 @@
       uid_t   pw_uid;        /* user id */
       gid_t   pw_gid;        /* group id */
       char    *pw_gecos;     /* real name */
-      char    *pw_dir;       /* home directory */
+      char    *pw_dir;       /* initial home directory */
       char    *pw_shell;     /* shell program */
 };
 .fi
@@ -148,11 +148,20 @@
 .TP
 .B ERANGE
 Insufficient buffer space supplied.
-.SH NOTE
+.SH NOTES
 The user password database mostly refers to \fI/etc/passwd\fP.
 However, with recent systems it also refers to network wide databases
 using NIS, LDAP and other local files as configured in
 \fI/etc/nsswitch.conf\fP.
+
+The pw_dir field contains the name of the initial working directory of
+the user. If it exists login programs will usually use it to initialize
+the HOME environent variable, which defines the actual home directory for
+each running process. It has become a common mistake in the last years
+to use this value even if the program has access to the proper name of
+the home directory in the HOME environment variable. Yet for guessing
+the home directoy of another user, this value is the best guess available.
+
 .SH FILES
 .TP
 .I /etc/passwd

Reply via email to