Sun, 17 Dec 2023 15:33:50 +0100
fix faulty string to int conversion utilities
Probably it was expected that errno is set to EINVAL when illegal characters are encountered. But this is not standard and does not happen on every system, allowing illegal strings to be parsed as valid integers.
418
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | #!/bin/sh |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | # |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | # |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | # Copyright 2018 Olaf Wintermann. All rights reserved. |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | # |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | # Redistribution and use in source and binary forms, with or without |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | # modification, are permitted provided that the following conditions are met: |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | # |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | # 1. Redistributions of source code must retain the above copyright |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | # notice, this list of conditions and the following disclaimer. |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | # |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | # 2. Redistributions in binary form must reproduce the above copyright |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | # notice, this list of conditions and the following disclaimer in the |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | # documentation and/or other materials provided with the distribution. |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | # |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | # POSSIBILITY OF SUCH DAMAGE. |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | # |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | if [ -z "$DAV_BIN" ]; |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | then |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | echo "DAV_BIN variable not set" |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | exit 1 |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | fi |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | # test |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | $DAV_BIN mkcol dav-test-repo/tests |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | if [ $? -ne 0 ]; then |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | echo "dav mkcol failed" |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | exit 2 |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | fi |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | $DAV_BIN info dav-test-repo/tests | grep "type: collection" > /dev/null |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44 | if [ $? -ne 0 ]; then |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | echo "/tests/ is not a collection" |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | exit 2 |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47 | fi |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48 | |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | $DAV_BIN mkcol dav-test-repo/tests/collection/ |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | if [ $? -ne 0 ]; then |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
51 | echo "cannot create child collection" |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
52 | exit 2 |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
53 | fi |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54 | |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55 | $DAV_BIN info dav-test-repo/tests/collection | grep "type: collection" > /dev/null |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
56 | if [ $? -ne 0 ]; then |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57 | echo "/tests/collection/ is not a collection" |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
58 | exit 2 |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
59 | fi |
cfdeeed64ac5
adds shellscript test-suite for binaries
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
60 |