MantisBT - CMake
View Issue Details
0013114CMakeCPackpublic2012-04-09 13:232016-06-10 14:31
Cesar 
Kitware Robot 
urgentblockalways
closedmoved 
x86Solarisany
CMake 2.8.7 
 
0013114: CPack segfaults if too many people belong to a certain group
CPack, when trying to generate a TGZ package, segfaults in lookup_gname_helper when there are too many people in the GID it is trying to identify. My builds started failing immediately after that number was reached when IT added a new member to the staff group. The realloc in case of ERANGE segfaults. If I increase the buffer size to something larger by hand and recompile it works.

CPack is not the first to run into this issue:

https://issues.apache.org/bugzilla/show_bug.cgi?id=41105 [^]
Run CPack to generate TGZs as a user belonging to a group containing "too many people".

Also, the file in "addidional information" reproduces the problem every time for our 5000 gid. If I increase the initial bufsize to 1024 it works. It is a Solaris only problem, as our other platforms (Linux, Windows, Mac) work fine.
#define _POSIX_PTHREAD_SEMANTICS
#include <grp.h>
#include <iostream>

int main(void)
{
  struct group grent, *result;
  result = &grent;

  int bufsize=512;
  char* buffer=(char*)malloc(bufsize);

  for(;;)
  {
      int status = getgrgid_r(5000,
        &grent,buffer,bufsize,&result);

      if(!status)
      {
        std::cerr << "Buffer: " << buffer << std::endl;
        break;
      }
      else if(status==34)
      {
        std::cerr << "Small buffer\n";
        bufsize*=2;
        buffer=(char*)realloc(buffer,bufsize);
      }
  }

  return 0;
}
No tags attached.
Issue History
2012-04-09 13:23CesarNew Issue
2012-04-09 14:32CesarNote Added: 0029106
2012-04-09 14:39CesarNote Added: 0029107
2012-04-13 11:49Eric NOULARDNote Added: 0029148
2012-08-11 21:35David ColeStatusnew => backlog
2012-08-11 21:35David ColeNote Added: 0030402
2016-06-10 14:28Kitware RobotNote Added: 0042020
2016-06-10 14:28Kitware RobotStatusbacklog => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0029106)
Cesar   
2012-04-09 14:32   
I replaced the "buff_size = 256" by "buff_size = 8192" in ./Utilities/cmlibarchive/libarchive/archive_read_disk_set_standard_lookup.c in the meantime to try to get around the problem.
(0029107)
Cesar   
2012-04-09 14:39   
On the realloc segfault: the first realloc works (from 256 to 512), but when it tries the 1024 realloc it segfaults.
(0029148)
Eric NOULARD   
2012-04-13 11:49   
As you may have guessed this "bug" is inherited from upstream
libarchive, could you go there
http://code.google.com/p/libarchive/ [^]
and see if it has been reported there as well.
(0030402)
David Cole   
2012-08-11 21:35   
Sending old, never assigned issues to the backlog.

(The age of the bug, plus the fact that it's never been assigned to anyone means that nobody is actively working on it...)

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it: http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer who has the bandwidth to take it on, and ferry a fix through to our 'next' branch for dashboard testing.
(0042020)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.