You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@apr.apache.org by bu...@apache.org on 2023/02/06 16:58:27 UTC

[Bug 66469] New: apr-1-config fails in merged-usr environment

https://bz.apache.org/bugzilla/show_bug.cgi?id=66469

            Bug ID: 66469
           Summary: apr-1-config fails in merged-usr environment
           Product: APR
           Version: 1.7.2
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: APR
          Assignee: bugs@apr.apache.org
          Reporter: ttrepl@yahoo.de
  Target Milestone: ---

Some systems have a merged /usr hierarchy - meaning that /bin is just a symlink
to /usr/bin. Even though the /bin element in $PATH is not required for those
systems, it might be still there. apr-1-config reports different (and even
wrong) data depending on $PATH or in which way the tool is called.

Prereqisites:
* A system with merged-usr
* PATH set to ...:/bin:/usr/bin:...
* apr-1.7.2 installed

Issue:
Results are different if calling apr-1-config (without leading path) instead of
calling it with an absolute path.

Example:

$ ls -la /bin
lrwxrwxrwx 1 root root 7 18. Jan 00:34 /bin -> usr/bin

(1)
$ echo $PATH
/bin:/usr/bin:...

$ apr-1-config --link-libtool --libs
  -L/bin/apr-1-config//usr/lib  -lapr-1 -luuid -lcrypt  -lpthread
  -----------------------------
                ^
                +--- Note this one

$ /usr/bin/apr-1-config --link-libtool --libs
 /usr/lib/libapr-1.la -luuid -lcrypt  -lpthread

(2)
$ export PATH=/usr/bin:/bin:...
$ apr-1-config --link-libtool --libs
 /usr/lib/libapr-1.la -luuid -lcrypt  -lpthread
$ /usr/bin/apr-1-config --link-libtool --libs
 /usr/lib/libapr-1.la -luuid -lcrypt  -lpthread

Assumption:
Looks like apr-1-config is misinterpreting "$0" in the newly added section
beginning at line 51.
In the first test (1), shell finds apr-1-config in /bin while in the second
test (2) it will be found in /usr/bin - even both are same files as /bin is
just a symlink to /usr/bin.

Suggestion:
sed -e '/^case "$0"/s;$0;$(readlink -f $0);' -i apr-1-config

The sed changes a statement 'case "$0" in' into 'case "$(readlink -f $0)" in'
so the tests do not see any different directories when checking where $0 is
located.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org