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

Bug#520744: _SC_GETGR_R_SIZE_MAX returned on amd64 too small



retitle 520744 _SC_GETGR_R_SIZE_MAX returned too small
thanks

On Fri, Apr 24, 2009 at 09:17:58AM +0200, Guido Günther wrote:
> On Thu, Apr 23, 2009 at 11:18:00PM +0200, Aurelien Jarno wrote:
> > On Tue, Apr 14, 2009 at 09:32:04AM +0200, Guido Günther wrote:
> > > retitle 520744  _SC_GETGR_R_SIZE_MAX returned on amd64 too small
> > > user debian-amd64@lists.debian.org 
> > > usertag 520744 debian-amd64 
> > > thanks
> > > 
> > > Hi,
> > > attached testcase shows that the buffersize for getgrent_r returned via
> > > sysconf(_SC_GETGR_R_SIZE_MAX) is too small on amd64. Using the returned
> > > 1024 byetes results in ERANGE. i386 and ppc also use 1024 bytes which
> > > works fine.
> > > While returning -1 is from sysconf is o.k., a too low value certainly is
> > > not. Can this be fixed in a Lenny point release since it might break
> > > arbitrary software on this architecture?
> > 
> > What is the example code supposed to do? I have no problem executing it
> > here:
> > $ ./group
> > buffer size from sysconf: 1024
> > gid: 124
> As long as you're not seeing a "Increased buffer to ..." message from
> the testcase it's working as expected. When you see the "Increasing
> buffer to ..." message the buffer size returned by sysconf is too small
> (which is the bug were looking for).
> The group that caused the trouble for Andreas had about 70 members (with
> a line length in /etc/group of about 515 bytes). No nscd involved.

The title of the bug is actually misleading given that the problem is
not specific to amd64 at all. It appears with a smaller line on 64-bit
systems than 32-bit systems, due to the fact that pointers to the
strings are bigger.

That said I don't fully understand POSIX here. What should happen if a
line in /etc/group needs more memory than sysconf(_SC_GETGR_R_SIZE_MAX)?
The line should be truncated? As far as I understand user can create as
many entries as he wants there, so _SC_GETGR_R_SIZE_MAX can only be
defined to an arbitrary value.

-- 
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net



Reply to: