2 # Test if library search path does not terminates with non-directory
4 # Copyright (C) 2023-2024 Free Software Foundation, Inc.
5 # This file is part of the GNU C Library.
7 # The GNU C Library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
12 # The GNU C Library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with the GNU C Library; if not, see
19 # <https://www.gnu.org/licenses/>.
27 # Remove the last space to allow concatenate extra paths.
28 library_path
=$
(echo $5)
31 test_binary
=$
(basename ${test_program})
32 test_libpath
=${test_binary}-x
34 mkdir
-p ${objpfx}/${test_libpath}
35 mv ${objpfx}/tst-non-directory-mod.so ${objpfx}/${test_libpath}
37 # Check with absolute paths.
40 $rtld --inhibit-cache \
42 "$library_path":"${objpfx}"tst-non-directory-invalid:"${objpfx}"${test_libpath} \
43 $test_program 2>&1 && rc=0 || rc=$?
47 $rtld --inhibit-cache \
49 "$library_path":"${objpfx}"${test_binary}:"${objpfx}"${test_libpath} \
50 $test_program 2>&1 && rc
=0 || rc
=$?
52 # Relative paths along with non-existent path in search list.
56 $rtld --inhibit-cache \
58 "$library_path":..
/elf
/tst-non-directory-invalid
::..
/elf
/${test_libpath} \
59 $test_program 2>&1 && rc
=0 || rc
=$?
61 # Relative paths along with component in the path is not a directory in search list.
64 $rtld --inhibit-cache \
66 "$library_path":..
/elf
/${test_binary}:..
/elf
/${test_libpath} \
67 $test_program 2>&1 && rc
=0 || rc
=$?
69 # Relative paths along with non-existent path and a component in the path that is not a directory.
72 $rtld --inhibit-cache \
74 "$library_path":..
/elf
/tst-non-directory-invalid
:..
/elf
/${test_binary}:..
/elf
/${test_libpath} \
75 $test_program 2>&1 && rc
=0 || rc
=$?