Description:
Test main.dd_upgrade_test fails with crash on Alpine.
Crash was tracked down to my_realpath() and use of realpath() function.
Reading man 3 realpath
and POSIX:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html
it seems better to call realpath with second argument as NULL instead of
allocating a buffer of size PATH_MAX.
Using the following patch:
diff --git a/mysys/my_symlink.cc b/mysys/my_symlink.cc
index 3ef244626ef..4162cc0a99b 100644
--- a/mysys/my_symlink.cc
+++ b/mysys/my_symlink.cc
@@ -135,13 +135,16 @@ int my_realpath(char *to, const char *filename, myf MyFlags)
{
#ifndef _WIN32
int result=0;
- char buff[PATH_MAX];
char *ptr;
DBUG_ENTER("my_realpath");
DBUG_PRINT("info",("executing realpath"));
- if ((ptr=realpath(filename,buff)))
- strmake(to,ptr,FN_REFLEN-1);
+ ptr = realpath(filename, NULL);
+ if (ptr != NULL)
+ {
+ strmake(to, ptr, FN_REFLEN-1);
+ free(ptr);
+ }
else
{
/*
main.dd_upgrade_test passes on Alpine.
Note: not tested on other platforms.
How to repeat:
Run test main.dd_upgrade_test on Alpine host (vide21).
Suggested fix:
Use NULL as second argument to realpath() in my_realpath() in my_symlink.cc