Re: setting LIBDIR_IN_LDCONFIG fails if /lib is a symlink to /usr/lib

Subject: Re: setting LIBDIR_IN_LDCONFIG fails if /lib is a symlink to /usr/lib

Date: Mon, 28 May 2018 14:41:48 +0300

To: David Bremner, notmuch@notmuchmail.org

Cc:

From: Tomi Ollila


On Sun, May 27 2018, David Bremner wrote:

> Tomi Ollila <tomi.ollila@iki.fi> writes:
>
>> we could try:
>>
>>     for path in $ldconfig_paths; do
>>         if [ "$path" = "$libdir_expanded" ]; then
>>             libdir_in_ldconfig=1
>>             break
>>         fi
>>         if [ "$path" -ef "$libdir_expanded" ]; then
>>             libdir_in_ldconfig=1
>>             break
>>         fi
>>     done
>>
>
> That looks less horrible than my idea. How portable is it? I guess test
> -ef is not POSIX.

-ef is not POSIX; but probably all shells that are used when executing this
line have builtin test which groks -ef .

  $ dash -c 'test / -ef /' || echo noef
  $ bash -c 'test / -ef /' || echo noef
  $ zsh -c 'test / -ef /' || echo noef
  $ ksh -c 'test / -ef /' || echo noef

but, problem arises when test does not support -ef -- script may exit
prematurely...

  $ ./heirloom-sh/sh -c 'if test / -ef /; then echo foo; else echo bar; fi'
  ./heirloom-sh/sh: test: unknown operator -ef
  zsh: exit 1     ./heirloom-sh/sh -c 'if test / -ef /; then echo foo; ...

OTOH:

  $ dash -c 'if test / -exf /; then echo foo; else echo bar; fi'    /home/too
  test: 1: /: unexpected operator
  bar

... so probably the shells that can succesfully execute our configure 
scripts (heirloom sh definitely will not) will not fail if, for some
reason it could not handle the -ef -option -- that particular test
just would not ever pass.

Tomi

PS: the test/[ problems that had to be mitigated with [ x"$var" = x ]
has been fixed decades ago -- but still we se these in modern scripts
that require bash...

>
> d
_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: