Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

extract.DirectoryAndExecutableNaming is not able to handle symlinks yet #191

Open
ericsun2 opened this issue May 5, 2020 · 2 comments
Open

Comments

@ericsun2
Copy link

ericsun2 commented May 5, 2020

For example, 8.0.17 and 8.0.18 are shipped with symlinks in /bin directory.

$ tar -Jtvf mysql-8.0.17-linux-glibc2.12-x86_64.tar.xz | grep '/libcrypto\|/libssl'
lrwxrwxrwx pb2user/common          0 2019-06-26 15:35 mysql-8.0.17-linux-glibc2.12-x86_64/bin/libcrypto.so.1.0.0 -> ../lib/libcrypto.so.1.0.0
lrwxrwxrwx pb2user/common          0 2019-06-26 15:35 mysql-8.0.17-linux-glibc2.12-x86_64/bin/libssl.so.1.0.0 -> ../lib/libssl.so.1.0.0
lrwxrwxrwx pb2user/common          0 2019-06-26 15:35 mysql-8.0.17-linux-glibc2.12-x86_64/lib/libcrypto.so -> libcrypto.so.1.0.0
-rw-r--r-- pb2user/common    2605390 2019-06-26 14:49 mysql-8.0.17-linux-glibc2.12-x86_64/lib/libcrypto.so.1.0.0
lrwxrwxrwx pb2user/common          0 2019-06-26 15:35 mysql-8.0.17-linux-glibc2.12-x86_64/lib/libssl.so -> libssl.so.1.0.0
-rw-r--r-- pb2user/common     512744 2019-06-26 14:49 mysql-8.0.17-linux-glibc2.12-x86_64/lib/libssl.so.1.0.0
lrwxrwxrwx pb2user/common          0 2019-06-26 15:35 mysql-8.0.17-linux-glibc2.12-x86_64/lib/plugin/debug/libcrypto.so.1.0.0 -> ../../../lib/libcrypto.so.1.0.0
lrwxrwxrwx pb2user/common          0 2019-06-26 15:35 mysql-8.0.17-linux-glibc2.12-x86_64/lib/plugin/debug/libssl.so.1.0.0 -> ../../../lib/libssl.so.1.0.0
lrwxrwxrwx pb2user/common          0 2019-06-26 15:35 mysql-8.0.17-linux-glibc2.12-x86_64/lib/plugin/libcrypto.so.1.0.0 -> ../../lib/libcrypto.so.1.0.0
lrwxrwxrwx pb2user/common          0 2019-06-26 15:35 mysql-8.0.17-linux-glibc2.12-x86_64/lib/plugin/libssl.so.1.0.0 -> ../../lib/libssl.so.1.0.0

$ tar -Jtvf mysql-8.0.18-linux-glibc2.12-x86_64.tar.xz | grep '/libcrypto\|/libssl'
lrwxrwxrwx pb2user/common          0 2019-09-20 05:57 mysql-8.0.18-linux-glibc2.12-x86_64/bin/libcrypto.so.1.1 -> ../lib/libcrypto.so.1.1
lrwxrwxrwx pb2user/common          0 2019-09-20 05:57 mysql-8.0.18-linux-glibc2.12-x86_64/bin/libssl.so.1.1 -> ../lib/libssl.so.1.1
lrwxrwxrwx pb2user/common          0 2019-09-20 05:57 mysql-8.0.18-linux-glibc2.12-x86_64/lib/libcrypto.so -> libcrypto.so.1.1
-rw-r--r-- pb2user/common    8109016 2019-09-20 05:08 mysql-8.0.18-linux-glibc2.12-x86_64/lib/libcrypto.so.1.1
lrwxrwxrwx pb2user/common          0 2019-09-20 05:57 mysql-8.0.18-linux-glibc2.12-x86_64/lib/libssl.so -> libssl.so.1.1
-rw-r--r-- pb2user/common    2156763 2019-09-20 05:08 mysql-8.0.18-linux-glibc2.12-x86_64/lib/libssl.so.1.1
lrwxrwxrwx pb2user/common          0 2019-09-20 05:57 mysql-8.0.18-linux-glibc2.12-x86_64/lib/plugin/debug/libcrypto.so.1.1 -> ../../../lib/libcrypto.so.1.1
lrwxrwxrwx pb2user/common          0 2019-09-20 05:57 mysql-8.0.18-linux-glibc2.12-x86_64/lib/plugin/debug/libssl.so.1.1 -> ../../../lib/libssl.so.1.1
lrwxrwxrwx pb2user/common          0 2019-09-20 05:57 mysql-8.0.18-linux-glibc2.12-x86_64/lib/plugin/libcrypto.so.1.1 -> ../../lib/libcrypto.so.1.1
lrwxrwxrwx pb2user/common          0 2019-09-20 05:57 mysql-8.0.18-linux-glibc2.12-x86_64/lib/plugin/libssl.so.1.1 -> ../../lib/libssl.so.1.1

Try to experiment a little bit in Nix8FileSetEmitter.java

         return FileSet.builder()
                 .addEntry(Executable, "bin/mysqld")
                 .addEntry(Library, "bin/mysql")
                 .addEntry(Library, "bin/mysqladmin")
                 .addEntry(Library, "bin/my_print_defaults")
                 .addEntry(Library, "share/english/errmsg.sys")
-                .addEntry(FileType.Library, "lib/libssl.so.1.0.0")
-                .addEntry(FileType.Library, "lib/libcrypto.so.1.0.0")
+                .addEntry(FileType.Library, String.format("%s/libssl.so.%s", libPath, libVersion))
+                .addEntry(FileType.Library, String.format("%s/libcrypto.so.%s", libPath, libVersion))
+                .addEntry(Library, "bin/libcrypto.so." + libVersion)
+                .addEntry(Library, "bin/libssl.so." + libVersion)
                 .build();

Unfortunately, still get 0-byte file instead of symlink:

$ ls -l ~/.embedmysql/extracted/Linux-B64--/MySQL-8.0/mysql-8.0.11-linux-glibc2.12/bin/
total 700580
-rw-r--r-- 1 esun2 foo         0 May  4 23:47 libcrypto.so.1.0.0
-rw-r--r-- 1 esun2 foo         0 May  4 23:47 libssl.so.1.0.0
-rw-r--r-- 1 esun2 foo   9148728 May  4 23:46 my_print_defaults
-rw-r--r-- 1 esun2 foo  12360416 May  4 23:46 mysql
-rw-r--r-- 1 esun2 foo  11022552 May  4 23:46 mysqladmin
-rwxr--r-- 1 esun2 foo 684848952 May  4 23:47 mysqld

Am I expecting too much from the "extract" action? How is symlink supported in #185?

@jakemonO
Copy link

jakemonO commented May 8, 2020

@ericsun2
Copy link
Author

Thanks @jakemonO !
I left 2 comments in your PR, please see how we can better support 8.0.19 and above.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants