tests: add test for locale decimal processing
[coreutils.git] / tests / mkdir / p-3.sh
blob1d1e0d77e57902eed1017d6a9bdd0718c8751544
1 #!/bin/sh
2 # Ensure that mkdir-p.c's fail-to-return-to-initial-working-directory
3 # causes immediate failure. Also, ensure that we don't create
4 # subsequent, relative command-line arguments in the wrong place.
6 # Copyright (C) 2005-2019 Free Software Foundation, Inc.
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <https://www.gnu.org/licenses/>.
21 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
22 print_ver_ mkdir
23 skip_if_root_
25 mkdir no-access || framework_failure_
26 mkdir no-acce2s || framework_failure_
27 mkdir -p no-acce3s/d || framework_failure_
29 p=$(pwd)
30 (cd no-access && chmod 0 . && mkdir -p "$p/a/b" u/v) 2> /dev/null
31 test $? -eq 1 || fail=1
32 test -d "$p/a/b" || fail=1
34 # Same as above, but with a following *absolute* name, it should succeed
35 (cd no-acce2s && chmod 0 . && mkdir -p "$p/b/b" "$p/z") || fail=1
36 test -d "$p/b/b" && test -d "$p/z" || fail=1
38 # Same as above, but a trailing relative name in an unreadable directory
39 # whose parent is inaccessible. coreutils 5.97 fails this test.
40 # Perform this test only if "." is on a local file system.
41 # Otherwise, it would fail e.g., on an NFS-mounted file system.
42 if is_local_dir_ .; then
43 (cd no-acce3s/d && chmod a-r . && chmod a-rx .. &&
44 mkdir -p a/b "$p/b/c" d/e && test -d a/b && test -d d/e) || fail=1
45 test -d "$p/b/c" || fail=1
48 b=$(ls "$p/a" | tr -d '\n')
49 # With coreutils-5.3.0, this would fail with $b=bu.
50 test "x$b" = xb || fail=1
52 Exit $fail