Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tclreadlineInit.tcl.in #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Bogdan107
Copy link

In 64-bit linux system, standart library path is /usr/lib64 and library tclreadline.so placed correctly by installer, but installer incorrect configure tclreadlineInit.tcl script, which find library in /usr/lib.
Correct way - to change installer (Makefile or configure.in file) for correct path in @TCLRL_LIBDIR@, but easy way - correct this file.
This patch add standart hardcoded library path, depending to platform.

In 64-bit linux system, standart library path is /usr/lib64 and library tclreadline.so placed correctly, but installer incorrect configure tclreadlineInit.tcl script, which find library in /usr/lib.
Correct way - to change installer (Makefile or configure.in file) for correct path in @TCLRL_LIBDIR@, but easy way - correct this file.
This patch add standart hardcoded library path, depending to platform.
set libsList [list @TCLRL_LIBDIR@ [file dirname [info script]]]
switch -- $tcl_platform(os) {
Linux {lappend libsList /usr/lib /usr/lib64}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't script directory be consistently either ahead of or behind system directories?

Copy link
Author

@Bogdan107 Bogdan107 Feb 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think too, that system directories MUST be at first position.
But if configurer/installer correctly:

  1. place libtclreadline-2.3.8.so into per-package directory into non-system-critical library path (/usr/lib and /usr/lib64 - are predefined directories for system-critical librariy files; directories /usr/lib64/<APP_NAME>/ - for libraries of non-system or special packages; current 2.3.8 installer place tclreadline2.3.8.so to /usr/lib64/, not to /usr/lib64/tclreadline2.3.8/);
  2. place *.tcl script's to correct path (in my case this is /usr/lib64/tclreadline2.3.8/, not /usr/lib/tclreadline2.3.8/);
  3. prepare tclreadlineInit.tcl from tclreadlineInit.tcl.in (variable @TCLRL_LIBDIR@);

then the correct order will be followed.

Editing of configure.ac or Makefile for correcting installer algorithm is hard for me now, as I do not know them syntaxes. But my opinion in tcl let me to make quick and strong resolution of problem. This resolution of problem even not require reverting, if @TCLRL_LIBDIR@ variable will be prepared correctly in the future.

P.S.
For example, this listing demonstrate how other tcl* packages (non system-critical) places their *.so libraries:

$ for i in $(find /usr/lib64 -type d -name "*tcl*"); do echo $i; ls -l $i | grep -e "\.so" -e pkgIndex; done
/usr/lib64/tcl8
/usr/lib64/tcl8/site-tcl
/usr/lib64/tcl8/tcl8.5
/usr/lib64/tcl8.6
/usr/lib64/tcl8.6/cmdr_help_tcl1.1.1
-rw-r--r-- 1 root root   82 мая 13  2018 pkgIndex.tcl
/usr/lib64/tcl8.6/critcl_callback1
-rw-r----- 1 root root   378 апр 23  2020 pkgIndex.tcl
/usr/lib64/nsf2.1.0/xotcl
-rw-r--r-- 1 root root    71 окт 15 23:05 pkgIndex.tcl
/usr/lib64/ceptcl0.4
-rwxr-x--- 1 root root 60792 янв  8 09:11 libceptcl0.4.so
-rw-r--r-- 1 root root   115 янв  7 21:08 pkgIndex.tcl
/usr/lib64/graphviz/tcl
lrwxrwxrwx 1 root root      19 фев  9 11:40 libgdtclft.so -> libgdtclft.so.0.0.0
lrwxrwxrwx 1 root root      19 фев  9 11:40 libgdtclft.so.0 -> libgdtclft.so.0.0.0
-rwxr-xr-x 1 root root   34864 фев  9 11:40 libgdtclft.so.0.0.0
-rwxr-xr-x 1 root root  101296 фев  9 11:40 libgv_tcl.so
lrwxrwxrwx 1 root root      26 фев  9 11:40 libtcldot_builtin.so -> libtcldot_builtin.so.0.0.0
lrwxrwxrwx 1 root root      26 фев  9 11:40 libtcldot_builtin.so.0 -> libtcldot_builtin.so.0.0.0
-rwxr-xr-x 1 root root 1753016 фев  9 11:40 libtcldot_builtin.so.0.0.0
lrwxrwxrwx 1 root root      18 фев  9 11:40 libtcldot.so -> libtcldot.so.0.0.0
lrwxrwxrwx 1 root root      18 фев  9 11:40 libtcldot.so.0 -> libtcldot.so.0.0.0
-rwxr-xr-x 1 root root   92272 фев  9 11:40 libtcldot.so.0.0.0
lrwxrwxrwx 1 root root      19 фев  9 11:40 libtclplan.so -> libtclplan.so.0.0.0
lrwxrwxrwx 1 root root      19 фев  9 11:40 libtclplan.so.0 -> libtclplan.so.0.0.0
-rwxr-xr-x 1 root root   26520 фев  9 11:40 libtclplan.so.0.0.0
-rw-r--r-- 1 root root     321 фев  9 11:40 pkgIndex.tcl
/usr/lib64/tcllib1.20
-rw-r--r-- 1 root root 10674 окт 15 23:11 pkgIndex.tcl
/usr/lib64/tcllib1.20/pt/rde_critcl
/usr/lib64/tcllib1.20/practcl
-rw-r--r-- 1 root root    142 ноя 26  2019 pkgIndex.tcl
/usr/lib64/tcltls1.7.21
-rw-r--r-- 1 root root   469 окт 16 00:04 pkgIndex.tcl
-rwxr-xr-x 1 root root 59584 окт 16 00:04 tcltls.so
/usr/lib64/tclxml3.2
-rw-r--r-- 1 root root 180376 дек  7 03:49 libtclxml3.2.so
-rw-r--r-- 1 root root   5107 дек  7 03:49 pkgIndex.tcl
/usr/lib64/pgtcl2.7
-rwxr-xr-x 1 root root 115016 окт 24 03:00 libpgtcl2.7.5.so
-rw-r--r-- 1 root root    167 окт 24 03:00 pkgIndex.tcl
/usr/lib64/tclgeoip0.2
-rwxr-xr-x 1 root root 18592 ноя 26 12:13 libtclgeoip0.2.so
-rw-r--r-- 1 root root   118 ноя 26 12:13 pkgIndex.tcl
/usr/lib64/itcl4.2.0
-rw-r--r-- 1 root root 300384 дек 17 06:29 libitcl4.2.0.so
-rw-r--r-- 1 root root    883 дек 17 06:29 pkgIndex.tcl
/usr/lib64/tclx8.6
-rwxr-xr-x 1 root root 166240 янв 25 04:41 libtclx8.6.so
-rw-r--r-- 1 root root     77 янв 25 04:41 pkgIndex.tcl

Please note that dynamic libraries are located in the same folder as pkgIndex.tcl and other required *.tcl scripts.

Copy link
Member

@resuna resuna Feb 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was only talking about where [file dirname [info script]] goes. I was just thinking something like:

           set libsList [list @TCLRL_LIBDIR@]
           switch -- $tcl_platform(os) {
               Linux {lappend libsList /usr/lib /usr/lib64}
           }
           lappend libsList [file dirname [info script]]

So the local directories are still after the new system directories. Do you see a problem with that?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[info script] after @TCLRL_LIBDIR@? This is not a problem - it is part of a fail-safe mechanism of tlcreadline library.

/usr/lib and /usr/lib64 at the end of path's list - it is part of a fail-safe mechanism of Makefile installer.

Copy link
Author

@Bogdan107 Bogdan107 Mar 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As tclreadline-2.3.8-r1 installer (in Gentoo portage) correctly install library files under the /usr/lib64/ directory, so this pull request is not actual.

But installer still place libtclreadline-2.3.8.so to /usr/lib64/ and *.tcl library files - to /usr/lib64/tclreadline2.3.8/. So, installer script still need corrections (I think, that libtclreadline-2.3.8.so file must be placed under the /usr/lib64/tclreadline2.3.8/ directory).

# equery f tclreadline
 * Searching for tclreadline ...
 * Contents of dev-tcltk/tclreadline-2.3.8-r1:
/usr
/usr/bin
/usr/include
/usr/include/tclreadline.h
/usr/lib
/usr/lib/debug
/usr/lib/debug/usr
/usr/lib/debug/usr/lib64
/usr/lib/debug/usr/lib64/libtclreadline-2.3.8.so.debug
/usr/lib64
/usr/lib64/libtclreadline-2.3.8.so
/usr/lib64/libtclreadline.so -> libtclreadline-2.3.8.so
/usr/lib64/tclreadline2.3.8
/usr/lib64/tclreadline2.3.8/pkgIndex.tcl
/usr/lib64/tclreadline2.3.8/tclreadlineCompleter.tcl
/usr/lib64/tclreadline2.3.8/tclreadlineInit.tcl
/usr/lib64/tclreadline2.3.8/tclreadlineSetup.tcl
/usr/share
/usr/share/doc
/usr/share/doc/tclreadline-2.3.8-r1
/usr/share/doc/tclreadline-2.3.8-r1/AUTHORS.bz2
/usr/share/doc/tclreadline-2.3.8-r1/ChangeLog.bz2
/usr/share/doc/tclreadline-2.3.8-r1/README.FreeBSD.bz2
/usr/share/doc/tclreadline-2.3.8-r1/README.md.bz2
/usr/share/doc/tclreadline-2.3.8-r1/TODO.bz2
/usr/share/man
/usr/share/man/mann
/usr/share/man/mann/tclreadline.n.bz2

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The resulting path should still follow a consistent policy. Like @TCLRL_LIBDIR@, /usr/lib /usr/lib64 are system directories, and should also be used in preference to the script directory. So should be earlier in the path.

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

Successfully merging this pull request may close these issues.

2 participants