util/mkerr.pl: only replace the .ec suffix when naming the state file

When no state file is configured, mkerr.pl derives it from the config
file path with s/.ec/.txt/.  The unescaped, unanchored pattern replaces
the first occurrence of any character followed by "ec" anywhere
in the path.  Since the error headers are generated at build time,
mkerr.pl runs with -conf $(SRCDIR)/crypto/err/openssl.ec,
so an out-of-tree build whose relative source path contains a name
such as "projects" fails:

    Can't open ../pro.txtts/openssl/crypto/err/openssl.ec

Anchor the pattern to the ".ec" suffix.

Fixes: 52df25cf2e "make error tables const and separate header file"
Complements: 7a3fa58d9d "Generate the error headers and tables at build time"
Assisted-by: Claude:claude-opus-5-5
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Merge-date: Tue Oct 27 18:11:11 2026
Merged-from: https://github.com/openssl/openssl/pull/33389
(cherry picked from commit 93d5616734)
This commit is contained in:
Nikolas Gauder authored and Eugene Syromiatnikov committed 2026-10-27 19:23:09 +01:00
1 parent 88d4b166e9
commit 867020fb46
1 file changed
+1 -1
+1 -1
View File
@@ -178,7 +178,7 @@ close IN;
if ( ! $statefile ) {
$statefile = $config;
$statefile =~ s/.ec/.txt/;
$statefile =~ s/\.ec$/.txt/;
}
# The statefile has all the previous assignments.