Debian Codegraph @

t/tar-ustar-id-too-high.sh

raw symbols SCIP
1 #! /bin/shscip-shell filesystem . . `/bin/sh`.
2 # Copyright (C) 2013-2025 Free Software Foundation, Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16
17 # Check that UID or GID too high for the ustar format are correctly
18 # recognized and diagnosed by configure. See bug#8343 and bug#13588.
19
20 . test-init.shscip-shell source . . `test-init.sh`.
21
22 catscip-shell system . . cat. > configure.ac <<END
23 AC_INIT([$me], [1.0])
24 AM_INIT_AUTOMAKE([tar-ustar])
25 AC_CONFIG_FILES([Makefile])
26 AC_OUTPUT
27 END
28
29 : > Makefile.am
30
31 run_configurescip-shell shell automake 1:1.18.1-4 run_configure().()
32 {
33 st=0; ./configure ${1+"$@"} >stdout || st=$?
34 catscip-shell system . . cat. stdout || exit 1
35 testscip-shell system . . test. $st -eq 0 || exit 1
36 }
37
38 checkedscip-shell shell automake 1:1.18.1-4 checked(). ()
39 {
40 grepscip-shell system . . grep. "^checking $1\.\.\. $2$" stdout
41 }
42
43 $ACLOCAL
44 $AUTOCONF
45 $AUTOMAKE
46
47 mkdirscip-shell system . . mkdir. bin
48 catscip-shell system . . cat. > bin/id <<'END'
49 #!/bin/sh -e
50 case "$*" in
51 -u) echo "${am_uid-1000}";;
52 -g) echo "${am_gid-1000}";;
53 *) echo "id: bad/unexpected usage" >&2; exit 1;;
54 esac
55 END
56 chmodscip-shell system . . chmod. a+x bin/id
57
58 PATH=$(pwdscip-shell system . . pwd.)/bin$PATH_SEPARATOR$PATH
59
60 # Problematic ID reported in
61 # <https://bugzilla.redhat.com/show_bug.cgi?id=843376>.
62 am_uid=16777216; export am_uid
63 am_gid=1000; export am_gid
64 run_configurescip-shell shell automake 1:1.18.1-4 run_configure().
65 checkedscip-shell shell automake 1:1.18.1-4 checked(). "whether UID '$am_uid' is supported by ustar format" "no"
66 checkedscip-shell shell automake 1:1.18.1-4 checked(). "whether GID '1000' is supported by ustar format" "yes"
67 checkedscip-shell shell automake 1:1.18.1-4 checked(). "how to create a ustar tar archive" "none"
68
69 # Another problematic ID reported in
70 # <https://bugzilla.redhat.com/show_bug.cgi?id=843376>.
71 am_uid=1000; export am_uid
72 am_gid=17000000; export am_gid
73 run_configurescip-shell shell automake 1:1.18.1-4 run_configure().
74 checkedscip-shell shell automake 1:1.18.1-4 checked(). "whether UID '1000' is supported by ustar format" "yes"
75 checkedscip-shell shell automake 1:1.18.1-4 checked(). "whether GID '$am_gid' is supported by ustar format" "no"
76 checkedscip-shell shell automake 1:1.18.1-4 checked(). "how to create a ustar tar archive" "none"
77
78 # The minimal ID that is too big.
79 two_to_twentyone=$((32 * 32 * 32 * 32 * 2))
80 # <https://bugzilla.redhat.com/show_bug.cgi?id=843376>.
81 am_uid=$two_to_twentyone; export am_uid
82 am_gid=$two_to_twentyone; export am_gid
83 run_configurescip-shell shell automake 1:1.18.1-4 run_configure().
84 checkedscip-shell shell automake 1:1.18.1-4 checked(). "whether UID '$two_to_twentyone' is supported by ustar format" "no"
85 checkedscip-shell shell automake 1:1.18.1-4 checked(). "whether GID '$two_to_twentyone' is supported by ustar format" "no"
86 checkedscip-shell shell automake 1:1.18.1-4 checked(). "how to create a ustar tar archive" "none"
87
88 :