and the 'Thread' module offers an interface to both 5005threads and
ithreads (whichever has been configured).
+When building threaded for certain library calls like the getgr*() and
+the getpw*() there is a dynamically sized result buffer: the buffer
+starts small but Perl will keep growing the buffer until the result fits.
+To get a fixed upper limit you will have to recompile Perl with
+PERL_REENTRANT_MAXSIZE defined to be the number of bytes you want.
+One way to do this is to run Configure with
+C<-Accflags=-DPERL_REENTRANT_MAXSIZE=65536>
+
=head2 Large file support.
Since Perl 5.6.0, Perl has supported large files (files larger than
(F) You can't specify a repeat count so large that it overflows your
signed integers. See L<perlfunc/unpack>.
+=item Result from %s larger than %d bytes
+
+(W misc) A library call like getgrent() tried to return more results
+than Perl was willing to accept. This happens only when Perl has been
+compiled to have threads and to have an upper limit on such calls
+(the default is to keep regrowing the result buffer until the result fits).
+However, now the results were truncated.
+
=item Reversed %s= operator
(W syntax) You wrote your assignment operator backwards. The = must
the thread-safety or -unsafety of the calls. Please consult your
C library call documentation.
-In some platforms the thread-safe interfaces may fail if the result
-buffer is too small (for example getgrent() may return quite large
-group member lists). Perl will retry growing the result buffer
-a few times, but only up to 64k (for safety reasons).
+On some platforms the thread-safe library interfaces may fail if the
+result buffer is too small (for example the user group databases may
+be rather large, and the reentrant interfaces may have to carry around
+a full snapshot of those databases). Perl will start with a small
+buffer, but keep retrying and growing the result buffer
+until the result fits. If this limitless growing sounds bad for
+security or memory consumption reasons you can recompile Perl with
+PERL_REENTRANT_MAXSIZE defined to the maximum number of bytes you will
+allow.
=head1 Conclusion
# if defined(USE_HOSTENT_BUFFER) || defined(USE_NETENT_BUFFER) || defined(USE_PROTOENT_BUFFER) || defined(USE_SERVENT_BUFFER)
int anint;
# endif
+#ifdef PERL_REENTRANT_MAXSIZE
+ static const char larger[] = "Result from %s larger than %d bytes";
+#endif
va_list ap;
va_start(ap, f);
-#define REENTRANTHALFMAXSIZE 32768 /* The maximum may end up twice this. */
-
switch (PL_op->op_type) {
#ifdef USE_HOSTENT_BUFFER
case OP_GHBYADDR:
case OP_GHBYNAME:
case OP_GHOSTENT:
{
- if (PL_reentrant_buffer->_hostent_size <= REENTRANTHALFMAXSIZE) {
+#ifdef PERL_REENTRANT_MAXSIZE
+ if (PL_reentrant_buffer->_hostent_size <=
+ PERL_REENTRANT_MAXSIZE / 2)
+#endif
+ {
PL_reentrant_buffer->_hostent_size *= 2;
Renew(PL_reentrant_buffer->_hostent_buffer,
PL_reentrant_buffer->_hostent_size, char);
case OP_GGRGID:
case OP_GGRENT:
{
- if (PL_reentrant_buffer->_grent_size <= REENTRANTHALFMAXSIZE) {
+#ifdef PERL_REENTRANT_MAXSIZE
+ if (PL_reentrant_buffer->_grent_size <=
+ PERL_REENTRANT_MAXSIZE / 2)
+#endif
+ {
Gid_t gid;
PL_reentrant_buffer->_grent_size *= 2;
Renew(PL_reentrant_buffer->_grent_buffer,
case OP_GNBYNAME:
case OP_GNETENT:
{
- if (PL_reentrant_buffer->_netent_size <= REENTRANTHALFMAXSIZE) {
+#ifdef PERL_REENTRANT_MAXSIZE
+ if (PL_reentrant_buffer->_netent_size <=
+ PERL_REENTRANT_MAXSIZE / 2)
+#endif
+ {
Netdb_net_t net;
PL_reentrant_buffer->_netent_size *= 2;
Renew(PL_reentrant_buffer->_netent_buffer,
break;
}
}
+#ifdef PERL_REENTRANT_MAXSIZE
+ else if (ckWARN(WARN_MISC))
+ Perl_warner(aTHX_ packWARN(WARN_MISC),
+ larger, OP_NAME(PL_op), PERL_REENTRANT_MAXSIZE);
+#endif
}
break;
#endif
case OP_GPWUID:
case OP_GPWENT:
{
- if (PL_reentrant_buffer->_pwent_size <= REENTRANTHALFMAXSIZE) {
+#ifdef PERL_REENTRANT_MAXSIZE
+ if (PL_reentrant_buffer->_pwent_size <=
+ PERL_REENTRANT_MAXSIZE / 2)
+#endif
+ {
Uid_t uid;
PL_reentrant_buffer->_pwent_size *= 2;
Renew(PL_reentrant_buffer->_pwent_buffer,
break;
}
}
+#ifdef PERL_REENTRANT_MAXSIZE
+ else if (ckWARN(WARN_MISC))
+ Perl_warner(aTHX_ packWARN(WARN_MISC),
+ larger, OP_NAME(PL_op), PERL_REENTRANT_MAXSIZE);
+#endif
}
break;
#endif
case OP_GPBYNUMBER:
case OP_GPROTOENT:
{
- if (PL_reentrant_buffer->_protoent_size <= REENTRANTHALFMAXSIZE) {
+#ifdef PERL_REENTRANT_MAXSIZE
+ if (PL_reentrant_buffer->_protoent_size <=
+ PERL_REENTRANT_MAXSIZE / 2)
+#endif
+ {
PL_reentrant_buffer->_protoent_size *= 2;
Renew(PL_reentrant_buffer->_protoent_buffer,
PL_reentrant_buffer->_protoent_size, char);
break;
}
}
+#ifdef PERL_REENTRANT_MAXSIZE
+ else if (ckWARN(WARN_MISC))
+ Perl_warner(aTHX_ packWARN(WARN_MISC),
+ larger, OP_NAME(PL_op), PERL_REENTRANT_MAXSIZE);
+#endif
}
break;
#endif
case OP_GSBYPORT:
case OP_GSERVENT:
{
- if (PL_reentrant_buffer->_servent_size <= REENTRANTHALFMAXSIZE) {
+#ifdef PERL_REENTRANT_MAXSIZE
+ if (PL_reentrant_buffer->_servent_size <=
+ PERL_REENTRANT_MAXSIZE / 2)
+#endif
+ {
PL_reentrant_buffer->_servent_size *= 2;
Renew(PL_reentrant_buffer->_servent_buffer,
PL_reentrant_buffer->_servent_size, char);
break;
}
}
+#ifdef PERL_REENTRANT_MAXSIZE
+ else if (ckWARN(WARN_MISC))
+ Perl_warner(aTHX_ packWARN(WARN_MISC),
+ larger, OP_NAME(PL_op), PERL_REENTRANT_MAXSIZE);
+#endif
}
break;
#endif
# if defined(USE_HOSTENT_BUFFER) || defined(USE_NETENT_BUFFER) || defined(USE_PROTOENT_BUFFER) || defined(USE_SERVENT_BUFFER)
int anint;
# endif
+#ifdef PERL_REENTRANT_MAXSIZE
+ static const char larger[] = "Result from %s larger than %d bytes";
+#endif
va_list ap;
va_start(ap, f);
-#define REENTRANTHALFMAXSIZE 32768 /* The maximum may end up twice this. */
-
switch (PL_op->op_type) {
#ifdef USE_HOSTENT_BUFFER
case OP_GHBYADDR:
case OP_GHBYNAME:
case OP_GHOSTENT:
{
- if (PL_reentrant_buffer->_hostent_size <= REENTRANTHALFMAXSIZE) {
+#ifdef PERL_REENTRANT_MAXSIZE
+ if (PL_reentrant_buffer->_hostent_size <=
+ PERL_REENTRANT_MAXSIZE / 2)
+#endif
+ {
PL_reentrant_buffer->_hostent_size *= 2;
Renew(PL_reentrant_buffer->_hostent_buffer,
PL_reentrant_buffer->_hostent_size, char);
case OP_GGRGID:
case OP_GGRENT:
{
- if (PL_reentrant_buffer->_grent_size <= REENTRANTHALFMAXSIZE) {
+#ifdef PERL_REENTRANT_MAXSIZE
+ if (PL_reentrant_buffer->_grent_size <=
+ PERL_REENTRANT_MAXSIZE / 2)
+#endif
+ {
Gid_t gid;
PL_reentrant_buffer->_grent_size *= 2;
Renew(PL_reentrant_buffer->_grent_buffer,
case OP_GNBYNAME:
case OP_GNETENT:
{
- if (PL_reentrant_buffer->_netent_size <= REENTRANTHALFMAXSIZE) {
+#ifdef PERL_REENTRANT_MAXSIZE
+ if (PL_reentrant_buffer->_netent_size <=
+ PERL_REENTRANT_MAXSIZE / 2)
+#endif
+ {
Netdb_net_t net;
PL_reentrant_buffer->_netent_size *= 2;
Renew(PL_reentrant_buffer->_netent_buffer,
break;
}
}
+#ifdef PERL_REENTRANT_MAXSIZE
+ else if (ckWARN(WARN_MISC))
+ Perl_warner(aTHX_ packWARN(WARN_MISC),
+ larger, OP_NAME(PL_op), PERL_REENTRANT_MAXSIZE);
+#endif
}
break;
#endif
case OP_GPWUID:
case OP_GPWENT:
{
- if (PL_reentrant_buffer->_pwent_size <= REENTRANTHALFMAXSIZE) {
+#ifdef PERL_REENTRANT_MAXSIZE
+ if (PL_reentrant_buffer->_pwent_size <=
+ PERL_REENTRANT_MAXSIZE / 2)
+#endif
+ {
Uid_t uid;
PL_reentrant_buffer->_pwent_size *= 2;
Renew(PL_reentrant_buffer->_pwent_buffer,
break;
}
}
+#ifdef PERL_REENTRANT_MAXSIZE
+ else if (ckWARN(WARN_MISC))
+ Perl_warner(aTHX_ packWARN(WARN_MISC),
+ larger, OP_NAME(PL_op), PERL_REENTRANT_MAXSIZE);
+#endif
}
break;
#endif
case OP_GPBYNUMBER:
case OP_GPROTOENT:
{
- if (PL_reentrant_buffer->_protoent_size <= REENTRANTHALFMAXSIZE) {
+#ifdef PERL_REENTRANT_MAXSIZE
+ if (PL_reentrant_buffer->_protoent_size <=
+ PERL_REENTRANT_MAXSIZE / 2)
+#endif
+ {
PL_reentrant_buffer->_protoent_size *= 2;
Renew(PL_reentrant_buffer->_protoent_buffer,
PL_reentrant_buffer->_protoent_size, char);
break;
}
}
+#ifdef PERL_REENTRANT_MAXSIZE
+ else if (ckWARN(WARN_MISC))
+ Perl_warner(aTHX_ packWARN(WARN_MISC),
+ larger, OP_NAME(PL_op), PERL_REENTRANT_MAXSIZE);
+#endif
}
break;
#endif
case OP_GSBYPORT:
case OP_GSERVENT:
{
- if (PL_reentrant_buffer->_servent_size <= REENTRANTHALFMAXSIZE) {
+#ifdef PERL_REENTRANT_MAXSIZE
+ if (PL_reentrant_buffer->_servent_size <=
+ PERL_REENTRANT_MAXSIZE / 2)
+#endif
+ {
PL_reentrant_buffer->_servent_size *= 2;
Renew(PL_reentrant_buffer->_servent_buffer,
PL_reentrant_buffer->_servent_size, char);
break;
}
}
+#ifdef PERL_REENTRANT_MAXSIZE
+ else if (ckWARN(WARN_MISC))
+ Perl_warner(aTHX_ packWARN(WARN_MISC),
+ larger, OP_NAME(PL_op), PERL_REENTRANT_MAXSIZE);
+#endif
}
break;
#endif