emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#14462: closed (useless calls of setpwent()/setgren


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#14462: closed (useless calls of setpwent()/setgrent() in stat)
Date: Fri, 24 May 2013 17:24:02 +0000

Your message dated Fri, 24 May 2013 10:22:40 -0700
with message-id <address@hidden>
and subject line Re: bug#14462: useless calls of setpwent()/setgrent() in stat
has caused the debbugs.gnu.org bug report #14462,
regarding useless calls of setpwent()/setgrent() in stat
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
14462: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14462
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: useless calls of setpwent()/setgrent() in stat Date: Fri, 24 May 2013 15:32:56 +0200
Hi,

I am investigating an issue with stat. stat calls setpwent() (when
resolving a username) and setgrent() (when resolving a group name). This
has a bad impact when a LDAP is used and a database is quite large. It
forces to download the whole database. According to RFC 2307,
getpwuid()/getgrgid() are handled correctly with a search pattern to get
an username/group name and there is no need to call
setpwent()/setgrent(). My tests have approved this.

Even when the LDAP is not used, I don't see the point of using
setpwent() and setgrent() calls. On local system with /etc/passwd in
use, these calls does nothing in fact. For example setpwent() should be
used with functions getpwent()/endpwent(), on the other hand, setgrent()
is designed to be used with getgrent()/endgrent() functions. I cannot
find anything why are these functions used with getpwuid()/getgrgid().
Is there any non-documented behavior? For example nscd is using its own
cache and these calls are, again, useless.

I cannot determinate why these functions are called. They request
additional computation which is not used. In my opinion, these spare
calls should be removed.

If these calls are useful, why there are no endpwent()/endgrent() calls?

Thanks for your response!

Best regards,
Fridolin Pokorny.

---coreutils_old/src/stat.c     2013-05-24 08:14:35.922027283 +0200
+++ coreutils/src/stat.c        2013-05-24 08:14:56.076101484 +0200
@@ -965,7 +965,6 @@ print_stat (char *pformat, size_t prefix
       out_uint (pformat, prefix_len, statbuf->st_uid);
       break;
     case 'U':
-      setpwent ();
       pw_ent = getpwuid (statbuf->st_uid);
       out_string (pformat, prefix_len,
                   pw_ent ? pw_ent->pw_name : "UNKNOWN");
@@ -974,7 +973,6 @@ print_stat (char *pformat, size_t prefix
       out_uint (pformat, prefix_len, statbuf->st_gid);
       break;
     case 'G':
-      setgrent ();
       gw_ent = getgrgid (statbuf->st_gid);
       out_string (pformat, prefix_len,
                   gw_ent ? gw_ent->gr_name : "UNKNOWN");







--- End Message ---
--- Begin Message --- Subject: Re: bug#14462: useless calls of setpwent()/setgrent() in stat Date: Fri, 24 May 2013 10:22:40 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6
On 05/24/2013 06:32 AM, FridolĂ­n PokornĂ˝ wrote:
> I cannot determinate why these functions are called.

Nor I.  Thanks, I installed that patch and am marking this as done.


--- End Message ---

reply via email to

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