On libc (*nix) systems we call `getentropy()` to get the seed needed to
start the PRNG. If that call fails, we fall back to reading the
filesystem via `/dev/urandom`. If that fails we fall back to hashing
some state variables instead.
This should be faster, less risky, and generally better than trying to
read from `/dev/urandom`
Foo
Some FreeBSD systems have <stdckdint.h>, but it cannot be compiled
with C++ compilers. Configure now checks whether `ckd_*` functions
can be compiled, and leave I_STDCKDINT undefined if the compilation
failed.
Will fix GH #23725 (d51aa1a build-time failure with clang++ and g++).
This macro is defined in config.h if <stdckdint.h> is available,
and used in previously commited code
(0f2b1e648156555a96ed54170e1b385a60010910, GH #23503).
See https://github.com/Perl/perl5/issues/22793
This typo in a printf format causes some C compilations to fail; others
to just warn. However stderr is redirected to /dev/null, so we weren't
aware of this issue.
When it fails, other issues cause perl to not be usable on the system.
The LC_ALL syntax detection wrote some of what it detected to
the console with no labels.
On Linux this was:
"=;"
for both lines, but I've seen more complex output on other systems.
Some \" was being converted to " with ksh on AIX, causing the
program to fail to build and failing the entire build.
Example report: https://perl5.test-smoke.org/report/5039146
Errors:
"config.h", line 3640.3: 1506-218 (E) Unknown preprocessing directive #PERL_LC_ALL_USES_NAME_VALUE_PAIRS.
"config.h", line 3641.4: 1506-218 (E) Unknown preprocessing directive #PERL_LC_ALL_SEPARATOR.
"config.h", line 3642.4: 1506-218 (E) Unknown preprocessing directive #PERL_LC_ALL_CATEGORY_POSITIONS_INIT.
"locale.c", line 6865.43: 1506-168 (S) Initializer must be enclosed in braces.
"locale.c", line 6866.31: 1506-043 (S) The operand of the sizeof operator is not valid.
"locale.c", line 6866.9: 1506-044 (S) Expression must be a non-negative integer constant.
"locale.c", line 6870.18: 1506-043 (S) The operand of the sizeof operator is not valid.
This includes the LC_ALL notation unit, not yet merged in metaconfig.
It turns out that in order to get quite a few elements from being
dropped, I had to add them to metaconfig.h
by Elvin Aslanov (rwp0)
Straight to the point as "Public domain implementation" wasn't very helpful.
Came across this message building Perl on a freshly installed Ubuntu Linux doing:
git clone https://github.com/Perl/perl5
sh Configure -des -Dusedevel
Configure used to try %L, %q, and then %ll in this order to find the
modifier for formatting 64-bit integers on 32-bit machines, but %L for
integer conversions seems to be a non-standard GNU extension.
Now it will try %ll before %q, %L to prioritize %ll which is
standardized by C99.
This is broken out so it is easier for Tux to find and merge with
metaconfig.
View this patch with -w and you will see "no changes" except for
config_h.SH and Porting/config_h.pl both which needed to be changed to
ensure that they produce output that doesn't replicate the problem.
Currently this requires special handling on Linux and is broken
on Cygwin, since the compiler internal library directories
aren't in the normal search path.
Rather than searching ourselves, let the compiler do it, and check
it's vaguely functional.
We require a C99 compiler, or in the case that led to this commit, a
C++ compiler, and for those the malloc() and free() return types are
well defined.
This probe broke on Solaris when building with g++.
Unlike glibc, the libc headers on Solaris, when building using a C++
compiler, define the stdlib.h functions within the std:: namespace,
then imports those names into the top level namespace with 'using
std::malloc'.
This conflicts with the declarations used in the probe, causing the
probe to fail to build, despite malloc() actually returning a void *.
Since these two functions have well defined return types according to
the standard, assume their return values match.
Configure can still be invoked with different definitions for
malloctype and freetype, or hints can override them, so someone on a
non-standard system can at least get past this if they really need to
(such a system will likely not build perl anyway.)
This patch was submitted in GH issue #20606. When gcc output contains
quoted elements we fail to handle it properly. This tweaks the sed
command to do so.
Fixes#20606.
Two C99 compatibility issues are fixed by these changes: Return
types are made explicit where they previously defaulted to int,
and all called functions are now declared explicitly (either by
including additional headers, or by adding prototypes manually).
This avoids implict ints and implicit function declarations,
both legacy C language features removed in the 1999 revision
of the language.
Verified with an instrumented GCC compiler on GNU/Linux.
These macros were defined in perl.h using preprocessor conditionals,
but determining wheter I32 is "int" or "long" is pretty hard with
preprocessor, when INTSIZE == LONGSIZE. The Configure script
should know exact underlying type of I32, so it should be able to
determine whether %d or %ld shall be used to format I32 value
more robustly.
Various pre-configured files, such as uconfig.h, are updated to
align with this.
Configure's helper function ./myread is intended to loop until it gets an
acceptable answer. For a couple of cases, an empty string is not acceptable
(eg 'Where is your C library?', if all automated attempts at answering this
have failed). In these cases, if Configure's standard input is /dev/null (or
closed), the shell read returns an empty string, and ./myread repeats the
question.
Before this commit, it would loop infinitely (generating continuous terminal
output). With this commit, we add a retry counter - if it asks the same
question to many times, it aborts Configure. This means that unattended
./Configure runs should now always terminate, as termination with an error
is better than spinning forever.
A default installation of DragonflyBSD doesn't necessarily set the
hostname, resulting in a `uname -a` like:
DragonFly 6.2-RELEASE DragonFly v6.2.2-RELEASE ...
which resulted in osvers being set to "dragonfly", which isn't
especially useful.
So check that $3 is numeric in some sense before using it, falling
back to $2 if it isn't. This should only happen when the hostname
isn't set.
With -Duse64bitint on 32-bit machines, UV might be configured
to `uint64_t`. But some Configure tests used $uvtype without including
<inttypes.h>, which may cause compilation error of those tests on
sucn configurations, and eventually make perl not built correctly.
There are no macros named PRIXU64. This line seems to date back to
commit 6b356c8efb963846940ef92952cf77e5b86bd65e which renamed shell
variable names to work well with case-insensitive systems,
but could have overdone a bit.
This allows us to enforce API boundaries and potentially enables
compiler optimisations.
We've been always hiding non-public symbols on Windows. This commit
brings that to the other platforms.
This adds a Configure question for whether you want taint support.
It defaults to "yes", so that ./Configure -des will build a perl
which supports taint in the usual way.
If you say "no", then perl is compiled with -DSILENT_NO_TAINT_SUPPORT
so that taint features silently do nothing.
I've submitted a separate pull request on perl/metaconfig,
which adds the underlying metaconfig unit for this question,
which was used to build this Configure script.
"try.c" for (double|longdbl)(inf|nan)bytes seems to lack some
preprocessor directives (probably accidentaly removed) and
caused syntax error if HAS_LONG_DOUBLE is not defined.
Also ensure that the relevant failure error message is output even with
Configure's -s flag, as we shouldn't stay silent for a message that causes
Configure default to aborting.
With these changes, Configure will fail the C99 probe test if passed
-Accflags="-Werror=declaration-after-statement" or
-Accflags="-Werror=long-long"
Probe to see whether we need -std=gnu99 or -std=c99 to get C99 code to
compile. In cflags.SH, remove code that added gcc warning flags that were
compatible with C89 but are not compatible with C99.
On FreeBSD dev_t (and hence the st_dev member of struct stat) is an
unsigned 64-bit integer, and the previous simple PUSHi() corrupted
that.
A previous version of this reflected the st_ino code and implemented
our own number to string conversion, but a system with such a large
st_dev should be assumed to have inttypes.h, and an intmax_t which is
no smaller than st_dev.
The st_ino code could probably be changed similarly, but 64-bit inode
numbers are not a new thing, so it may be riskier.
This header was originally only needed for builds on darwin and
FreeBSD, but was being included whenever it was detected.
This has caused problems when what was an internal header was
removed (from glibc) and in general wasn't needed anyway.
On FreeBSD only localeconv_l() requires xlocale.h, so we test
specifically for that.
User should expect to see configuration questions spelled 'UTF-8', not
'UTF8' (even if we store information internally or in config.sh without
the hyphen).
Correct user prompts accordingly.
For: #18844https://github.com/Perl/perl5/pull/18870 by @jkeenan