Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | Merge recent enhancements from trunk into apple-osx. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | apple-osx |
Files: | files | file ages | folders |
SHA3-256: |
de88ed862e95d89b2887d106761d507a |
User & Date: | drh 2019-07-08 20:59:23 |
2019-07-10
| ||
17:58 | Merge the 3.29.0 release into the apple-osx branch. check-in: 87aa1d70 user: drh tags: apple-osx | |
2019-07-08
| ||
20:59 | Merge recent enhancements from trunk into apple-osx. check-in: de88ed86 user: drh tags: apple-osx | |
18:35 | Fix dbfuzz2 so that it will compile on systems that do not support getrlimit(). check-in: 36295dce user: drh tags: trunk | |
2019-05-14
| ||
19:39 | Merge recent enhancements from trunk into apple-osx. check-in: 40362d51 user: drh tags: apple-osx | |
Changes to README.md.
302 302 303 303 There are many other source files. Each has a succinct header comment that 304 304 describes its purpose and role within the larger system. 305 305 306 306 <a name="vauth"></a> 307 307 ## Verifying Code Authenticity 308 308 309 -If you obtained an SQLite source tree from a secondary source, such as a 310 -GitHub mirror, and you want to verify that it has not been altered, there 311 -are a couple of ways to do that. 312 - 313 -If you have a release version of SQLite, and you are using the 314 -`sqlite3.c` amalgamation, then SHA3-256 hashes for the amalgamation are 315 -available in the [change log](https://www.sqlite.org/changes.html) on 316 -the official website. After building the `sqlite3.c` file, you can check 317 -that it is authentic by comparing the hash. This does not ensure that the 318 -test scripts are unaltered, but it does validate the deliverable part of 319 -the code and the verification process only involves computing and 320 -comparing a single hash. 321 - 322 -For versions other than an official release, or if you are building the 323 -`sqlite3.c` amalgamation using non-standard build options, the verification 324 -process is a little more involved. The `manifest` file at the root directory 325 -of the source tree 309 +The `manifest` file at the root directory of the source tree 326 310 contains either a SHA3-256 hash (for newer files) or a SHA1 hash (for 327 -older files) for every source file in the repository. You can write a script 328 -to extracts hashes from `manifest` and verifies the hashes against the 329 -corresponding files in the source tree. The SHA3-256 hash of the `manifest` 311 +older files) for every source file in the repository. 312 +The SHA3-256 hash of the `manifest` 330 313 file itself is the official name of the version of the source tree that you 331 314 have. The `manifest.uuid` file should contain the SHA3-256 hash of the 332 315 `manifest` file. If all of the above hash comparisons are correct, then 333 316 you can be confident that your source tree is authentic and unadulterated. 334 317 335 318 The format of the `manifest` file should be mostly self-explanatory, but 336 319 if you want details, they are available
Changes to config.guess.
1 1 #! /bin/sh 2 2 # Attempt to guess a canonical system name. 3 -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 4 -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, 5 -# Inc. 3 +# Copyright 1992-2019 Free Software Foundation, Inc. 6 4 7 -timestamp='2007-07-22' 5 +timestamp='2019-05-28' 8 6 9 7 # This file is free software; you can redistribute it and/or modify it 10 8 # under the terms of the GNU General Public License as published by 11 -# the Free Software Foundation; either version 2 of the License, or 9 +# the Free Software Foundation; either version 3 of the License, or 12 10 # (at your option) any later version. 13 11 # 14 12 # This program is distributed in the hope that it will be useful, but 15 13 # WITHOUT ANY WARRANTY; without even the implied warranty of 16 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 15 # General Public License for more details. 18 16 # 19 17 # You should have received a copy of the GNU General Public License 20 -# along with this program; if not, write to the Free Software 21 -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 22 -# 02110-1301, USA. 18 +# along with this program; if not, see <https://www.gnu.org/licenses/>. 23 19 # 24 20 # As a special exception to the GNU General Public License, if you 25 21 # distribute this file as part of a program that contains a 26 22 # configuration script generated by Autoconf, you may include it under 27 -# the same distribution terms that you use for the rest of that program. 28 - 29 - 30 -# Originally written by Per Bothner <per@bothner.com>. 31 -# Please send patches to <config-patches@gnu.org>. Submit a context 32 -# diff and a properly formatted ChangeLog entry. 23 +# the same distribution terms that you use for the rest of that 24 +# program. This Exception is an additional permission under section 7 25 +# of the GNU General Public License, version 3 ("GPLv3"). 26 +# 27 +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. 28 +# 29 +# You can get the latest version of this script from: 30 +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess 33 31 # 34 -# This script attempts to guess a canonical system name similar to 35 -# config.sub. If it succeeds, it prints the system name on stdout, and 36 -# exits with 0. Otherwise, it exits with 1. 37 -# 38 -# The plan is that this can be called by configure scripts if you 39 -# don't specify an explicit build system type. 32 +# Please send patches to <config-patches@gnu.org>. 33 + 40 34 41 35 me=`echo "$0" | sed -e 's,.*/,,'` 42 36 43 37 usage="\ 44 38 Usage: $0 [OPTION] 45 39 46 40 Output the configuration name of the system \`$me' is run on. 47 41 48 -Operation modes: 42 +Options: 49 43 -h, --help print this help, then exit 50 44 -t, --time-stamp print date of last modification, then exit 51 45 -v, --version print version number, then exit 52 46 53 47 Report bugs and patches to <config-patches@gnu.org>." 54 48 55 49 version="\ 56 50 GNU config.guess ($timestamp) 57 51 58 52 Originally written by Per Bothner. 59 -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 60 -Free Software Foundation, Inc. 53 +Copyright 1992-2019 Free Software Foundation, Inc. 61 54 62 55 This is free software; see the source for copying conditions. There is NO 63 56 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 64 57 65 58 help=" 66 59 Try \`$me --help' for more information." 67 60 ................................................................................ 87 80 done 88 81 89 82 if test $# != 0; then 90 83 echo "$me: too many arguments$help" >&2 91 84 exit 1 92 85 fi 93 86 94 -trap 'exit 1' 1 2 15 95 - 96 87 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a 97 88 # compiler to aid in system detection is discouraged as it requires 98 89 # temporary files to be created and, as you can see below, it is a 99 90 # headache to deal with in a portable fashion. 100 91 101 92 # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still 102 93 # use `HOST_CC' if defined, but it is deprecated. 103 94 104 95 # Portable tmp directory creation inspired by the Autoconf team. 105 96 106 -set_cc_for_build=' 107 -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; 108 -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; 109 -: ${TMPDIR=/tmp} ; 97 +tmp= 98 +# shellcheck disable=SC2172 99 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 100 + 101 +set_cc_for_build() { 102 + : "${TMPDIR=/tmp}" 103 + # shellcheck disable=SC2039 110 104 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || 111 - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || 112 - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || 113 - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; 114 -dummy=$tmp/dummy ; 115 -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; 116 -case $CC_FOR_BUILD,$HOST_CC,$CC in 117 - ,,) echo "int x;" > $dummy.c ; 118 - for c in cc gcc c89 c99 ; do 119 - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then 120 - CC_FOR_BUILD="$c"; break ; 121 - fi ; 122 - done ; 105 + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || 106 + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || 107 + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } 108 + dummy=$tmp/dummy 109 + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in 110 + ,,) echo "int x;" > "$dummy.c" 111 + for driver in cc gcc c89 c99 ; do 112 + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then 113 + CC_FOR_BUILD="$driver" 114 + break 115 + fi 116 + done 123 117 if test x"$CC_FOR_BUILD" = x ; then 124 - CC_FOR_BUILD=no_compiler_found ; 118 + CC_FOR_BUILD=no_compiler_found 125 119 fi 126 120 ;; 127 121 ,,*) CC_FOR_BUILD=$CC ;; 128 122 ,*,*) CC_FOR_BUILD=$HOST_CC ;; 129 -esac ; set_cc_for_build= ;' 123 + esac 124 +} 130 125 131 126 # This is needed to find uname on a Pyramid OSx when run in the BSD universe. 132 127 # (ghazi@noc.rutgers.edu 1994-08-24) 133 -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then 128 +if test -f /.attbin/uname ; then 134 129 PATH=$PATH:/.attbin ; export PATH 135 130 fi 136 131 137 132 UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown 138 133 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown 139 134 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown 140 135 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown 141 136 142 -if [ "${UNAME_SYSTEM}" = "Linux" ] ; then 143 - eval $set_cc_for_build 144 - cat << EOF > $dummy.c 137 +case "$UNAME_SYSTEM" in 138 +Linux|GNU|GNU/*) 139 + # If the system lacks a compiler, then just pick glibc. 140 + # We could probably try harder. 141 + LIBC=gnu 142 + 143 + set_cc_for_build 144 + cat <<-EOF > "$dummy.c" 145 145 #include <features.h> 146 - #ifdef __UCLIBC__ 147 - # ifdef __UCLIBC_CONFIG_VERSION__ 148 - LIBC=uclibc __UCLIBC_CONFIG_VERSION__ 149 - # else 146 + #if defined(__UCLIBC__) 150 147 LIBC=uclibc 151 - # endif 148 + #elif defined(__dietlibc__) 149 + LIBC=dietlibc 152 150 #else 153 151 LIBC=gnu 154 152 #endif 155 153 EOF 156 - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep LIBC= | sed -e 's: ::g'` 154 + eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" 155 + 156 + # If ldd exists, use it to detect musl libc. 157 + if command -v ldd >/dev/null && \ 158 + ldd --version 2>&1 | grep -q ^musl 159 + then 160 + LIBC=musl 157 161 fi 162 + ;; 163 +esac 158 164 159 165 # Note: order is significant - the case branches are not exclusive. 160 166 161 -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in 167 +case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in 162 168 *:NetBSD:*:*) 163 169 # NetBSD (nbsd) targets should (where applicable) match one or 164 - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, 170 + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, 165 171 # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently 166 172 # switched to ELF, *-*-netbsd* would select the old 167 173 # object file format. This provides both forward 168 174 # compatibility and a consistent mechanism for selecting the 169 175 # object file format. 170 176 # 171 177 # Note: NetBSD doesn't particularly care about the vendor 172 178 # portion of the name. We always set it to "unknown". 173 179 sysctl="sysctl -n hw.machine_arch" 174 - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ 175 - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` 176 - case "${UNAME_MACHINE_ARCH}" in 180 + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ 181 + "/sbin/$sysctl" 2>/dev/null || \ 182 + "/usr/sbin/$sysctl" 2>/dev/null || \ 183 + echo unknown)` 184 + case "$UNAME_MACHINE_ARCH" in 177 185 armeb) machine=armeb-unknown ;; 178 186 arm*) machine=arm-unknown ;; 179 187 sh3el) machine=shl-unknown ;; 180 188 sh3eb) machine=sh-unknown ;; 181 189 sh5el) machine=sh5le-unknown ;; 182 - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; 190 + earmv*) 191 + arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` 192 + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` 193 + machine="${arch}${endian}"-unknown 194 + ;; 195 + *) machine="$UNAME_MACHINE_ARCH"-unknown ;; 183 196 esac 184 197 # The Operating System including object format, if it has switched 185 - # to ELF recently, or will in the future. 186 - case "${UNAME_MACHINE_ARCH}" in 198 + # to ELF recently (or will in the future) and ABI. 199 + case "$UNAME_MACHINE_ARCH" in 200 + earm*) 201 + os=netbsdelf 202 + ;; 187 203 arm*|i386|m68k|ns32k|sh3*|sparc|vax) 188 - eval $set_cc_for_build 204 + set_cc_for_build 189 205 if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ 190 - | grep __ELF__ >/dev/null 206 + | grep -q __ELF__ 191 207 then 192 208 # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). 193 209 # Return netbsd for either. FIX? 194 210 os=netbsd 195 211 else 196 212 os=netbsdelf 197 213 fi 198 214 ;; 199 215 *) 200 216 os=netbsd 201 217 ;; 218 + esac 219 + # Determine ABI tags. 220 + case "$UNAME_MACHINE_ARCH" in 221 + earm*) 222 + expr='s/^earmv[0-9]/-eabi/;s/eb$//' 223 + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` 224 + ;; 202 225 esac 203 226 # The OS release 204 227 # Debian GNU/NetBSD machines have a different userland, and 205 228 # thus, need a distinct triplet. However, they do not need 206 229 # kernel version information, so it can be replaced with a 207 230 # suitable tag, in the style of linux-gnu. 208 - case "${UNAME_VERSION}" in 231 + case "$UNAME_VERSION" in 209 232 Debian*) 210 233 release='-gnu' 211 234 ;; 212 235 *) 213 - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` 236 + release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` 214 237 ;; 215 238 esac 216 239 # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: 217 240 # contains redundant information, the shorter form: 218 241 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. 219 - echo "${machine}-${os}${release}" 242 + echo "$machine-${os}${release}${abi-}" 243 + exit ;; 244 + *:Bitrig:*:*) 245 + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` 246 + echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" 220 247 exit ;; 221 248 *:OpenBSD:*:*) 222 249 UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` 223 - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} 250 + echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" 251 + exit ;; 252 + *:LibertyBSD:*:*) 253 + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` 254 + echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" 255 + exit ;; 256 + *:MidnightBSD:*:*) 257 + echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" 224 258 exit ;; 225 259 *:ekkoBSD:*:*) 226 - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} 260 + echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" 227 261 exit ;; 228 262 *:SolidBSD:*:*) 229 - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} 263 + echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" 230 264 exit ;; 231 265 macppc:MirBSD:*:*) 232 - echo powerpc-unknown-mirbsd${UNAME_RELEASE} 266 + echo powerpc-unknown-mirbsd"$UNAME_RELEASE" 233 267 exit ;; 234 268 *:MirBSD:*:*) 235 - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} 269 + echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" 270 + exit ;; 271 + *:Sortix:*:*) 272 + echo "$UNAME_MACHINE"-unknown-sortix 273 + exit ;; 274 + *:Redox:*:*) 275 + echo "$UNAME_MACHINE"-unknown-redox 276 + exit ;; 277 + mips:OSF1:*.*) 278 + echo mips-dec-osf1 236 279 exit ;; 237 280 alpha:OSF1:*:*) 238 281 case $UNAME_RELEASE in 239 282 *4.0) 240 283 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` 241 284 ;; 242 285 *5.*) ................................................................................ 246 289 # According to Compaq, /usr/sbin/psrinfo has been available on 247 290 # OSF/1 and Tru64 systems produced since 1995. I hope that 248 291 # covers most systems running today. This code pipes the CPU 249 292 # types through head -n 1, so we only detect the type of CPU 0. 250 293 ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` 251 294 case "$ALPHA_CPU_TYPE" in 252 295 "EV4 (21064)") 253 - UNAME_MACHINE="alpha" ;; 296 + UNAME_MACHINE=alpha ;; 254 297 "EV4.5 (21064)") 255 - UNAME_MACHINE="alpha" ;; 298 + UNAME_MACHINE=alpha ;; 256 299 "LCA4 (21066/21068)") 257 - UNAME_MACHINE="alpha" ;; 300 + UNAME_MACHINE=alpha ;; 258 301 "EV5 (21164)") 259 - UNAME_MACHINE="alphaev5" ;; 302 + UNAME_MACHINE=alphaev5 ;; 260 303 "EV5.6 (21164A)") 261 - UNAME_MACHINE="alphaev56" ;; 304 + UNAME_MACHINE=alphaev56 ;; 262 305 "EV5.6 (21164PC)") 263 - UNAME_MACHINE="alphapca56" ;; 306 + UNAME_MACHINE=alphapca56 ;; 264 307 "EV5.7 (21164PC)") 265 - UNAME_MACHINE="alphapca57" ;; 308 + UNAME_MACHINE=alphapca57 ;; 266 309 "EV6 (21264)") 267 - UNAME_MACHINE="alphaev6" ;; 310 + UNAME_MACHINE=alphaev6 ;; 268 311 "EV6.7 (21264A)") 269 - UNAME_MACHINE="alphaev67" ;; 312 + UNAME_MACHINE=alphaev67 ;; 270 313 "EV6.8CB (21264C)") 271 - UNAME_MACHINE="alphaev68" ;; 314 + UNAME_MACHINE=alphaev68 ;; 272 315 "EV6.8AL (21264B)") 273 - UNAME_MACHINE="alphaev68" ;; 316 + UNAME_MACHINE=alphaev68 ;; 274 317 "EV6.8CX (21264D)") 275 - UNAME_MACHINE="alphaev68" ;; 318 + UNAME_MACHINE=alphaev68 ;; 276 319 "EV6.9A (21264/EV69A)") 277 - UNAME_MACHINE="alphaev69" ;; 320 + UNAME_MACHINE=alphaev69 ;; 278 321 "EV7 (21364)") 279 - UNAME_MACHINE="alphaev7" ;; 322 + UNAME_MACHINE=alphaev7 ;; 280 323 "EV7.9 (21364A)") 281 - UNAME_MACHINE="alphaev79" ;; 324 + UNAME_MACHINE=alphaev79 ;; 282 325 esac 283 326 # A Pn.n version is a patched version. 284 327 # A Vn.n version is a released version. 285 328 # A Tn.n version is a released field test version. 286 329 # A Xn.n version is an unreleased experimental baselevel. 287 330 # 1.2 uses "1.2" for uname -r. 288 - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` 289 - exit ;; 290 - Alpha\ *:Windows_NT*:*) 291 - # How do we know it's Interix rather than the generic POSIX subsystem? 292 - # Should we change UNAME_MACHINE based on the output of uname instead 293 - # of the specific Alpha model? 294 - echo alpha-pc-interix 295 - exit ;; 296 - 21064:Windows_NT:50:3) 297 - echo alpha-dec-winnt3.5 298 - exit ;; 331 + echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" 332 + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. 333 + exitcode=$? 334 + trap '' 0 335 + exit $exitcode ;; 299 336 Amiga*:UNIX_System_V:4.0:*) 300 337 echo m68k-unknown-sysv4 301 338 exit ;; 302 339 *:[Aa]miga[Oo][Ss]:*:*) 303 - echo ${UNAME_MACHINE}-unknown-amigaos 340 + echo "$UNAME_MACHINE"-unknown-amigaos 304 341 exit ;; 305 342 *:[Mm]orph[Oo][Ss]:*:*) 306 - echo ${UNAME_MACHINE}-unknown-morphos 343 + echo "$UNAME_MACHINE"-unknown-morphos 307 344 exit ;; 308 345 *:OS/390:*:*) 309 346 echo i370-ibm-openedition 310 347 exit ;; 311 348 *:z/VM:*:*) 312 349 echo s390-ibm-zvmoe 313 350 exit ;; 314 351 *:OS400:*:*) 315 352 echo powerpc-ibm-os400 316 353 exit ;; 317 354 arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) 318 - echo arm-acorn-riscix${UNAME_RELEASE} 355 + echo arm-acorn-riscix"$UNAME_RELEASE" 319 356 exit ;; 320 - arm:riscos:*:*|arm:RISCOS:*:*) 357 + arm*:riscos:*:*|arm*:RISCOS:*:*) 321 358 echo arm-unknown-riscos 322 359 exit ;; 323 360 SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) 324 361 echo hppa1.1-hitachi-hiuxmpp 325 362 exit ;; 326 363 Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) 327 364 # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. ................................................................................ 337 374 DRS?6000:unix:4.0:6*) 338 375 echo sparc-icl-nx6 339 376 exit ;; 340 377 DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) 341 378 case `/usr/bin/uname -p` in 342 379 sparc) echo sparc-icl-nx7; exit ;; 343 380 esac ;; 381 + s390x:SunOS:*:*) 382 + echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" 383 + exit ;; 344 384 sun4H:SunOS:5.*:*) 345 - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 385 + echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" 346 386 exit ;; 347 387 sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) 348 - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 388 + echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" 389 + exit ;; 390 + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) 391 + echo i386-pc-auroraux"$UNAME_RELEASE" 349 392 exit ;; 350 393 i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) 351 - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 394 + set_cc_for_build 395 + SUN_ARCH=i386 396 + # If there is a compiler, see if it is configured for 64-bit objects. 397 + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. 398 + # This test works for both compilers. 399 + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then 400 + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ 401 + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ 402 + grep IS_64BIT_ARCH >/dev/null 403 + then 404 + SUN_ARCH=x86_64 405 + fi 406 + fi 407 + echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" 352 408 exit ;; 353 409 sun4*:SunOS:6*:*) 354 410 # According to config.sub, this is the proper way to canonicalize 355 411 # SunOS6. Hard to guess exactly what SunOS6 will be like, but 356 412 # it's likely to be more like Solaris than SunOS4. 357 - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 413 + echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" 358 414 exit ;; 359 415 sun4*:SunOS:*:*) 360 416 case "`/usr/bin/arch -k`" in 361 417 Series*|S4*) 362 418 UNAME_RELEASE=`uname -v` 363 419 ;; 364 420 esac 365 421 # Japanese Language versions have a version number like `4.1.3-JL'. 366 - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` 422 + echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" 367 423 exit ;; 368 424 sun3*:SunOS:*:*) 369 - echo m68k-sun-sunos${UNAME_RELEASE} 425 + echo m68k-sun-sunos"$UNAME_RELEASE" 370 426 exit ;; 371 427 sun*:*:4.2BSD:*) 372 428 UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` 373 - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 429 + test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 374 430 case "`/bin/arch`" in 375 431 sun3) 376 - echo m68k-sun-sunos${UNAME_RELEASE} 432 + echo m68k-sun-sunos"$UNAME_RELEASE" 377 433 ;; 378 434 sun4) 379 - echo sparc-sun-sunos${UNAME_RELEASE} 435 + echo sparc-sun-sunos"$UNAME_RELEASE" 380 436 ;; 381 437 esac 382 438 exit ;; 383 439 aushp:SunOS:*:*) 384 - echo sparc-auspex-sunos${UNAME_RELEASE} 440 + echo sparc-auspex-sunos"$UNAME_RELEASE" 385 441 exit ;; 386 442 # The situation for MiNT is a little confusing. The machine name 387 443 # can be virtually everything (everything which is not 388 444 # "atarist" or "atariste" at least should have a processor 389 445 # > m68000). The system name ranges from "MiNT" over "FreeMiNT" 390 446 # to the lowercase version "mint" (or "freemint"). Finally 391 447 # the system name "TOS" denotes a system which is actually not 392 448 # MiNT. But MiNT is downward compatible to TOS, so this should 393 449 # be no problem. 394 450 atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) 395 - echo m68k-atari-mint${UNAME_RELEASE} 451 + echo m68k-atari-mint"$UNAME_RELEASE" 396 452 exit ;; 397 453 atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) 398 - echo m68k-atari-mint${UNAME_RELEASE} 454 + echo m68k-atari-mint"$UNAME_RELEASE" 399 455 exit ;; 400 456 *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) 401 - echo m68k-atari-mint${UNAME_RELEASE} 457 + echo m68k-atari-mint"$UNAME_RELEASE" 402 458 exit ;; 403 459 milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) 404 - echo m68k-milan-mint${UNAME_RELEASE} 460 + echo m68k-milan-mint"$UNAME_RELEASE" 405 461 exit ;; 406 462 hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) 407 - echo m68k-hades-mint${UNAME_RELEASE} 463 + echo m68k-hades-mint"$UNAME_RELEASE" 408 464 exit ;; 409 465 *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) 410 - echo m68k-unknown-mint${UNAME_RELEASE} 466 + echo m68k-unknown-mint"$UNAME_RELEASE" 411 467 exit ;; 412 468 m68k:machten:*:*) 413 - echo m68k-apple-machten${UNAME_RELEASE} 469 + echo m68k-apple-machten"$UNAME_RELEASE" 414 470 exit ;; 415 471 powerpc:machten:*:*) 416 - echo powerpc-apple-machten${UNAME_RELEASE} 472 + echo powerpc-apple-machten"$UNAME_RELEASE" 417 473 exit ;; 418 474 RISC*:Mach:*:*) 419 475 echo mips-dec-mach_bsd4.3 420 476 exit ;; 421 477 RISC*:ULTRIX:*:*) 422 - echo mips-dec-ultrix${UNAME_RELEASE} 478 + echo mips-dec-ultrix"$UNAME_RELEASE" 423 479 exit ;; 424 480 VAX*:ULTRIX*:*:*) 425 - echo vax-dec-ultrix${UNAME_RELEASE} 481 + echo vax-dec-ultrix"$UNAME_RELEASE" 426 482 exit ;; 427 483 2020:CLIX:*:* | 2430:CLIX:*:*) 428 - echo clipper-intergraph-clix${UNAME_RELEASE} 484 + echo clipper-intergraph-clix"$UNAME_RELEASE" 429 485 exit ;; 430 486 mips:*:*:UMIPS | mips:*:*:RISCos) 431 - eval $set_cc_for_build 432 - sed 's/^ //' << EOF >$dummy.c 487 + set_cc_for_build 488 + sed 's/^ //' << EOF > "$dummy.c" 433 489 #ifdef __cplusplus 434 490 #include <stdio.h> /* for printf() prototype */ 435 491 int main (int argc, char *argv[]) { 436 492 #else 437 493 int main (argc, argv) int argc; char *argv[]; { 438 494 #endif 439 495 #if defined (host_mips) && defined (MIPSEB) 440 496 #if defined (SYSTYPE_SYSV) 441 - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); 497 + printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); 442 498 #endif 443 499 #if defined (SYSTYPE_SVR4) 444 - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); 500 + printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); 445 501 #endif 446 502 #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) 447 - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); 503 + printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); 448 504 #endif 449 505 #endif 450 506 exit (-1); 451 507 } 452 508 EOF 453 - $CC_FOR_BUILD -o $dummy $dummy.c && 454 - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && 455 - SYSTEM_NAME=`$dummy $dummyarg` && 509 + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && 510 + dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && 511 + SYSTEM_NAME=`"$dummy" "$dummyarg"` && 456 512 { echo "$SYSTEM_NAME"; exit; } 457 - echo mips-mips-riscos${UNAME_RELEASE} 513 + echo mips-mips-riscos"$UNAME_RELEASE" 458 514 exit ;; 459 515 Motorola:PowerMAX_OS:*:*) 460 516 echo powerpc-motorola-powermax 461 517 exit ;; 462 518 Motorola:*:4.3:PL8-*) 463 519 echo powerpc-harris-powermax 464 520 exit ;; ................................................................................ 476 532 exit ;; 477 533 m88k:*:3*:R3*) 478 534 echo m88k-motorola-sysv3 479 535 exit ;; 480 536 AViiON:dgux:*:*) 481 537 # DG/UX returns AViiON for all architectures 482 538 UNAME_PROCESSOR=`/usr/bin/uname -p` 483 - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] 539 + if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] 484 540 then 485 - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ 486 - [ ${TARGET_BINARY_INTERFACE}x = x ] 541 + if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ 542 + [ "$TARGET_BINARY_INTERFACE"x = x ] 487 543 then 488 - echo m88k-dg-dgux${UNAME_RELEASE} 544 + echo m88k-dg-dgux"$UNAME_RELEASE" 489 545 else 490 - echo m88k-dg-dguxbcs${UNAME_RELEASE} 546 + echo m88k-dg-dguxbcs"$UNAME_RELEASE" 491 547 fi 492 548 else 493 - echo i586-dg-dgux${UNAME_RELEASE} 549 + echo i586-dg-dgux"$UNAME_RELEASE" 494 550 fi 495 551 exit ;; 496 552 M88*:DolphinOS:*:*) # DolphinOS (SVR3) 497 553 echo m88k-dolphin-sysv3 498 554 exit ;; 499 555 M88*:*:R3*:*) 500 556 # Delta 88k system running SVR3 ................................................................................ 503 559 XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) 504 560 echo m88k-tektronix-sysv3 505 561 exit ;; 506 562 Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) 507 563 echo m68k-tektronix-bsd 508 564 exit ;; 509 565 *:IRIX*:*:*) 510 - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` 566 + echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" 511 567 exit ;; 512 568 ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. 513 569 echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id 514 570 exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' 515 571 i*86:AIX:*:*) 516 572 echo i386-ibm-aix 517 573 exit ;; 518 574 ia64:AIX:*:*) 519 575 if [ -x /usr/bin/oslevel ] ; then 520 576 IBM_REV=`/usr/bin/oslevel` 521 577 else 522 - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} 578 + IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" 523 579 fi 524 - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} 580 + echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" 525 581 exit ;; 526 582 *:AIX:2:3) 527 583 if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then 528 - eval $set_cc_for_build 529 - sed 's/^ //' << EOF >$dummy.c 584 + set_cc_for_build 585 + sed 's/^ //' << EOF > "$dummy.c" 530 586 #include <sys/systemcfg.h> 531 587 532 588 main() 533 589 { 534 590 if (!__power_pc()) 535 591 exit(1); 536 592 puts("powerpc-ibm-aix3.2.5"); 537 593 exit(0); 538 594 } 539 595 EOF 540 - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` 596 + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` 541 597 then 542 598 echo "$SYSTEM_NAME" 543 599 else 544 600 echo rs6000-ibm-aix3.2.5 545 601 fi 546 602 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then 547 603 echo rs6000-ibm-aix3.2.4 548 604 else 549 605 echo rs6000-ibm-aix3.2 550 606 fi 551 607 exit ;; 552 - *:AIX:*:[45]) 608 + *:AIX:*:[4567]) 553 609 IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` 554 - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then 610 + if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then 555 611 IBM_ARCH=rs6000 556 612 else 557 613 IBM_ARCH=powerpc 558 614 fi 559 - if [ -x /usr/bin/oslevel ] ; then 560 - IBM_REV=`/usr/bin/oslevel` 615 + if [ -x /usr/bin/lslpp ] ; then 616 + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | 617 + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` 561 618 else 562 - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} 619 + IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" 563 620 fi 564 - echo ${IBM_ARCH}-ibm-aix${IBM_REV} 621 + echo "$IBM_ARCH"-ibm-aix"$IBM_REV" 565 622 exit ;; 566 623 *:AIX:*:*) 567 624 echo rs6000-ibm-aix 568 625 exit ;; 569 - ibmrt:4.4BSD:*|romp-ibm:BSD:*) 626 + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) 570 627 echo romp-ibm-bsd4.4 571 628 exit ;; 572 629 ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and 573 - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to 630 + echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to 574 631 exit ;; # report: romp-ibm BSD 4.3 575 632 *:BOSX:*:*) 576 633 echo rs6000-bull-bosx 577 634 exit ;; 578 635 DPX/2?00:B.O.S.:*:*) 579 636 echo m68k-bull-sysv3 580 637 exit ;; ................................................................................ 581 638 9000/[34]??:4.3bsd:1.*:*) 582 639 echo m68k-hp-bsd 583 640 exit ;; 584 641 hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) 585 642 echo m68k-hp-bsd4.4 586 643 exit ;; 587 644 9000/[34678]??:HP-UX:*:*) 588 - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` 589 - case "${UNAME_MACHINE}" in 645 + HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` 646 + case "$UNAME_MACHINE" in 590 647 9000/31? ) HP_ARCH=m68000 ;; 591 648 9000/[34]?? ) HP_ARCH=m68k ;; 592 649 9000/[678][0-9][0-9]) 593 650 if [ -x /usr/bin/getconf ]; then 594 651 sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` 595 652 sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` 596 - case "${sc_cpu_version}" in 597 - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 598 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 653 + case "$sc_cpu_version" in 654 + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 655 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 599 656 532) # CPU_PA_RISC2_0 600 - case "${sc_kernel_bits}" in 601 - 32) HP_ARCH="hppa2.0n" ;; 602 - 64) HP_ARCH="hppa2.0w" ;; 603 - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 657 + case "$sc_kernel_bits" in 658 + 32) HP_ARCH=hppa2.0n ;; 659 + 64) HP_ARCH=hppa2.0w ;; 660 + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 604 661 esac ;; 605 662 esac 606 663 fi 607 - if [ "${HP_ARCH}" = "" ]; then 608 - eval $set_cc_for_build 609 - sed 's/^ //' << EOF >$dummy.c 664 + if [ "$HP_ARCH" = "" ]; then 665 + set_cc_for_build 666 + sed 's/^ //' << EOF > "$dummy.c" 610 667 611 668 #define _HPUX_SOURCE 612 669 #include <stdlib.h> 613 670 #include <unistd.h> 614 671 615 672 int main () 616 673 { ................................................................................ 635 692 puts ("hppa2.0"); break; 636 693 #endif 637 694 default: puts ("hppa1.0"); break; 638 695 } 639 696 exit (0); 640 697 } 641 698 EOF 642 - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` 699 + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` 643 700 test -z "$HP_ARCH" && HP_ARCH=hppa 644 701 fi ;; 645 702 esac 646 - if [ ${HP_ARCH} = "hppa2.0w" ] 703 + if [ "$HP_ARCH" = hppa2.0w ] 647 704 then 648 - eval $set_cc_for_build 705 + set_cc_for_build 649 706 650 707 # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating 651 708 # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler 652 709 # generating 64-bit code. GNU and HP use different nomenclature: 653 710 # 654 711 # $ CC_FOR_BUILD=cc ./config.guess 655 712 # => hppa2.0w-hp-hpux11.23 656 713 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess 657 714 # => hppa64-hp-hpux11.23 658 715 659 - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | 660 - grep __LP64__ >/dev/null 716 + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | 717 + grep -q __LP64__ 661 718 then 662 - HP_ARCH="hppa2.0w" 719 + HP_ARCH=hppa2.0w 663 720 else 664 - HP_ARCH="hppa64" 721 + HP_ARCH=hppa64 665 722 fi 666 723 fi 667 - echo ${HP_ARCH}-hp-hpux${HPUX_REV} 724 + echo "$HP_ARCH"-hp-hpux"$HPUX_REV" 668 725 exit ;; 669 726 ia64:HP-UX:*:*) 670 - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` 671 - echo ia64-hp-hpux${HPUX_REV} 727 + HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` 728 + echo ia64-hp-hpux"$HPUX_REV" 672 729 exit ;; 673 730 3050*:HI-UX:*:*) 674 - eval $set_cc_for_build 675 - sed 's/^ //' << EOF >$dummy.c 731 + set_cc_for_build 732 + sed 's/^ //' << EOF > "$dummy.c" 676 733 #include <unistd.h> 677 734 int 678 735 main () 679 736 { 680 737 long cpu = sysconf (_SC_CPU_VERSION); 681 738 /* The order matters, because CPU_IS_HP_MC68K erroneously returns 682 739 true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct ................................................................................ 693 750 } 694 751 else if (CPU_IS_HP_MC68K (cpu)) 695 752 puts ("m68k-hitachi-hiuxwe2"); 696 753 else puts ("unknown-hitachi-hiuxwe2"); 697 754 exit (0); 698 755 } 699 756 EOF 700 - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && 757 + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && 701 758 { echo "$SYSTEM_NAME"; exit; } 702 759 echo unknown-hitachi-hiuxwe2 703 760 exit ;; 704 761 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) 705 762 echo hppa1.1-hp-bsd 706 763 exit ;; 707 764 9000/8??:4.3bsd:*:*) ................................................................................ 714 771 echo hppa1.1-hp-osf 715 772 exit ;; 716 773 hp8??:OSF1:*:*) 717 774 echo hppa1.0-hp-osf 718 775 exit ;; 719 776 i*86:OSF1:*:*) 720 777 if [ -x /usr/sbin/sysversion ] ; then 721 - echo ${UNAME_MACHINE}-unknown-osf1mk 778 + echo "$UNAME_MACHINE"-unknown-osf1mk 722 779 else 723 - echo ${UNAME_MACHINE}-unknown-osf1 780 + echo "$UNAME_MACHINE"-unknown-osf1 724 781 fi 725 782 exit ;; 726 783 parisc*:Lites*:*:*) 727 784 echo hppa1.1-hp-lites 728 785 exit ;; 729 786 C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) 730 787 echo c1-convex-bsd ................................................................................ 741 798 C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) 742 799 echo c38-convex-bsd 743 800 exit ;; 744 801 C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) 745 802 echo c4-convex-bsd 746 803 exit ;; 747 804 CRAY*Y-MP:*:*:*) 748 - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 805 + echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' 749 806 exit ;; 750 807 CRAY*[A-Z]90:*:*:*) 751 - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ 808 + echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ 752 809 | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ 753 810 -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ 754 811 -e 's/\.[^.]*$/.X/' 755 812 exit ;; 756 813 CRAY*TS:*:*:*) 757 - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 814 + echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' 758 815 exit ;; 759 816 CRAY*T3E:*:*:*) 760 - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 817 + echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' 761 818 exit ;; 762 819 CRAY*SV1:*:*:*) 763 - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 820 + echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' 764 821 exit ;; 765 822 *:UNICOS/mp:*:*) 766 - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 823 + echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' 767 824 exit ;; 768 825 F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) 769 - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` 770 - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` 771 - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` 826 + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` 827 + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` 828 + FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` 772 829 echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" 773 830 exit ;; 774 831 5000:UNIX_System_V:4.*:*) 775 - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` 776 - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` 832 + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` 833 + FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` 777 834 echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" 778 835 exit ;; 779 836 i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) 780 - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} 837 + echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" 781 838 exit ;; 782 839 sparc*:BSD/OS:*:*) 783 - echo sparc-unknown-bsdi${UNAME_RELEASE} 840 + echo sparc-unknown-bsdi"$UNAME_RELEASE" 784 841 exit ;; 785 842 *:BSD/OS:*:*) 786 - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} 843 + echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" 844 + exit ;; 845 + arm:FreeBSD:*:*) 846 + UNAME_PROCESSOR=`uname -p` 847 + set_cc_for_build 848 + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ 849 + | grep -q __ARM_PCS_VFP 850 + then 851 + echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi 852 + else 853 + echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf 854 + fi 787 855 exit ;; 788 856 *:FreeBSD:*:*) 789 - case ${UNAME_MACHINE} in 790 - pc98) 791 - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; 857 + UNAME_PROCESSOR=`/usr/bin/uname -p` 858 + case "$UNAME_PROCESSOR" in 792 859 amd64) 793 - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; 794 - *) 795 - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; 860 + UNAME_PROCESSOR=x86_64 ;; 861 + i386) 862 + UNAME_PROCESSOR=i586 ;; 796 863 esac 864 + echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" 797 865 exit ;; 798 866 i*:CYGWIN*:*) 799 - echo ${UNAME_MACHINE}-pc-cygwin 867 + echo "$UNAME_MACHINE"-pc-cygwin 868 + exit ;; 869 + *:MINGW64*:*) 870 + echo "$UNAME_MACHINE"-pc-mingw64 800 871 exit ;; 801 872 *:MINGW*:*) 802 - echo ${UNAME_MACHINE}-pc-mingw32 873 + echo "$UNAME_MACHINE"-pc-mingw32 803 874 exit ;; 804 - i*:windows32*:*) 805 - # uname -m includes "-pc" on this system. 806 - echo ${UNAME_MACHINE}-mingw32 875 + *:MSYS*:*) 876 + echo "$UNAME_MACHINE"-pc-msys 807 877 exit ;; 808 878 i*:PW*:*) 809 - echo ${UNAME_MACHINE}-pc-pw32 879 + echo "$UNAME_MACHINE"-pc-pw32 810 880 exit ;; 811 - *:Interix*:[3456]*) 812 - case ${UNAME_MACHINE} in 881 + *:Interix*:*) 882 + case "$UNAME_MACHINE" in 813 883 x86) 814 - echo i586-pc-interix${UNAME_RELEASE} 884 + echo i586-pc-interix"$UNAME_RELEASE" 815 885 exit ;; 816 - EM64T | authenticamd) 817 - echo x86_64-unknown-interix${UNAME_RELEASE} 886 + authenticamd | genuineintel | EM64T) 887 + echo x86_64-unknown-interix"$UNAME_RELEASE" 888 + exit ;; 889 + IA64) 890 + echo ia64-unknown-interix"$UNAME_RELEASE" 818 891 exit ;; 819 892 esac ;; 820 - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) 821 - echo i${UNAME_MACHINE}-pc-mks 822 - exit ;; 823 - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) 824 - # How do we know it's Interix rather than the generic POSIX subsystem? 825 - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we 826 - # UNAME_MACHINE based on the output of uname instead of i386? 827 - echo i586-pc-interix 828 - exit ;; 829 893 i*:UWIN*:*) 830 - echo ${UNAME_MACHINE}-pc-uwin 894 + echo "$UNAME_MACHINE"-pc-uwin 831 895 exit ;; 832 896 amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) 833 - echo x86_64-unknown-cygwin 834 - exit ;; 835 - p*:CYGWIN*:*) 836 - echo powerpcle-unknown-cygwin 897 + echo x86_64-pc-cygwin 837 898 exit ;; 838 899 prep*:SunOS:5.*:*) 839 - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` 900 + echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" 840 901 exit ;; 841 902 *:GNU:*:*) 842 903 # the GNU system 843 - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` 904 + echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" 844 905 exit ;; 845 906 *:GNU/*:*:*) 846 907 # other systems with GNU libc and userland 847 - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu 848 - exit ;; 849 - i*86:Minix:*:*) 850 - echo ${UNAME_MACHINE}-pc-minix 851 - exit ;; 852 - arm*:Linux:*:*) 853 - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 854 - exit ;; 855 - avr32*:Linux:*:*) 856 - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 857 - exit ;; 858 - cris:Linux:*:*) 859 - echo cris-axis-linux-${LIBC} 860 - exit ;; 861 - crisv32:Linux:*:*) 862 - echo crisv32-axis-linux-${LIBC} 863 - exit ;; 864 - frv:Linux:*:*) 865 - echo frv-unknown-linux-${LIBC} 866 - exit ;; 867 - ia64:Linux:*:*) 868 - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 869 - exit ;; 870 - m32r*:Linux:*:*) 871 - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 872 - exit ;; 873 - m68*:Linux:*:*) 874 - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 875 - exit ;; 876 - mips:Linux:*:*) 877 - eval $set_cc_for_build 878 - sed 's/^ //' << EOF >$dummy.c 879 - #undef CPU 880 - #undef mips 881 - #undef mipsel 882 - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) 883 - CPU=mipsel 884 - #else 885 - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) 886 - CPU=mips 887 - #else 888 - CPU= 889 - #endif 890 - #endif 891 -EOF 892 - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' 893 - /^CPU/{ 894 - s: ::g 895 - p 896 - }'`" 897 - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } 898 - ;; 899 - mips64:Linux:*:*) 900 - eval $set_cc_for_build 901 - sed 's/^ //' << EOF >$dummy.c 902 - #undef CPU 903 - #undef mips64 904 - #undef mips64el 905 - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) 906 - CPU=mips64el 907 - #else 908 - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) 909 - CPU=mips64 910 - #else 911 - CPU= 912 - #endif 913 - #endif 914 -EOF 915 - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' 916 - /^CPU/{ 917 - s: ::g 918 - p 919 - }'`" 920 - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } 921 - ;; 922 - or32:Linux:*:*) 923 - echo or32-unknown-linux-${LIBC} 924 - exit ;; 925 - ppc:Linux:*:*) 926 - echo powerpc-unknown-linux-${LIBC} 927 - exit ;; 928 - ppc64:Linux:*:*) 929 - echo powerpc64-unknown-linux-${LIBC} 908 + echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" 909 + exit ;; 910 + *:Minix:*:*) 911 + echo "$UNAME_MACHINE"-unknown-minix 912 + exit ;; 913 + aarch64:Linux:*:*) 914 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 915 + exit ;; 916 + aarch64_be:Linux:*:*) 917 + UNAME_MACHINE=aarch64_be 918 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 930 919 exit ;; 931 920 alpha:Linux:*:*) 932 921 case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in 933 922 EV5) UNAME_MACHINE=alphaev5 ;; 934 923 EV56) UNAME_MACHINE=alphaev56 ;; 935 924 PCA56) UNAME_MACHINE=alphapca56 ;; 936 925 PCA57) UNAME_MACHINE=alphapca56 ;; 937 926 EV6) UNAME_MACHINE=alphaev6 ;; 938 927 EV67) UNAME_MACHINE=alphaev67 ;; 939 928 EV68*) UNAME_MACHINE=alphaev68 ;; 940 929 esac 941 - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null 942 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi 943 - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 930 + objdump --private-headers /bin/sh | grep -q ld.so.1 931 + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi 932 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 933 + exit ;; 934 + arc:Linux:*:* | arceb:Linux:*:*) 935 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 936 + exit ;; 937 + arm*:Linux:*:*) 938 + set_cc_for_build 939 + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ 940 + | grep -q __ARM_EABI__ 941 + then 942 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 943 + else 944 + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ 945 + | grep -q __ARM_PCS_VFP 946 + then 947 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi 948 + else 949 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf 950 + fi 951 + fi 952 + exit ;; 953 + avr32*:Linux:*:*) 954 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 955 + exit ;; 956 + cris:Linux:*:*) 957 + echo "$UNAME_MACHINE"-axis-linux-"$LIBC" 958 + exit ;; 959 + crisv32:Linux:*:*) 960 + echo "$UNAME_MACHINE"-axis-linux-"$LIBC" 961 + exit ;; 962 + e2k:Linux:*:*) 963 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 964 + exit ;; 965 + frv:Linux:*:*) 966 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 967 + exit ;; 968 + hexagon:Linux:*:*) 969 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 970 + exit ;; 971 + i*86:Linux:*:*) 972 + echo "$UNAME_MACHINE"-pc-linux-"$LIBC" 973 + exit ;; 974 + ia64:Linux:*:*) 975 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 976 + exit ;; 977 + k1om:Linux:*:*) 978 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 979 + exit ;; 980 + m32r*:Linux:*:*) 981 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 982 + exit ;; 983 + m68*:Linux:*:*) 984 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 985 + exit ;; 986 + mips:Linux:*:* | mips64:Linux:*:*) 987 + set_cc_for_build 988 + IS_GLIBC=0 989 + test x"${LIBC}" = xgnu && IS_GLIBC=1 990 + sed 's/^ //' << EOF > "$dummy.c" 991 + #undef CPU 992 + #undef mips 993 + #undef mipsel 994 + #undef mips64 995 + #undef mips64el 996 + #if ${IS_GLIBC} && defined(_ABI64) 997 + LIBCABI=gnuabi64 998 + #else 999 + #if ${IS_GLIBC} && defined(_ABIN32) 1000 + LIBCABI=gnuabin32 1001 + #else 1002 + LIBCABI=${LIBC} 1003 + #endif 1004 + #endif 1005 + 1006 + #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 1007 + CPU=mipsisa64r6 1008 + #else 1009 + #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 1010 + CPU=mipsisa32r6 1011 + #else 1012 + #if defined(__mips64) 1013 + CPU=mips64 1014 + #else 1015 + CPU=mips 1016 + #endif 1017 + #endif 1018 + #endif 1019 + 1020 + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) 1021 + MIPS_ENDIAN=el 1022 + #else 1023 + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) 1024 + MIPS_ENDIAN= 1025 + #else 1026 + MIPS_ENDIAN= 1027 + #endif 1028 + #endif 1029 +EOF 1030 + eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`" 1031 + test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } 1032 + ;; 1033 + mips64el:Linux:*:*) 1034 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 1035 + exit ;; 1036 + openrisc*:Linux:*:*) 1037 + echo or1k-unknown-linux-"$LIBC" 1038 + exit ;; 1039 + or32:Linux:*:* | or1k*:Linux:*:*) 1040 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 1041 + exit ;; 1042 + padre:Linux:*:*) 1043 + echo sparc-unknown-linux-"$LIBC" 1044 + exit ;; 1045 + parisc64:Linux:*:* | hppa64:Linux:*:*) 1046 + echo hppa64-unknown-linux-"$LIBC" 944 1047 exit ;; 945 1048 parisc:Linux:*:* | hppa:Linux:*:*) 946 1049 # Look for CPU level 947 1050 case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in 948 - PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; 949 - PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; 950 - *) echo hppa-unknown-linux-${LIBC} ;; 1051 + PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; 1052 + PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; 1053 + *) echo hppa-unknown-linux-"$LIBC" ;; 951 1054 esac 952 1055 exit ;; 953 - parisc64:Linux:*:* | hppa64:Linux:*:*) 954 - echo hppa64-unknown-linux-${LIBC} 1056 + ppc64:Linux:*:*) 1057 + echo powerpc64-unknown-linux-"$LIBC" 1058 + exit ;; 1059 + ppc:Linux:*:*) 1060 + echo powerpc-unknown-linux-"$LIBC" 1061 + exit ;; 1062 + ppc64le:Linux:*:*) 1063 + echo powerpc64le-unknown-linux-"$LIBC" 1064 + exit ;; 1065 + ppcle:Linux:*:*) 1066 + echo powerpcle-unknown-linux-"$LIBC" 1067 + exit ;; 1068 + riscv32:Linux:*:* | riscv64:Linux:*:*) 1069 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 955 1070 exit ;; 956 1071 s390:Linux:*:* | s390x:Linux:*:*) 957 - echo ${UNAME_MACHINE}-ibm-linux 1072 + echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" 958 1073 exit ;; 959 1074 sh64*:Linux:*:*) 960 - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 1075 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 961 1076 exit ;; 962 1077 sh*:Linux:*:*) 963 - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 1078 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 964 1079 exit ;; 965 1080 sparc:Linux:*:* | sparc64:Linux:*:*) 966 - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 1081 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 1082 + exit ;; 1083 + tile*:Linux:*:*) 1084 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 967 1085 exit ;; 968 1086 vax:Linux:*:*) 969 - echo ${UNAME_MACHINE}-dec-linux-${LIBC} 1087 + echo "$UNAME_MACHINE"-dec-linux-"$LIBC" 970 1088 exit ;; 971 1089 x86_64:Linux:*:*) 972 - echo x86_64-unknown-linux-${LIBC} 1090 + echo "$UNAME_MACHINE"-pc-linux-"$LIBC" 973 1091 exit ;; 974 - xtensa:Linux:*:*) 975 - echo xtensa-unknown-linux-${LIBC} 1092 + xtensa*:Linux:*:*) 1093 + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 976 1094 exit ;; 977 - i*86:Linux:*:*) 978 - # The BFD linker knows what the default object file format is, so 979 - # first see if it will tell us. cd to the root directory to prevent 980 - # problems with other programs or directories called `ld' in the path. 981 - # Set LC_ALL=C to ensure ld outputs messages in English. 982 - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ 983 - | sed -ne '/supported targets:/!d 984 - s/[ ][ ]*/ /g 985 - s/.*supported targets: *// 986 - s/ .*// 987 - p'` 988 - case "$ld_supported_targets" in 989 - elf32-i386) 990 - TENTATIVE="${UNAME_MACHINE}-pc-linux-${LIBC}" 991 - ;; 992 - a.out-i386-linux) 993 - echo "${UNAME_MACHINE}-pc-linux-${LIBC}aout" 994 - exit ;; 995 - coff-i386) 996 - echo "${UNAME_MACHINE}-pc-linux-${LIBC}coff" 997 - exit ;; 998 - "") 999 - # Either a pre-BFD a.out linker (linux-gnuoldld) or 1000 - # one that does not give us useful --help. 1001 - echo "${UNAME_MACHINE}-pc-linux-${LIBC}oldld" 1002 - exit ;; 1003 - esac 1004 - # This should get integrated into the C code below, but now we hack 1005 - if [ "$LIBC" != "gnu" ] ; then echo "$TENTATIVE" && exit 0 ; fi 1006 - # Determine whether the default compiler is a.out or elf 1007 - eval $set_cc_for_build 1008 - sed 's/^ //' << EOF >$dummy.c 1009 - #include <features.h> 1010 - #ifdef __ELF__ 1011 - # ifdef __GLIBC__ 1012 - # if __GLIBC__ >= 2 1013 - LIBC=gnu 1014 - # else 1015 - LIBC=gnulibc1 1016 - # endif 1017 - # else 1018 - LIBC=gnulibc1 1019 - # endif 1020 - #else 1021 - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) 1022 - LIBC=gnu 1023 - #else 1024 - LIBC=gnuaout 1025 - #endif 1026 - #endif 1027 - #ifdef __dietlibc__ 1028 - LIBC=dietlibc 1029 - #endif 1030 -EOF 1031 - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' 1032 - /^LIBC/{ 1033 - s: ::g 1034 - p 1035 - }'`" 1036 - test x"${LIBC}" != x && { 1037 - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" 1038 - exit 1039 - } 1040 - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } 1041 - ;; 1042 1095 i*86:DYNIX/ptx:4*:*) 1043 1096 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. 1044 1097 # earlier versions are messed up and put the nodename in both 1045 1098 # sysname and nodename. 1046 1099 echo i386-sequent-sysv4 1047 1100 exit ;; 1048 1101 i*86:UNIX_SV:4.2MP:2.*) 1049 1102 # Unixware is an offshoot of SVR4, but it has its own version 1050 1103 # number series starting with 2... 1051 1104 # I am not positive that other SVR4 systems won't match this, 1052 1105 # I just have to hope. -- rms. 1053 1106 # Use sysv4.2uw... so that sysv4* matches it. 1054 - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} 1107 + echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" 1055 1108 exit ;; 1056 1109 i*86:OS/2:*:*) 1057 1110 # If we were able to find `uname', then EMX Unix compatibility 1058 1111 # is probably installed. 1059 - echo ${UNAME_MACHINE}-pc-os2-emx 1112 + echo "$UNAME_MACHINE"-pc-os2-emx 1060 1113 exit ;; 1061 1114 i*86:XTS-300:*:STOP) 1062 - echo ${UNAME_MACHINE}-unknown-stop 1115 + echo "$UNAME_MACHINE"-unknown-stop 1063 1116 exit ;; 1064 1117 i*86:atheos:*:*) 1065 - echo ${UNAME_MACHINE}-unknown-atheos 1118 + echo "$UNAME_MACHINE"-unknown-atheos 1066 1119 exit ;; 1067 1120 i*86:syllable:*:*) 1068 - echo ${UNAME_MACHINE}-pc-syllable 1121 + echo "$UNAME_MACHINE"-pc-syllable 1069 1122 exit ;; 1070 - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) 1071 - echo i386-unknown-lynxos${UNAME_RELEASE} 1123 + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) 1124 + echo i386-unknown-lynxos"$UNAME_RELEASE" 1072 1125 exit ;; 1073 1126 i*86:*DOS:*:*) 1074 - echo ${UNAME_MACHINE}-pc-msdosdjgpp 1127 + echo "$UNAME_MACHINE"-pc-msdosdjgpp 1075 1128 exit ;; 1076 - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) 1077 - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` 1129 + i*86:*:4.*:*) 1130 + UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` 1078 1131 if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then 1079 - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} 1132 + echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" 1080 1133 else 1081 - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} 1134 + echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" 1082 1135 fi 1083 1136 exit ;; 1084 1137 i*86:*:5:[678]*) 1085 1138 # UnixWare 7.x, OpenUNIX and OpenServer 6. 1086 1139 case `/bin/uname -X | grep "^Machine"` in 1087 1140 *486*) UNAME_MACHINE=i486 ;; 1088 1141 *Pentium) UNAME_MACHINE=i586 ;; 1089 1142 *Pent*|*Celeron) UNAME_MACHINE=i686 ;; 1090 1143 esac 1091 - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} 1144 + echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}" 1092 1145 exit ;; 1093 1146 i*86:*:3.2:*) 1094 1147 if test -f /usr/options/cb.name; then 1095 1148 UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` 1096 - echo ${UNAME_MACHINE}-pc-isc$UNAME_REL 1149 + echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL" 1097 1150 elif /bin/uname -X 2>/dev/null >/dev/null ; then 1098 1151 UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` 1099 1152 (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 1100 1153 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ 1101 1154 && UNAME_MACHINE=i586 1102 1155 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ 1103 1156 && UNAME_MACHINE=i686 1104 1157 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ 1105 1158 && UNAME_MACHINE=i686 1106 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL 1159 + echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" 1107 1160 else 1108 - echo ${UNAME_MACHINE}-pc-sysv32 1161 + echo "$UNAME_MACHINE"-pc-sysv32 1109 1162 fi 1110 1163 exit ;; 1111 1164 pc:*:*:*) 1112 1165 # Left here for compatibility: 1113 1166 # uname -m prints for DJGPP always 'pc', but it prints nothing about 1114 - # the processor, so we play safe by assuming i386. 1115 - echo i386-pc-msdosdjgpp 1167 + # the processor, so we play safe by assuming i586. 1168 + # Note: whatever this is, it MUST be the same as what config.sub 1169 + # prints for the "djgpp" host, or else GDB configure will decide that 1170 + # this is a cross-build. 1171 + echo i586-pc-msdosdjgpp 1116 1172 exit ;; 1117 1173 Intel:Mach:3*:*) 1118 1174 echo i386-pc-mach3 1119 1175 exit ;; 1120 1176 paragon:*:*:*) 1121 1177 echo i860-intel-osf1 1122 1178 exit ;; 1123 1179 i860:*:4.*:*) # i860-SVR4 1124 1180 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then 1125 - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 1181 + echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 1126 1182 else # Add other i860-SVR4 vendors below as they are discovered. 1127 - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 1183 + echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 1128 1184 fi 1129 1185 exit ;; 1130 1186 mini*:CTIX:SYS*5:*) 1131 1187 # "miniframe" 1132 1188 echo m68010-convergent-sysv 1133 1189 exit ;; 1134 1190 mc68k:UNIX:SYSTEM5:3.51m) ................................................................................ 1140 1196 M68*:*:R3V[5678]*:*) 1141 1197 test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 1142 1198 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) 1143 1199 OS_REL='' 1144 1200 test -r /etc/.relid \ 1145 1201 && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` 1146 1202 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ 1147 - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } 1203 + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } 1148 1204 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ 1149 - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 1205 + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 1150 1206 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) 1151 1207 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ 1152 1208 && { echo i486-ncr-sysv4; exit; } ;; 1209 + NCR*:*:4.2:* | MPRAS*:*:4.2:*) 1210 + OS_REL='.3' 1211 + test -r /etc/.relid \ 1212 + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` 1213 + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ 1214 + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } 1215 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ 1216 + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } 1217 + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ 1218 + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 1153 1219 m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) 1154 - echo m68k-unknown-lynxos${UNAME_RELEASE} 1220 + echo m68k-unknown-lynxos"$UNAME_RELEASE" 1155 1221 exit ;; 1156 1222 mc68030:UNIX_System_V:4.*:*) 1157 1223 echo m68k-atari-sysv4 1158 1224 exit ;; 1159 1225 TSUNAMI:LynxOS:2.*:*) 1160 - echo sparc-unknown-lynxos${UNAME_RELEASE} 1226 + echo sparc-unknown-lynxos"$UNAME_RELEASE" 1161 1227 exit ;; 1162 1228 rs6000:LynxOS:2.*:*) 1163 - echo rs6000-unknown-lynxos${UNAME_RELEASE} 1229 + echo rs6000-unknown-lynxos"$UNAME_RELEASE" 1164 1230 exit ;; 1165 - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) 1166 - echo powerpc-unknown-lynxos${UNAME_RELEASE} 1231 + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) 1232 + echo powerpc-unknown-lynxos"$UNAME_RELEASE" 1167 1233 exit ;; 1168 1234 SM[BE]S:UNIX_SV:*:*) 1169 - echo mips-dde-sysv${UNAME_RELEASE} 1235 + echo mips-dde-sysv"$UNAME_RELEASE" 1170 1236 exit ;; 1171 1237 RM*:ReliantUNIX-*:*:*) 1172 1238 echo mips-sni-sysv4 1173 1239 exit ;; 1174 1240 RM*:SINIX-*:*:*) 1175 1241 echo mips-sni-sysv4 1176 1242 exit ;; 1177 1243 *:SINIX-*:*:*) 1178 1244 if uname -p 2>/dev/null >/dev/null ; then 1179 1245 UNAME_MACHINE=`(uname -p) 2>/dev/null` 1180 - echo ${UNAME_MACHINE}-sni-sysv4 1246 + echo "$UNAME_MACHINE"-sni-sysv4 1181 1247 else 1182 1248 echo ns32k-sni-sysv 1183 1249 fi 1184 1250 exit ;; 1185 1251 PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort 1186 1252 # says <Richard.M.Bartel@ccMail.Census.GOV> 1187 1253 echo i586-unisys-sysv4 ................................................................................ 1193 1259 exit ;; 1194 1260 *:*:*:FTX*) 1195 1261 # From seanf@swdc.stratus.com. 1196 1262 echo i860-stratus-sysv4 1197 1263 exit ;; 1198 1264 i*86:VOS:*:*) 1199 1265 # From Paul.Green@stratus.com. 1200 - echo ${UNAME_MACHINE}-stratus-vos 1266 + echo "$UNAME_MACHINE"-stratus-vos 1201 1267 exit ;; 1202 1268 *:VOS:*:*) 1203 1269 # From Paul.Green@stratus.com. 1204 1270 echo hppa1.1-stratus-vos 1205 1271 exit ;; 1206 1272 mc68*:A/UX:*:*) 1207 - echo m68k-apple-aux${UNAME_RELEASE} 1273 + echo m68k-apple-aux"$UNAME_RELEASE" 1208 1274 exit ;; 1209 1275 news*:NEWS-OS:6*:*) 1210 1276 echo mips-sony-newsos6 1211 1277 exit ;; 1212 1278 R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) 1213 1279 if [ -d /usr/nec ]; then 1214 - echo mips-nec-sysv${UNAME_RELEASE} 1280 + echo mips-nec-sysv"$UNAME_RELEASE" 1215 1281 else 1216 - echo mips-unknown-sysv${UNAME_RELEASE} 1282 + echo mips-unknown-sysv"$UNAME_RELEASE" 1217 1283 fi 1218 1284 exit ;; 1219 1285 BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. 1220 1286 echo powerpc-be-beos 1221 1287 exit ;; 1222 1288 BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. 1223 1289 echo powerpc-apple-beos 1224 1290 exit ;; 1225 1291 BePC:BeOS:*:*) # BeOS running on Intel PC compatible. 1226 1292 echo i586-pc-beos 1227 1293 exit ;; 1294 + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. 1295 + echo i586-pc-haiku 1296 + exit ;; 1297 + x86_64:Haiku:*:*) 1298 + echo x86_64-unknown-haiku 1299 + exit ;; 1228 1300 SX-4:SUPER-UX:*:*) 1229 - echo sx4-nec-superux${UNAME_RELEASE} 1301 + echo sx4-nec-superux"$UNAME_RELEASE" 1230 1302 exit ;; 1231 1303 SX-5:SUPER-UX:*:*) 1232 - echo sx5-nec-superux${UNAME_RELEASE} 1304 + echo sx5-nec-superux"$UNAME_RELEASE" 1233 1305 exit ;; 1234 1306 SX-6:SUPER-UX:*:*) 1235 - echo sx6-nec-superux${UNAME_RELEASE} 1307 + echo sx6-nec-superux"$UNAME_RELEASE" 1236 1308 exit ;; 1237 1309 SX-7:SUPER-UX:*:*) 1238 - echo sx7-nec-superux${UNAME_RELEASE} 1310 + echo sx7-nec-superux"$UNAME_RELEASE" 1239 1311 exit ;; 1240 1312 SX-8:SUPER-UX:*:*) 1241 - echo sx8-nec-superux${UNAME_RELEASE} 1313 + echo sx8-nec-superux"$UNAME_RELEASE" 1242 1314 exit ;; 1243 1315 SX-8R:SUPER-UX:*:*) 1244 - echo sx8r-nec-superux${UNAME_RELEASE} 1316 + echo sx8r-nec-superux"$UNAME_RELEASE" 1317 + exit ;; 1318 + SX-ACE:SUPER-UX:*:*) 1319 + echo sxace-nec-superux"$UNAME_RELEASE" 1245 1320 exit ;; 1246 1321 Power*:Rhapsody:*:*) 1247 - echo powerpc-apple-rhapsody${UNAME_RELEASE} 1322 + echo powerpc-apple-rhapsody"$UNAME_RELEASE" 1248 1323 exit ;; 1249 1324 *:Rhapsody:*:*) 1250 - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} 1325 + echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" 1251 1326 exit ;; 1252 1327 *:Darwin:*:*) 1253 - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown 1328 + UNAME_PROCESSOR=`uname -p` 1254 1329 case $UNAME_PROCESSOR in 1255 1330 unknown) UNAME_PROCESSOR=powerpc ;; 1256 1331 esac 1257 - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} 1332 + if command -v xcode-select > /dev/null 2> /dev/null && \ 1333 + ! xcode-select --print-path > /dev/null 2> /dev/null ; then 1334 + # Avoid executing cc if there is no toolchain installed as 1335 + # cc will be a stub that puts up a graphical alert 1336 + # prompting the user to install developer tools. 1337 + CC_FOR_BUILD=no_compiler_found 1338 + else 1339 + set_cc_for_build 1340 + fi 1341 + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then 1342 + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ 1343 + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ 1344 + grep IS_64BIT_ARCH >/dev/null 1345 + then 1346 + case $UNAME_PROCESSOR in 1347 + i386) UNAME_PROCESSOR=x86_64 ;; 1348 + powerpc) UNAME_PROCESSOR=powerpc64 ;; 1349 + esac 1350 + fi 1351 + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc 1352 + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ 1353 + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ 1354 + grep IS_PPC >/dev/null 1355 + then 1356 + UNAME_PROCESSOR=powerpc 1357 + fi 1358 + elif test "$UNAME_PROCESSOR" = i386 ; then 1359 + # uname -m returns i386 or x86_64 1360 + UNAME_PROCESSOR=$UNAME_MACHINE 1361 + fi 1362 + echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" 1258 1363 exit ;; 1259 1364 *:procnto*:*:* | *:QNX:[0123456789]*:*) 1260 1365 UNAME_PROCESSOR=`uname -p` 1261 - if test "$UNAME_PROCESSOR" = "x86"; then 1366 + if test "$UNAME_PROCESSOR" = x86; then 1262 1367 UNAME_PROCESSOR=i386 1263 1368 UNAME_MACHINE=pc 1264 1369 fi 1265 - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} 1370 + echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" 1266 1371 exit ;; 1267 1372 *:QNX:*:4*) 1268 1373 echo i386-pc-qnx 1269 1374 exit ;; 1270 - NSE-?:NONSTOP_KERNEL:*:*) 1271 - echo nse-tandem-nsk${UNAME_RELEASE} 1375 + NEO-*:NONSTOP_KERNEL:*:*) 1376 + echo neo-tandem-nsk"$UNAME_RELEASE" 1272 1377 exit ;; 1273 - NSR-?:NONSTOP_KERNEL:*:*) 1274 - echo nsr-tandem-nsk${UNAME_RELEASE} 1378 + NSE-*:NONSTOP_KERNEL:*:*) 1379 + echo nse-tandem-nsk"$UNAME_RELEASE" 1380 + exit ;; 1381 + NSR-*:NONSTOP_KERNEL:*:*) 1382 + echo nsr-tandem-nsk"$UNAME_RELEASE" 1383 + exit ;; 1384 + NSV-*:NONSTOP_KERNEL:*:*) 1385 + echo nsv-tandem-nsk"$UNAME_RELEASE" 1386 + exit ;; 1387 + NSX-*:NONSTOP_KERNEL:*:*) 1388 + echo nsx-tandem-nsk"$UNAME_RELEASE" 1275 1389 exit ;; 1276 1390 *:NonStop-UX:*:*) 1277 1391 echo mips-compaq-nonstopux 1278 1392 exit ;; 1279 1393 BS2000:POSIX*:*:*) 1280 1394 echo bs2000-siemens-sysv 1281 1395 exit ;; 1282 1396 DS/*:UNIX_System_V:*:*) 1283 - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} 1397 + echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" 1284 1398 exit ;; 1285 1399 *:Plan9:*:*) 1286 1400 # "uname -m" is not consistent, so use $cputype instead. 386 1287 1401 # is converted to i386 for consistency with other x86 1288 1402 # operating systems. 1289 - if test "$cputype" = "386"; then 1403 + # shellcheck disable=SC2154 1404 + if test "$cputype" = 386; then 1290 1405 UNAME_MACHINE=i386 1291 1406 else 1292 1407 UNAME_MACHINE="$cputype" 1293 1408 fi 1294 - echo ${UNAME_MACHINE}-unknown-plan9 1409 + echo "$UNAME_MACHINE"-unknown-plan9 1295 1410 exit ;; 1296 1411 *:TOPS-10:*:*) 1297 1412 echo pdp10-unknown-tops10 1298 1413 exit ;; 1299 1414 *:TENEX:*:*) 1300 1415 echo pdp10-unknown-tenex 1301 1416 exit ;; ................................................................................ 1308 1423 *:TOPS-20:*:*) 1309 1424 echo pdp10-unknown-tops20 1310 1425 exit ;; 1311 1426 *:ITS:*:*) 1312 1427 echo pdp10-unknown-its 1313 1428 exit ;; 1314 1429 SEI:*:*:SEIUX) 1315 - echo mips-sei-seiux${UNAME_RELEASE} 1430 + echo mips-sei-seiux"$UNAME_RELEASE" 1316 1431 exit ;; 1317 1432 *:DragonFly:*:*) 1318 - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` 1433 + echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" 1319 1434 exit ;; 1320 1435 *:*VMS:*:*) 1321 1436 UNAME_MACHINE=`(uname -p) 2>/dev/null` 1322 - case "${UNAME_MACHINE}" in 1437 + case "$UNAME_MACHINE" in 1323 1438 A*) echo alpha-dec-vms ; exit ;; 1324 1439 I*) echo ia64-dec-vms ; exit ;; 1325 1440 V*) echo vax-dec-vms ; exit ;; 1326 1441 esac ;; 1327 1442 *:XENIX:*:SysV) 1328 1443 echo i386-pc-xenix 1329 1444 exit ;; 1330 1445 i*86:skyos:*:*) 1331 - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' 1446 + echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" 1332 1447 exit ;; 1333 1448 i*86:rdos:*:*) 1334 - echo ${UNAME_MACHINE}-pc-rdos 1449 + echo "$UNAME_MACHINE"-pc-rdos 1450 + exit ;; 1451 + i*86:AROS:*:*) 1452 + echo "$UNAME_MACHINE"-pc-aros 1453 + exit ;; 1454 + x86_64:VMkernel:*:*) 1455 + echo "$UNAME_MACHINE"-unknown-esx 1456 + exit ;; 1457 + amd64:Isilon\ OneFS:*:*) 1458 + echo x86_64-unknown-onefs 1459 + exit ;; 1460 + *:Unleashed:*:*) 1461 + echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE" 1335 1462 exit ;; 1336 1463 esac 1337 1464 1338 -#echo '(No uname command or uname output not recognized.)' 1>&2 1339 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 1340 - 1341 -eval $set_cc_for_build 1342 -cat >$dummy.c <<EOF 1465 +# No uname command or uname output not recognized. 1466 +set_cc_for_build 1467 +cat > "$dummy.c" <<EOF 1343 1468 #ifdef _SEQUENT_ 1344 1469 # include <sys/types.h> 1345 1470 # include <sys/utsname.h> 1471 +#endif 1472 +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) 1473 +#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) 1474 +#include <signal.h> 1475 +#if defined(_SIZE_T_) || defined(SIGLOST) 1476 +#include <sys/utsname.h> 1477 +#endif 1478 +#endif 1346 1479 #endif 1347 1480 main () 1348 1481 { 1349 1482 #if defined (sony) 1350 1483 #if defined (MIPSEB) 1351 1484 /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, 1352 1485 I don't know.... */ ................................................................................ 1359 1492 #else 1360 1493 "" 1361 1494 #endif 1362 1495 ); exit (0); 1363 1496 #endif 1364 1497 #endif 1365 1498 1366 -#if defined (__arm) && defined (__acorn) && defined (__unix) 1367 - printf ("arm-acorn-riscix\n"); exit (0); 1368 -#endif 1369 - 1370 -#if defined (hp300) && !defined (hpux) 1371 - printf ("m68k-hp-bsd\n"); exit (0); 1372 -#endif 1373 - 1374 1499 #if defined (NeXT) 1375 1500 #if !defined (__ARCHITECTURE__) 1376 1501 #define __ARCHITECTURE__ "m68k" 1377 1502 #endif 1378 1503 int version; 1379 1504 version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; 1380 1505 if (version < 4) ................................................................................ 1409 1534 #endif 1410 1535 #endif 1411 1536 1412 1537 #if defined (_SEQUENT_) 1413 1538 struct utsname un; 1414 1539 1415 1540 uname(&un); 1416 - 1417 1541 if (strncmp(un.version, "V2", 2) == 0) { 1418 1542 printf ("i386-sequent-ptx2\n"); exit (0); 1419 1543 } 1420 1544 if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ 1421 1545 printf ("i386-sequent-ptx1\n"); exit (0); 1422 1546 } 1423 1547 printf ("i386-sequent-ptx\n"); exit (0); 1424 - 1425 1548 #endif 1426 1549 1427 1550 #if defined (vax) 1428 1551 # if !defined (ultrix) 1429 1552 # include <sys/param.h> 1430 1553 # if defined (BSD) 1431 1554 # if BSD == 43 ................................................................................ 1437 1560 printf ("vax-dec-bsd\n"); exit (0); 1438 1561 # endif 1439 1562 # endif 1440 1563 # else 1441 1564 printf ("vax-dec-bsd\n"); exit (0); 1442 1565 # endif 1443 1566 # else 1567 +#if defined(_SIZE_T_) || defined(SIGLOST) 1568 + struct utsname un; 1569 + uname (&un); 1570 + printf ("vax-dec-ultrix%s\n", un.release); exit (0); 1571 +#else 1444 1572 printf ("vax-dec-ultrix\n"); exit (0); 1573 +#endif 1574 +#endif 1575 +#endif 1576 +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) 1577 +#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) 1578 +#if defined(_SIZE_T_) || defined(SIGLOST) 1579 + struct utsname *un; 1580 + uname (&un); 1581 + printf ("mips-dec-ultrix%s\n", un.release); exit (0); 1582 +#else 1583 + printf ("mips-dec-ultrix\n"); exit (0); 1584 +#endif 1445 1585 # endif 1446 1586 #endif 1447 1587 1448 1588 #if defined (alliant) && defined (i860) 1449 1589 printf ("i860-alliant-bsd\n"); exit (0); 1450 1590 #endif 1451 1591 1452 1592 exit (1); 1453 1593 } 1454 1594 EOF 1455 1595 1456 -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && 1596 +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`$dummy` && 1457 1597 { echo "$SYSTEM_NAME"; exit; } 1458 1598 1459 1599 # Apollos put the system type in the environment. 1600 +test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } 1460 1601 1461 -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } 1602 +echo "$0: unable to guess system type" >&2 1462 1603 1463 -# Convex versions that predate uname can use getsysinfo(1) 1604 +case "$UNAME_MACHINE:$UNAME_SYSTEM" in 1605 + mips:Linux | mips64:Linux) 1606 + # If we got here on MIPS GNU/Linux, output extra information. 1607 + cat >&2 <<EOF 1464 1608 1465 -if [ -x /usr/convex/getsysinfo ] 1466 -then 1467 - case `getsysinfo -f cpu_type` in 1468 - c1*) 1469 - echo c1-convex-bsd 1470 - exit ;; 1471 - c2*) 1472 - if getsysinfo -f scalar_acc 1473 - then echo c32-convex-bsd 1474 - else echo c2-convex-bsd 1475 - fi 1476 - exit ;; 1477 - c34*) 1478 - echo c34-convex-bsd 1479 - exit ;; 1480 - c38*) 1481 - echo c38-convex-bsd 1482 - exit ;; 1483 - c4*) 1484 - echo c4-convex-bsd 1485 - exit ;; 1609 +NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize 1610 +the system type. Please install a C compiler and try again. 1611 +EOF 1612 + ;; 1486 1613 esac 1487 -fi 1488 1614 1489 1615 cat >&2 <<EOF 1490 -$0: unable to guess system type 1491 1616 1492 -This script, last modified $timestamp, has failed to recognize 1493 -the operating system you are using. It is advised that you 1494 -download the most up to date version of the config scripts from 1617 +This script (version $timestamp), has failed to recognize the 1618 +operating system you are using. If your script is old, overwrite *all* 1619 +copies of config.guess and config.sub with the latest versions from: 1495 1620 1496 - http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess 1621 + https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess 1497 1622 and 1498 - http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub 1623 + https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub 1499 1624 1500 -If the version you run ($0) is already up to date, please 1501 -send the following data and any information you think might be 1502 -pertinent to <config-patches@gnu.org> in order to provide the needed 1503 -information to handle your system. 1625 +If $0 has already been updated, send the following data and any 1626 +information you think might be pertinent to config-patches@gnu.org to 1627 +provide the necessary information to handle your system. 1504 1628 1505 1629 config.guess timestamp = $timestamp 1506 1630 1507 1631 uname -m = `(uname -m) 2>/dev/null || echo unknown` 1508 1632 uname -r = `(uname -r) 2>/dev/null || echo unknown` 1509 1633 uname -s = `(uname -s) 2>/dev/null || echo unknown` 1510 1634 uname -v = `(uname -v) 2>/dev/null || echo unknown` ................................................................................ 1515 1639 hostinfo = `(hostinfo) 2>/dev/null` 1516 1640 /bin/universe = `(/bin/universe) 2>/dev/null` 1517 1641 /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` 1518 1642 /bin/arch = `(/bin/arch) 2>/dev/null` 1519 1643 /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` 1520 1644 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` 1521 1645 1522 -UNAME_MACHINE = ${UNAME_MACHINE} 1523 -UNAME_RELEASE = ${UNAME_RELEASE} 1524 -UNAME_SYSTEM = ${UNAME_SYSTEM} 1525 -UNAME_VERSION = ${UNAME_VERSION} 1646 +UNAME_MACHINE = "$UNAME_MACHINE" 1647 +UNAME_RELEASE = "$UNAME_RELEASE" 1648 +UNAME_SYSTEM = "$UNAME_SYSTEM" 1649 +UNAME_VERSION = "$UNAME_VERSION" 1526 1650 EOF 1527 1651 1528 1652 exit 1 1529 1653 1530 1654 # Local variables: 1531 -# eval: (add-hook 'write-file-hooks 'time-stamp) 1655 +# eval: (add-hook 'before-save-hook 'time-stamp) 1532 1656 # time-stamp-start: "timestamp='" 1533 1657 # time-stamp-format: "%:y-%02m-%02d" 1534 1658 # time-stamp-end: "'" 1535 1659 # End:
Changes to config.sub.
1 1 #! /bin/sh 2 2 # Configuration validation subroutine script. 3 -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 4 -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, 5 -# Inc. 3 +# Copyright 1992-2019 Free Software Foundation, Inc. 6 4 7 -timestamp='2007-06-28' 5 +timestamp='2019-05-23' 8 6 9 -# This file is (in principle) common to ALL GNU software. 10 -# The presence of a machine in this file suggests that SOME GNU software 11 -# can handle that machine. It does not imply ALL GNU software can. 12 -# 13 -# This file is free software; you can redistribute it and/or modify 14 -# it under the terms of the GNU General Public License as published by 15 -# the Free Software Foundation; either version 2 of the License, or 7 +# This file is free software; you can redistribute it and/or modify it 8 +# under the terms of the GNU General Public License as published by 9 +# the Free Software Foundation; either version 3 of the License, or 16 10 # (at your option) any later version. 17 11 # 18 -# This program is distributed in the hope that it will be useful, 19 -# but WITHOUT ANY WARRANTY; without even the implied warranty of 20 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 -# GNU General Public License for more details. 12 +# This program is distributed in the hope that it will be useful, but 13 +# WITHOUT ANY WARRANTY; without even the implied warranty of 14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 +# General Public License for more details. 22 16 # 23 17 # You should have received a copy of the GNU General Public License 24 -# along with this program; if not, write to the Free Software 25 -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 26 -# 02110-1301, USA. 18 +# along with this program; if not, see <https://www.gnu.org/licenses/>. 27 19 # 28 20 # As a special exception to the GNU General Public License, if you 29 21 # distribute this file as part of a program that contains a 30 22 # configuration script generated by Autoconf, you may include it under 31 -# the same distribution terms that you use for the rest of that program. 23 +# the same distribution terms that you use for the rest of that 24 +# program. This Exception is an additional permission under section 7 25 +# of the GNU General Public License, version 3 ("GPLv3"). 32 26 33 27 34 -# Please send patches to <config-patches@gnu.org>. Submit a context 35 -# diff and a properly formatted ChangeLog entry. 28 +# Please send patches to <config-patches@gnu.org>. 36 29 # 37 30 # Configuration subroutine to validate and canonicalize a configuration type. 38 31 # Supply the specified configuration type as an argument. 39 32 # If it is invalid, we print an error message on stderr and exit with code 1. 40 33 # Otherwise, we print the canonical config type on stdout and succeed. 41 34 35 +# You can get the latest version of this script from: 36 +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub 37 + 42 38 # This file is supposed to be the same for all GNU packages 43 39 # and recognize all the CPU types, system types and aliases 44 40 # that are meaningful with *any* GNU software. 45 41 # Each package is responsible for reporting which valid configurations 46 42 # it does not support. The user should be able to distinguish 47 43 # a failure to support a valid configuration from a meaningless 48 44 # configuration. ................................................................................ 53 49 # or in some cases, the newer four-part form: 54 50 # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM 55 51 # It is wrong to echo any other type of specification. 56 52 57 53 me=`echo "$0" | sed -e 's,.*/,,'` 58 54 59 55 usage="\ 60 -Usage: $0 [OPTION] CPU-MFR-OPSYS 61 - $0 [OPTION] ALIAS 56 +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS 62 57 63 58 Canonicalize a configuration name. 64 59 65 -Operation modes: 60 +Options: 66 61 -h, --help print this help, then exit 67 62 -t, --time-stamp print date of last modification, then exit 68 63 -v, --version print version number, then exit 69 64 70 65 Report bugs and patches to <config-patches@gnu.org>." 71 66 72 67 version="\ 73 68 GNU config.sub ($timestamp) 74 69 75 -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 76 -Free Software Foundation, Inc. 70 +Copyright 1992-2019 Free Software Foundation, Inc. 77 71 78 72 This is free software; see the source for copying conditions. There is NO 79 73 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 80 74 81 75 help=" 82 76 Try \`$me --help' for more information." 83 77 ................................................................................ 91 85 --help | --h* | -h ) 92 86 echo "$usage"; exit ;; 93 87 -- ) # Stop option processing 94 88 shift; break ;; 95 89 - ) # Use stdin as input. 96 90 break ;; 97 91 -* ) 98 - echo "$me: invalid option $1$help" 92 + echo "$me: invalid option $1$help" >&2 99 93 exit 1 ;; 100 94 101 95 *local*) 102 96 # First pass through any local machine types. 103 - echo $1 97 + echo "$1" 104 98 exit ;; 105 99 106 100 * ) 107 101 break ;; 108 102 esac 109 103 done 110 104 ................................................................................ 112 106 0) echo "$me: missing argument$help" >&2 113 107 exit 1;; 114 108 1) ;; 115 109 *) echo "$me: too many arguments$help" >&2 116 110 exit 1;; 117 111 esac 118 112 119 -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). 120 -# Here we must recognize all the valid KERNEL-OS combinations. 121 -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` 113 +# Split fields of configuration type 114 +# shellcheck disable=SC2162 115 +IFS="-" read field1 field2 field3 field4 <<EOF 116 +$1 117 +EOF 118 + 119 +# Separate into logical components for further validation 120 +case $1 in 121 + *-*-*-*-*) 122 + echo Invalid configuration \`"$1"\': more than four components >&2 123 + exit 1 124 + ;; 125 + *-*-*-*) 126 + basic_machine=$field1-$field2 127 + os=$field3-$field4 128 + ;; 129 + *-*-*) 130 + # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two 131 + # parts 132 + maybe_os=$field2-$field3 122 133 case $maybe_os in 123 - nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ 124 - uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ 125 - storm-chaos* | os2-emx* | rtmk-nova*) 126 - os=-$maybe_os 127 - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` 134 + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \ 135 + | linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \ 136 + | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ 137 + | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ 138 + | storm-chaos* | os2-emx* | rtmk-nova*) 139 + basic_machine=$field1 140 + os=$maybe_os 141 + ;; 142 + android-linux) 143 + basic_machine=$field1-unknown 144 + os=linux-android 145 + ;; 146 + *) 147 + basic_machine=$field1-$field2 148 + os=$field3 149 + ;; 150 + esac 151 + ;; 152 + *-*) 153 + # A lone config we happen to match not fitting any pattern 154 + case $field1-$field2 in 155 + decstation-3100) 156 + basic_machine=mips-dec 157 + os= 158 + ;; 159 + *-*) 160 + # Second component is usually, but not always the OS 161 + case $field2 in 162 + # Prevent following clause from handling this valid os 163 + sun*os*) 164 + basic_machine=$field1 165 + os=$field2 166 + ;; 167 + # Manufacturers 168 + dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ 169 + | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ 170 + | unicom* | ibm* | next | hp | isi* | apollo | altos* \ 171 + | convergent* | ncr* | news | 32* | 3600* | 3100* \ 172 + | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ 173 + | ultra | tti* | harris | dolphin | highlevel | gould \ 174 + | cbm | ns | masscomp | apple | axis | knuth | cray \ 175 + | microblaze* | sim | cisco \ 176 + | oki | wec | wrs | winbond) 177 + basic_machine=$field1-$field2 178 + os= 179 + ;; 180 + *) 181 + basic_machine=$field1 182 + os=$field2 183 + ;; 184 + esac 185 + ;; 186 + esac 187 + ;; 188 + *) 189 + # Convert single-component short-hands not valid as part of 190 + # multi-component configurations. 191 + case $field1 in 192 + 386bsd) 193 + basic_machine=i386-pc 194 + os=bsd 195 + ;; 196 + a29khif) 197 + basic_machine=a29k-amd 198 + os=udi 199 + ;; 200 + adobe68k) 201 + basic_machine=m68010-adobe 202 + os=scout 203 + ;; 204 + alliant) 205 + basic_machine=fx80-alliant 206 + os= 207 + ;; 208 + altos | altos3068) 209 + basic_machine=m68k-altos 210 + os= 211 + ;; 212 + am29k) 213 + basic_machine=a29k-none 214 + os=bsd 215 + ;; 216 + amdahl) 217 + basic_machine=580-amdahl 218 + os=sysv 219 + ;; 220 + amiga) 221 + basic_machine=m68k-unknown 222 + os= 223 + ;; 224 + amigaos | amigados) 225 + basic_machine=m68k-unknown 226 + os=amigaos 227 + ;; 228 + amigaunix | amix) 229 + basic_machine=m68k-unknown 230 + os=sysv4 231 + ;; 232 + apollo68) 233 + basic_machine=m68k-apollo 234 + os=sysv 235 + ;; 236 + apollo68bsd) 237 + basic_machine=m68k-apollo 238 + os=bsd 239 + ;; 240 + aros) 241 + basic_machine=i386-pc 242 + os=aros 243 + ;; 244 + aux) 245 + basic_machine=m68k-apple 246 + os=aux 247 + ;; 248 + balance) 249 + basic_machine=ns32k-sequent 250 + os=dynix 251 + ;; 252 + blackfin) 253 + basic_machine=bfin-unknown 254 + os=linux 255 + ;; 256 + cegcc) 257 + basic_machine=arm-unknown 258 + os=cegcc 259 + ;; 260 + convex-c1) 261 + basic_machine=c1-convex 262 + os=bsd 263 + ;; 264 + convex-c2) 265 + basic_machine=c2-convex 266 + os=bsd 267 + ;; 268 + convex-c32) 269 + basic_machine=c32-convex 270 + os=bsd 271 + ;; 272 + convex-c34) 273 + basic_machine=c34-convex 274 + os=bsd 275 + ;; 276 + convex-c38) 277 + basic_machine=c38-convex 278 + os=bsd 279 + ;; 280 + cray) 281 + basic_machine=j90-cray 282 + os=unicos 283 + ;; 284 + crds | unos) 285 + basic_machine=m68k-crds 286 + os= 287 + ;; 288 + da30) 289 + basic_machine=m68k-da30 290 + os= 291 + ;; 292 + decstation | pmax | pmin | dec3100 | decstatn) 293 + basic_machine=mips-dec 294 + os= 295 + ;; 296 + delta88) 297 + basic_machine=m88k-motorola 298 + os=sysv3 299 + ;; 300 + dicos) 301 + basic_machine=i686-pc 302 + os=dicos 303 + ;; 304 + djgpp) 305 + basic_machine=i586-pc 306 + os=msdosdjgpp 307 + ;; 308 + ebmon29k) 309 + basic_machine=a29k-amd 310 + os=ebmon 311 + ;; 312 + es1800 | OSE68k | ose68k | ose | OSE) 313 + basic_machine=m68k-ericsson 314 + os=ose 315 + ;; 316 + gmicro) 317 + basic_machine=tron-gmicro 318 + os=sysv 319 + ;; 320 + go32) 321 + basic_machine=i386-pc 322 + os=go32 323 + ;; 324 + h8300hms) 325 + basic_machine=h8300-hitachi 326 + os=hms 327 + ;; 328 + h8300xray) 329 + basic_machine=h8300-hitachi 330 + os=xray 331 + ;; 332 + h8500hms) 333 + basic_machine=h8500-hitachi 334 + os=hms 335 + ;; 336 + harris) 337 + basic_machine=m88k-harris 338 + os=sysv3 339 + ;; 340 + hp300) 341 + basic_machine=m68k-hp 342 + ;; 343 + hp300bsd) 344 + basic_machine=m68k-hp 345 + os=bsd 346 + ;; 347 + hp300hpux) 348 + basic_machine=m68k-hp 349 + os=hpux 350 + ;; 351 + hppaosf) 352 + basic_machine=hppa1.1-hp 353 + os=osf 354 + ;; 355 + hppro) 356 + basic_machine=hppa1.1-hp 357 + os=proelf 358 + ;; 359 + i386mach) 360 + basic_machine=i386-mach 361 + os=mach 362 + ;; 363 + vsta) 364 + basic_machine=i386-pc 365 + os=vsta 366 + ;; 367 + isi68 | isi) 368 + basic_machine=m68k-isi 369 + os=sysv 370 + ;; 371 + m68knommu) 372 + basic_machine=m68k-unknown 373 + os=linux 374 + ;; 375 + magnum | m3230) 376 + basic_machine=mips-mips 377 + os=sysv 378 + ;; 379 + merlin) 380 + basic_machine=ns32k-utek 381 + os=sysv 382 + ;; 383 + mingw64) 384 + basic_machine=x86_64-pc 385 + os=mingw64 386 + ;; 387 + mingw32) 388 + basic_machine=i686-pc 389 + os=mingw32 390 + ;; 391 + mingw32ce) 392 + basic_machine=arm-unknown 393 + os=mingw32ce 394 + ;; 395 + monitor) 396 + basic_machine=m68k-rom68k 397 + os=coff 398 + ;; 399 + morphos) 400 + basic_machine=powerpc-unknown 401 + os=morphos 402 + ;; 403 + moxiebox) 404 + basic_machine=moxie-unknown 405 + os=moxiebox 406 + ;; 407 + msdos) 408 + basic_machine=i386-pc 409 + os=msdos 410 + ;; 411 + msys) 412 + basic_machine=i686-pc 413 + os=msys 414 + ;; 415 + mvs) 416 + basic_machine=i370-ibm 417 + os=mvs 418 + ;; 419 + nacl) 420 + basic_machine=le32-unknown 421 + os=nacl 422 + ;; 423 + ncr3000) 424 + basic_machine=i486-ncr 425 + os=sysv4 426 + ;; 427 + netbsd386) 428 + basic_machine=i386-pc 429 + os=netbsd 430 + ;; 431 + netwinder) 432 + basic_machine=armv4l-rebel 433 + os=linux 434 + ;; 435 + news | news700 | news800 | news900) 436 + basic_machine=m68k-sony 437 + os=newsos 438 + ;; 439 + news1000) 440 + basic_machine=m68030-sony 441 + os=newsos 442 + ;; 443 + necv70) 444 + basic_machine=v70-nec 445 + os=sysv 446 + ;; 447 + nh3000) 448 + basic_machine=m68k-harris 449 + os=cxux 450 + ;; 451 + nh[45]000) 452 + basic_machine=m88k-harris 453 + os=cxux 454 + ;; 455 + nindy960) 456 + basic_machine=i960-intel 457 + os=nindy 458 + ;; 459 + mon960) 460 + basic_machine=i960-intel 461 + os=mon960 462 + ;; 463 + nonstopux) 464 + basic_machine=mips-compaq 465 + os=nonstopux 466 + ;; 467 + os400) 468 + basic_machine=powerpc-ibm 469 + os=os400 470 + ;; 471 + OSE68000 | ose68000) 472 + basic_machine=m68000-ericsson 473 + os=ose 474 + ;; 475 + os68k) 476 + basic_machine=m68k-none 477 + os=os68k 478 + ;; 479 + paragon) 480 + basic_machine=i860-intel 481 + os=osf 482 + ;; 483 + parisc) 484 + basic_machine=hppa-unknown 485 + os=linux 486 + ;; 487 + pw32) 488 + basic_machine=i586-unknown 489 + os=pw32 490 + ;; 491 + rdos | rdos64) 492 + basic_machine=x86_64-pc 493 + os=rdos 494 + ;; 495 + rdos32) 496 + basic_machine=i386-pc 497 + os=rdos 498 + ;; 499 + rom68k) 500 + basic_machine=m68k-rom68k 501 + os=coff 502 + ;; 503 + sa29200) 504 + basic_machine=a29k-amd 505 + os=udi 506 + ;; 507 + sei) 508 + basic_machine=mips-sei 509 + os=seiux 510 + ;; 511 + sequent) 512 + basic_machine=i386-sequent 513 + os= 514 + ;; 515 + sps7) 516 + basic_machine=m68k-bull 517 + os=sysv2 518 + ;; 519 + st2000) 520 + basic_machine=m68k-tandem 521 + os= 522 + ;; 523 + stratus) 524 + basic_machine=i860-stratus 525 + os=sysv4 526 + ;; 527 + sun2) 528 + basic_machine=m68000-sun 529 + os= 530 + ;; 531 + sun2os3) 532 + basic_machine=m68000-sun 533 + os=sunos3 534 + ;; 535 + sun2os4) 536 + basic_machine=m68000-sun 537 + os=sunos4 538 + ;; 539 + sun3) 540 + basic_machine=m68k-sun 541 + os= 542 + ;; 543 + sun3os3) 544 + basic_machine=m68k-sun 545 + os=sunos3 546 + ;; 547 + sun3os4) 548 + basic_machine=m68k-sun 549 + os=sunos4 550 + ;; 551 + sun4) 552 + basic_machine=sparc-sun 553 + os= 554 + ;; 555 + sun4os3) 556 + basic_machine=sparc-sun 557 + os=sunos3 558 + ;; 559 + sun4os4) 560 + basic_machine=sparc-sun 561 + os=sunos4 562 + ;; 563 + sun4sol2) 564 + basic_machine=sparc-sun 565 + os=solaris2 566 + ;; 567 + sun386 | sun386i | roadrunner) 568 + basic_machine=i386-sun 569 + os= 570 + ;; 571 + sv1) 572 + basic_machine=sv1-cray 573 + os=unicos 574 + ;; 575 + symmetry) 576 + basic_machine=i386-sequent 577 + os=dynix 578 + ;; 579 + t3e) 580 + basic_machine=alphaev5-cray 581 + os=unicos 582 + ;; 583 + t90) 584 + basic_machine=t90-cray 585 + os=unicos 586 + ;; 587 + toad1) 588 + basic_machine=pdp10-xkl 589 + os=tops20 590 + ;; 591 + tpf) 592 + basic_machine=s390x-ibm 593 + os=tpf 594 + ;; 595 + udi29k) 596 + basic_machine=a29k-amd 597 + os=udi 598 + ;; 599 + ultra3) 600 + basic_machine=a29k-nyu 601 + os=sym1 602 + ;; 603 + v810 | necv810) 604 + basic_machine=v810-nec 605 + os=none 606 + ;; 607 + vaxv) 608 + basic_machine=vax-dec 609 + os=sysv 610 + ;; 611 + vms) 612 + basic_machine=vax-dec 613 + os=vms 614 + ;; 615 + vxworks960) 616 + basic_machine=i960-wrs 617 + os=vxworks 618 + ;; 619 + vxworks68) 620 + basic_machine=m68k-wrs 621 + os=vxworks 622 + ;; 623 + vxworks29k) 624 + basic_machine=a29k-wrs 625 + os=vxworks 626 + ;; 627 + xbox) 628 + basic_machine=i686-pc 629 + os=mingw32 630 + ;; 631 + ymp) 632 + basic_machine=ymp-cray 633 + os=unicos 634 + ;; 635 + *) 636 + basic_machine=$1 637 + os= 638 + ;; 639 + esac 640 + ;; 641 +esac 642 + 643 +# Decode 1-component or ad-hoc basic machines 644 +case $basic_machine in 645 + # Here we handle the default manufacturer of certain CPU types. It is in 646 + # some cases the only manufacturer, in others, it is the most popular. 647 + w89k) 648 + cpu=hppa1.1 649 + vendor=winbond 650 + ;; 651 + op50n) 652 + cpu=hppa1.1 653 + vendor=oki 654 + ;; 655 + op60c) 656 + cpu=hppa1.1 657 + vendor=oki 658 + ;; 659 + ibm*) 660 + cpu=i370 661 + vendor=ibm 662 + ;; 663 + orion105) 664 + cpu=clipper 665 + vendor=highlevel 666 + ;; 667 + mac | mpw | mac-mpw) 668 + cpu=m68k 669 + vendor=apple 670 + ;; 671 + pmac | pmac-mpw) 672 + cpu=powerpc 673 + vendor=apple 674 + ;; 675 + 676 + # Recognize the various machine names and aliases which stand 677 + # for a CPU type and a company and sometimes even an OS. 678 + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) 679 + cpu=m68000 680 + vendor=att 681 + ;; 682 + 3b*) 683 + cpu=we32k 684 + vendor=att 685 + ;; 686 + bluegene*) 687 + cpu=powerpc 688 + vendor=ibm 689 + os=cnk 690 + ;; 691 + decsystem10* | dec10*) 692 + cpu=pdp10 693 + vendor=dec 694 + os=tops10 695 + ;; 696 + decsystem20* | dec20*) 697 + cpu=pdp10 698 + vendor=dec 699 + os=tops20 700 + ;; 701 + delta | 3300 | motorola-3300 | motorola-delta \ 702 + | 3300-motorola | delta-motorola) 703 + cpu=m68k 704 + vendor=motorola 705 + ;; 706 + dpx2*) 707 + cpu=m68k 708 + vendor=bull 709 + os=sysv3 710 + ;; 711 + encore | umax | mmax) 712 + cpu=ns32k 713 + vendor=encore 714 + ;; 715 + elxsi) 716 + cpu=elxsi 717 + vendor=elxsi 718 + os=${os:-bsd} 719 + ;; 720 + fx2800) 721 + cpu=i860 722 + vendor=alliant 723 + ;; 724 + genix) 725 + cpu=ns32k 726 + vendor=ns 727 + ;; 728 + h3050r* | hiux*) 729 + cpu=hppa1.1 730 + vendor=hitachi 731 + os=hiuxwe2 732 + ;; 733 + hp3k9[0-9][0-9] | hp9[0-9][0-9]) 734 + cpu=hppa1.0 735 + vendor=hp 736 + ;; 737 + hp9k2[0-9][0-9] | hp9k31[0-9]) 738 + cpu=m68000 739 + vendor=hp 740 + ;; 741 + hp9k3[2-9][0-9]) 742 + cpu=m68k 743 + vendor=hp 744 + ;; 745 + hp9k6[0-9][0-9] | hp6[0-9][0-9]) 746 + cpu=hppa1.0 747 + vendor=hp 748 + ;; 749 + hp9k7[0-79][0-9] | hp7[0-79][0-9]) 750 + cpu=hppa1.1 751 + vendor=hp 752 + ;; 753 + hp9k78[0-9] | hp78[0-9]) 754 + # FIXME: really hppa2.0-hp 755 + cpu=hppa1.1 756 + vendor=hp 757 + ;; 758 + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) 759 + # FIXME: really hppa2.0-hp 760 + cpu=hppa1.1 761 + vendor=hp 762 + ;; 763 + hp9k8[0-9][13679] | hp8[0-9][13679]) 764 + cpu=hppa1.1 765 + vendor=hp 766 + ;; 767 + hp9k8[0-9][0-9] | hp8[0-9][0-9]) 768 + cpu=hppa1.0 769 + vendor=hp 770 + ;; 771 + i*86v32) 772 + cpu=`echo "$1" | sed -e 's/86.*/86/'` 773 + vendor=pc 774 + os=sysv32 775 + ;; 776 + i*86v4*) 777 + cpu=`echo "$1" | sed -e 's/86.*/86/'` 778 + vendor=pc 779 + os=sysv4 780 + ;; 781 + i*86v) 782 + cpu=`echo "$1" | sed -e 's/86.*/86/'` 783 + vendor=pc 784 + os=sysv 785 + ;; 786 + i*86sol2) 787 + cpu=`echo "$1" | sed -e 's/86.*/86/'` 788 + vendor=pc 789 + os=solaris2 790 + ;; 791 + j90 | j90-cray) 792 + cpu=j90 793 + vendor=cray 794 + os=${os:-unicos} 795 + ;; 796 + iris | iris4d) 797 + cpu=mips 798 + vendor=sgi 799 + case $os in 800 + irix*) 801 + ;; 802 + *) 803 + os=irix4 804 + ;; 805 + esac 806 + ;; 807 + miniframe) 808 + cpu=m68000 809 + vendor=convergent 810 + ;; 811 + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) 812 + cpu=m68k 813 + vendor=atari 814 + os=mint 815 + ;; 816 + news-3600 | risc-news) 817 + cpu=mips 818 + vendor=sony 819 + os=newsos 820 + ;; 821 + next | m*-next) 822 + cpu=m68k 823 + vendor=next 824 + case $os in 825 + openstep*) 826 + ;; 827 + nextstep*) 828 + ;; 829 + ns2*) 830 + os=nextstep2 128 831 ;; 129 832 *) 130 - basic_machine=`echo $1 | sed 's/-[^-]*$//'` 131 - if [ $basic_machine != $1 ] 132 - then os=`echo $1 | sed 's/.*-/-/'` 133 - else os=; fi 833 + os=nextstep3 134 834 ;; 135 835 esac 136 - 137 -### Let's recognize common machines as not being operating systems so 138 -### that things like config.sub decstation-3100 work. We also 139 -### recognize some manufacturers as not being operating systems, so we 140 -### can provide default operating systems below. 141 -case $os in 142 - -sun*os*) 143 - # Prevent following clause from handling this invalid input. 144 - ;; 145 - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ 146 - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ 147 - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ 148 - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ 149 - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ 150 - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ 151 - -apple | -axis | -knuth | -cray) 152 - os= 153 - basic_machine=$1 154 - ;; 155 - -sim | -cisco | -oki | -wec | -winbond) 156 - os= 157 - basic_machine=$1 158 - ;; 159 - -scout) 160 - ;; 161 - -wrs) 162 - os=-vxworks 163 - basic_machine=$1 164 - ;; 165 - -chorusos*) 166 - os=-chorusos 167 - basic_machine=$1 168 - ;; 169 - -chorusrdb) 170 - os=-chorusrdb 171 - basic_machine=$1 172 - ;; 173 - -hiux*) 174 - os=-hiuxwe2 175 - ;; 176 - -sco6) 177 - os=-sco5v6 178 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 179 - ;; 180 - -sco5) 181 - os=-sco3.2v5 182 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 183 - ;; 184 - -sco4) 185 - os=-sco3.2v4 186 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 187 - ;; 188 - -sco3.2.[4-9]*) 189 - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` 190 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 191 - ;; 192 - -sco3.2v[4-9]*) 193 - # Don't forget version if it is 3.2v4 or newer. 194 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 195 - ;; 196 - -sco5v6*) 197 - # Don't forget version if it is 3.2v4 or newer. 198 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 199 - ;; 200 - -sco*) 201 - os=-sco3.2v2 202 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 203 - ;; 204 - -udk*) 205 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 206 - ;; 207 - -isc) 208 - os=-isc2.2 209 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 210 - ;; 211 - -clix*) 212 - basic_machine=clipper-intergraph 213 - ;; 214 - -isc*) 215 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 216 - ;; 217 - -lynx*) 218 - os=-lynxos 219 - ;; 220 - -ptx*) 221 - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` 222 - ;; 223 - -windowsnt*) 224 - os=`echo $os | sed -e 's/windowsnt/winnt/'` 225 - ;; 226 - -psos*) 227 - os=-psos 228 - ;; 229 - -mint | -mint[0-9]*) 230 - basic_machine=m68k-atari 231 - os=-mint 836 + ;; 837 + np1) 838 + cpu=np1 839 + vendor=gould 840 + ;; 841 + op50n-* | op60c-*) 842 + cpu=hppa1.1 843 + vendor=oki 844 + os=proelf 845 + ;; 846 + pa-hitachi) 847 + cpu=hppa1.1 848 + vendor=hitachi 849 + os=hiuxwe2 850 + ;; 851 + pbd) 852 + cpu=sparc 853 + vendor=tti 854 + ;; 855 + pbb) 856 + cpu=m68k 857 + vendor=tti 858 + ;; 859 + pc532) 860 + cpu=ns32k 861 + vendor=pc532 862 + ;; 863 + pn) 864 + cpu=pn 865 + vendor=gould 866 + ;; 867 + power) 868 + cpu=power 869 + vendor=ibm 870 + ;; 871 + ps2) 872 + cpu=i386 873 + vendor=ibm 874 + ;; 875 + rm[46]00) 876 + cpu=mips 877 + vendor=siemens 878 + ;; 879 + rtpc | rtpc-*) 880 + cpu=romp 881 + vendor=ibm 882 + ;; 883 + sde) 884 + cpu=mipsisa32 885 + vendor=sde 886 + os=${os:-elf} 887 + ;; 888 + simso-wrs) 889 + cpu=sparclite 890 + vendor=wrs 891 + os=vxworks 892 + ;; 893 + tower | tower-32) 894 + cpu=m68k 895 + vendor=ncr 896 + ;; 897 + vpp*|vx|vx-*) 898 + cpu=f301 899 + vendor=fujitsu 900 + ;; 901 + w65) 902 + cpu=w65 903 + vendor=wdc 904 + ;; 905 + w89k-*) 906 + cpu=hppa1.1 907 + vendor=winbond 908 + os=proelf 909 + ;; 910 + none) 911 + cpu=none 912 + vendor=none 913 + ;; 914 + leon|leon[3-9]) 915 + cpu=sparc 916 + vendor=$basic_machine 917 + ;; 918 + leon-*|leon[3-9]-*) 919 + cpu=sparc 920 + vendor=`echo "$basic_machine" | sed 's/-.*//'` 921 + ;; 922 + 923 + *-*) 924 + # shellcheck disable=SC2162 925 + IFS="-" read cpu vendor <<EOF 926 +$basic_machine 927 +EOF 928 + ;; 929 + # We use `pc' rather than `unknown' 930 + # because (1) that's what they normally are, and 931 + # (2) the word "unknown" tends to confuse beginning users. 932 + i*86 | x86_64) 933 + cpu=$basic_machine 934 + vendor=pc 935 + ;; 936 + # These rules are duplicated from below for sake of the special case above; 937 + # i.e. things that normalized to x86 arches should also default to "pc" 938 + pc98) 939 + cpu=i386 940 + vendor=pc 941 + ;; 942 + x64 | amd64) 943 + cpu=x86_64 944 + vendor=pc 945 + ;; 946 + # Recognize the basic CPU types without company name. 947 + *) 948 + cpu=$basic_machine 949 + vendor=unknown 232 950 ;; 233 951 esac 234 952 235 -# Decode aliases for certain CPU-COMPANY combinations. 236 -case $basic_machine in 237 - # Recognize the basic CPU types without company name. 238 - # Some are omitted here because they have special meanings below. 953 +unset -v basic_machine 954 + 955 +# Decode basic machines in the full and proper CPU-Company form. 956 +case $cpu-$vendor in 957 + # Here we handle the default manufacturer of certain CPU types in canonical form. It is in 958 + # some cases the only manufacturer, in others, it is the most popular. 959 + craynv-unknown) 960 + vendor=cray 961 + os=${os:-unicosmp} 962 + ;; 963 + c90-unknown | c90-cray) 964 + vendor=cray 965 + os=${os:-unicos} 966 + ;; 967 + fx80-unknown) 968 + vendor=alliant 969 + ;; 970 + romp-unknown) 971 + vendor=ibm 972 + ;; 973 + mmix-unknown) 974 + vendor=knuth 975 + ;; 976 + microblaze-unknown | microblazeel-unknown) 977 + vendor=xilinx 978 + ;; 979 + rs6000-unknown) 980 + vendor=ibm 981 + ;; 982 + vax-unknown) 983 + vendor=dec 984 + ;; 985 + pdp11-unknown) 986 + vendor=dec 987 + ;; 988 + we32k-unknown) 989 + vendor=att 990 + ;; 991 + cydra-unknown) 992 + vendor=cydrome 993 + ;; 994 + i370-ibm*) 995 + vendor=ibm 996 + ;; 997 + orion-unknown) 998 + vendor=highlevel 999 + ;; 1000 + xps-unknown | xps100-unknown) 1001 + cpu=xps100 1002 + vendor=honeywell 1003 + ;; 1004 + 1005 + # Here we normalize CPU types with a missing or matching vendor 1006 + dpx20-unknown | dpx20-bull) 1007 + cpu=rs6000 1008 + vendor=bull 1009 + os=${os:-bosx} 1010 + ;; 1011 + 1012 + # Here we normalize CPU types irrespective of the vendor 1013 + amd64-*) 1014 + cpu=x86_64 1015 + ;; 1016 + blackfin-*) 1017 + cpu=bfin 1018 + os=linux 1019 + ;; 1020 + c54x-*) 1021 + cpu=tic54x 1022 + ;; 1023 + c55x-*) 1024 + cpu=tic55x 1025 + ;; 1026 + c6x-*) 1027 + cpu=tic6x 1028 + ;; 1029 + e500v[12]-*) 1030 + cpu=powerpc 1031 + os=$os"spe" 1032 + ;; 1033 + mips3*-*) 1034 + cpu=mips64 1035 + ;; 1036 + ms1-*) 1037 + cpu=mt 1038 + ;; 1039 + m68knommu-*) 1040 + cpu=m68k 1041 + os=linux 1042 + ;; 1043 + m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) 1044 + cpu=s12z 1045 + ;; 1046 + openrisc-*) 1047 + cpu=or32 1048 + ;; 1049 + parisc-*) 1050 + cpu=hppa 1051 + os=linux 1052 + ;; 1053 + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) 1054 + cpu=i586 1055 + ;; 1056 + pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*) 1057 + cpu=i686 1058 + ;; 1059 + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) 1060 + cpu=i686 1061 + ;; 1062 + pentium4-*) 1063 + cpu=i786 1064 + ;; 1065 + pc98-*) 1066 + cpu=i386 1067 + ;; 1068 + ppc-* | ppcbe-*) 1069 + cpu=powerpc 1070 + ;; 1071 + ppcle-* | powerpclittle-*) 1072 + cpu=powerpcle 1073 + ;; 1074 + ppc64-*) 1075 + cpu=powerpc64 1076 + ;; 1077 + ppc64le-* | powerpc64little-*) 1078 + cpu=powerpc64le 1079 + ;; 1080 + sb1-*) 1081 + cpu=mipsisa64sb1 1082 + ;; 1083 + sb1el-*) 1084 + cpu=mipsisa64sb1el 1085 + ;; 1086 + sh5e[lb]-*) 1087 + cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` 1088 + ;; 1089 + spur-*) 1090 + cpu=spur 1091 + ;; 1092 + strongarm-* | thumb-*) 1093 + cpu=arm 1094 + ;; 1095 + tx39-*) 1096 + cpu=mipstx39 1097 + ;; 1098 + tx39el-*) 1099 + cpu=mipstx39el 1100 + ;; 1101 + x64-*) 1102 + cpu=x86_64 1103 + ;; 1104 + xscale-* | xscalee[bl]-*) 1105 + cpu=`echo "$cpu" | sed 's/^xscale/arm/'` 1106 + ;; 1107 + 1108 + # Recognize the canonical CPU Types that limit and/or modify the 1109 + # company names they are paired with. 1110 + cr16-*) 1111 + os=${os:-elf} 1112 + ;; 1113 + crisv32-* | etraxfs*-*) 1114 + cpu=crisv32 1115 + vendor=axis 1116 + ;; 1117 + cris-* | etrax*-*) 1118 + cpu=cris 1119 + vendor=axis 1120 + ;; 1121 + crx-*) 1122 + os=${os:-elf} 1123 + ;; 1124 + neo-tandem) 1125 + cpu=neo 1126 + vendor=tandem 1127 + ;; 1128 + nse-tandem) 1129 + cpu=nse 1130 + vendor=tandem 1131 + ;; 1132 + nsr-tandem) 1133 + cpu=nsr 1134 + vendor=tandem 1135 + ;; 1136 + nsv-tandem) 1137 + cpu=nsv 1138 + vendor=tandem 1139 + ;; 1140 + nsx-tandem) 1141 + cpu=nsx 1142 + vendor=tandem 1143 + ;; 1144 + s390-*) 1145 + cpu=s390 1146 + vendor=ibm 1147 + ;; 1148 + s390x-*) 1149 + cpu=s390x 1150 + vendor=ibm 1151 + ;; 1152 + tile*-*) 1153 + os=${os:-linux-gnu} 1154 + ;; 1155 + 1156 + *) 1157 + # Recognize the canonical CPU types that are allowed with any 1158 + # company name. 1159 + case $cpu in 239 1160 1750a | 580 \ 240 1161 | a29k \ 241 - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ 242 - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ 1162 + | aarch64 | aarch64_be \ 1163 + | abacus \ 1164 + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ 1165 + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ 1166 + | alphapca5[67] | alpha64pca5[67] \ 243 1167 | am33_2.0 \ 244 - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ 245 - | bfin \ 246 - | c4x | clipper \ 247 - | d10v | d30v | dlx | dsp16xx | dvp \ 248 - | fido | fr30 | frv \ 249 - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ 250 - | i370 | i860 | i960 | ia64 \ 1168 + | amdgcn \ 1169 + | arc | arceb \ 1170 + | arm | arm[lb]e | arme[lb] | armv* \ 1171 + | avr | avr32 \ 1172 + | asmjs \ 1173 + | ba \ 1174 + | be32 | be64 \ 1175 + | bfin | bpf | bs2000 \ 1176 + | c[123]* | c30 | [cjt]90 | c4x \ 1177 + | c8051 | clipper | craynv | csky | cydra \ 1178 + | d10v | d30v | dlx | dsp16xx \ 1179 + | e2k | elxsi | epiphany \ 1180 + | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ 1181 + | h8300 | h8500 \ 1182 + | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ 1183 + | hexagon \ 1184 + | i370 | i*86 | i860 | i960 | ia16 | ia64 \ 251 1185 | ip2k | iq2000 \ 252 - | m32c | m32r | m32rle | m68000 | m68k | m88k \ 253 - | maxq | mb | microblaze | mcore | mep \ 1186 + | k1om \ 1187 + | le32 | le64 \ 1188 + | lm32 \ 1189 + | m32c | m32r | m32rle \ 1190 + | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ 1191 + | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ 1192 + | m88110 | m88k | maxq | mb | mcore | mep | metag \ 1193 + | microblaze | microblazeel \ 254 1194 | mips | mipsbe | mipseb | mipsel | mipsle \ 255 1195 | mips16 \ 256 - | mips64 | mips64el \ 257 - | mips64vr | mips64vrel \ 1196 + | mips64 | mips64eb | mips64el \ 1197 + | mips64octeon | mips64octeonel \ 258 1198 | mips64orion | mips64orionel \ 1199 + | mips64r5900 | mips64r5900el \ 1200 + | mips64vr | mips64vrel \ 259 1201 | mips64vr4100 | mips64vr4100el \ 260 1202 | mips64vr4300 | mips64vr4300el \ 261 1203 | mips64vr5000 | mips64vr5000el \ 262 1204 | mips64vr5900 | mips64vr5900el \ 263 1205 | mipsisa32 | mipsisa32el \ 264 1206 | mipsisa32r2 | mipsisa32r2el \ 1207 + | mipsisa32r6 | mipsisa32r6el \ 265 1208 | mipsisa64 | mipsisa64el \ 266 1209 | mipsisa64r2 | mipsisa64r2el \ 1210 + | mipsisa64r6 | mipsisa64r6el \ 267 1211 | mipsisa64sb1 | mipsisa64sb1el \ 268 1212 | mipsisa64sr71k | mipsisa64sr71kel \ 1213 + | mipsr5900 | mipsr5900el \ 269 1214 | mipstx39 | mipstx39el \ 1215 + | mmix \ 270 1216 | mn10200 | mn10300 \ 1217 + | moxie \ 271 1218 | mt \ 272 1219 | msp430 \ 273 - | nios | nios2 \ 274 - | ns16k | ns32k \ 1220 + | nds32 | nds32le | nds32be \ 1221 + | nfp \ 1222 + | nios | nios2 | nios2eb | nios2el \ 1223 + | none | np1 | ns16k | ns32k | nvptx \ 1224 + | open8 \ 1225 + | or1k* \ 275 1226 | or32 \ 276 - | pdp10 | pdp11 | pj | pjl \ 277 - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ 1227 + | orion \ 1228 + | picochip \ 1229 + | pdp10 | pdp11 | pj | pjl | pn | power \ 1230 + | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ 1231 + | pru \ 278 1232 | pyramid \ 1233 + | riscv | riscv32 | riscv64 \ 1234 + | rl78 | romp | rs6000 | rx \ 279 1235 | score \ 280 - | sh | sh[1234] | sh[24]a | sh[24]a*eb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ 281 - | sh64 | sh64le \ 282 - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ 283 - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ 284 - | spu | strongarm \ 285 - | tahoe | thumb | tic4x | tic80 | tron \ 286 - | v850 | v850e \ 1236 + | sh | shl \ 1237 + | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ 1238 + | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ 1239 + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ 1240 + | sparclite \ 1241 + | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ 1242 + | spu \ 1243 + | tahoe \ 1244 + | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ 1245 + | tron \ 1246 + | ubicom32 \ 1247 + | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ 1248 + | vax \ 1249 + | visium \ 1250 + | w65 \ 1251 + | wasm32 | wasm64 \ 287 1252 | we32k \ 288 - | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ 289 - | z8k) 290 - basic_machine=$basic_machine-unknown 291 - ;; 292 - m6811 | m68hc11 | m6812 | m68hc12) 293 - # Motorola 68HC11/12. 294 - basic_machine=$basic_machine-unknown 295 - os=-none 296 - ;; 297 - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) 298 - ;; 299 - ms1) 300 - basic_machine=mt-unknown 1253 + | x86 | x86_64 | xc16x | xgate | xps100 \ 1254 + | xstormy16 | xtensa* \ 1255 + | ymp \ 1256 + | z8k | z80) 301 1257 ;; 302 1258 303 - # We use `pc' rather than `unknown' 304 - # because (1) that's what they normally are, and 305 - # (2) the word "unknown" tends to confuse beginning users. 306 - i*86 | x86_64) 307 - basic_machine=$basic_machine-pc 308 - ;; 309 - # Object if more than one company name word. 310 - *-*-*) 311 - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 1259 + *) 1260 + echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 312 1261 exit 1 313 1262 ;; 314 - # Recognize the basic CPU types with company name. 315 - 580-* \ 316 - | a29k-* \ 317 - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ 318 - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ 319 - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ 320 - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ 321 - | avr-* | avr32-* \ 322 - | bfin-* | bs2000-* \ 323 - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ 324 - | clipper-* | craynv-* | cydra-* \ 325 - | d10v-* | d30v-* | dlx-* \ 326 - | elxsi-* \ 327 - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ 328 - | h8300-* | h8500-* \ 329 - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ 330 - | i*86-* | i860-* | i960-* | ia64-* \ 331 - | ip2k-* | iq2000-* \ 332 - | m32c-* | m32r-* | m32rle-* \ 333 - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ 334 - | m88110-* | m88k-* | maxq-* | mcore-* \ 335 - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ 336 - | mips16-* \ 337 - | mips64-* | mips64el-* \ 338 - | mips64vr-* | mips64vrel-* \ 339 - | mips64orion-* | mips64orionel-* \ 340 - | mips64vr4100-* | mips64vr4100el-* \ 341 - | mips64vr4300-* | mips64vr4300el-* \ 342 - | mips64vr5000-* | mips64vr5000el-* \ 343 - | mips64vr5900-* | mips64vr5900el-* \ 344 - | mipsisa32-* | mipsisa32el-* \ 345 - | mipsisa32r2-* | mipsisa32r2el-* \ 346 - | mipsisa64-* | mipsisa64el-* \ 347 - | mipsisa64r2-* | mipsisa64r2el-* \ 348 - | mipsisa64sb1-* | mipsisa64sb1el-* \ 349 - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ 350 - | mipstx39-* | mipstx39el-* \ 351 - | mmix-* \ 352 - | mt-* \ 353 - | msp430-* \ 354 - | nios-* | nios2-* \ 355 - | none-* | np1-* | ns16k-* | ns32k-* \ 356 - | orion-* \ 357 - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ 358 - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ 359 - | pyramid-* \ 360 - | romp-* | rs6000-* \ 361 - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]a*eb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ 362 - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ 363 - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ 364 - | sparclite-* \ 365 - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ 366 - | tahoe-* | thumb-* \ 367 - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ 368 - | tron-* \ 369 - | v850-* | v850e-* | vax-* \ 370 - | we32k-* \ 371 - | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ 372 - | xstormy16-* | xtensa-* \ 373 - | ymp-* \ 374 - | z8k-*) 375 - ;; 376 - # Recognize the various machine names and aliases which stand 377 - # for a CPU type and a company and sometimes even an OS. 378 - 386bsd) 379 - basic_machine=i386-unknown 380 - os=-bsd 381 - ;; 382 - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) 383 - basic_machine=m68000-att 384 - ;; 385 - 3b*) 386 - basic_machine=we32k-att 387 - ;; 388 - a29khif) 389 - basic_machine=a29k-amd 390 - os=-udi 391 - ;; 392 - abacus) 393 - basic_machine=abacus-unknown 394 - ;; 395 - adobe68k) 396 - basic_machine=m68010-adobe 397 - os=-scout 398 - ;; 399 - alliant | fx80) 400 - basic_machine=fx80-alliant 401 - ;; 402 - altos | altos3068) 403 - basic_machine=m68k-altos 404 - ;; 405 - am29k) 406 - basic_machine=a29k-none 407 - os=-bsd 408 - ;; 409 - amd64) 410 - basic_machine=x86_64-pc 411 - ;; 412 - amd64-*) 413 - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` 414 - ;; 415 - amdahl) 416 - basic_machine=580-amdahl 417 - os=-sysv 418 - ;; 419 - amiga | amiga-*) 420 - basic_machine=m68k-unknown 421 - ;; 422 - amigaos | amigados) 423 - basic_machine=m68k-unknown 424 - os=-amigaos 425 - ;; 426 - amigaunix | amix) 427 - basic_machine=m68k-unknown 428 - os=-sysv4 429 - ;; 430 - apollo68) 431 - basic_machine=m68k-apollo 432 - os=-sysv 433 - ;; 434 - apollo68bsd) 435 - basic_machine=m68k-apollo 436 - os=-bsd 437 - ;; 438 - aux) 439 - basic_machine=m68k-apple 440 - os=-aux 441 - ;; 442 - balance) 443 - basic_machine=ns32k-sequent 444 - os=-dynix 445 - ;; 446 - c90) 447 - basic_machine=c90-cray 448 - os=-unicos 449 - ;; 450 - convex-c1) 451 - basic_machine=c1-convex 452 - os=-bsd 453 - ;; 454 - convex-c2) 455 - basic_machine=c2-convex 456 - os=-bsd 457 - ;; 458 - convex-c32) 459 - basic_machine=c32-convex 460 - os=-bsd 461 - ;; 462 - convex-c34) 463 - basic_machine=c34-convex 464 - os=-bsd 465 - ;; 466 - convex-c38) 467 - basic_machine=c38-convex 468 - os=-bsd 469 - ;; 470 - cray | j90) 471 - basic_machine=j90-cray 472 - os=-unicos 473 - ;; 474 - craynv) 475 - basic_machine=craynv-cray 476 - os=-unicosmp 477 - ;; 478 - cr16) 479 - basic_machine=cr16-unknown 480 - os=-elf 481 - ;; 482 - crds | unos) 483 - basic_machine=m68k-crds 484 - ;; 485 - crisv32 | crisv32-* | etraxfs*) 486 - basic_machine=crisv32-axis 487 - ;; 488 - cris | cris-* | etrax*) 489 - basic_machine=cris-axis 490 - ;; 491 - crx) 492 - basic_machine=crx-unknown 493 - os=-elf 494 - ;; 495 - da30 | da30-*) 496 - basic_machine=m68k-da30 497 - ;; 498 - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) 499 - basic_machine=mips-dec 500 - ;; 501 - decsystem10* | dec10*) 502 - basic_machine=pdp10-dec 503 - os=-tops10 504 - ;; 505 - decsystem20* | dec20*) 506 - basic_machine=pdp10-dec 507 - os=-tops20 508 - ;; 509 - delta | 3300 | motorola-3300 | motorola-delta \ 510 - | 3300-motorola | delta-motorola) 511 - basic_machine=m68k-motorola 512 - ;; 513 - delta88) 514 - basic_machine=m88k-motorola 515 - os=-sysv3 516 - ;; 517 - djgpp) 518 - basic_machine=i586-pc 519 - os=-msdosdjgpp 520 - ;; 521 - dpx20 | dpx20-*) 522 - basic_machine=rs6000-bull 523 - os=-bosx 524 - ;; 525 - dpx2* | dpx2*-bull) 526 - basic_machine=m68k-bull 527 - os=-sysv3 528 - ;; 529 - ebmon29k) 530 - basic_machine=a29k-amd 531 - os=-ebmon 532 - ;; 533 - elxsi) 534 - basic_machine=elxsi-elxsi 535 - os=-bsd 536 - ;; 537 - encore | umax | mmax) 538 - basic_machine=ns32k-encore 539 - ;; 540 - es1800 | OSE68k | ose68k | ose | OSE) 541 - basic_machine=m68k-ericsson 542 - os=-ose 543 - ;; 544 - fx2800) 545 - basic_machine=i860-alliant 546 - ;; 547 - genix) 548 - basic_machine=ns32k-ns 549 - ;; 550 - gmicro) 551 - basic_machine=tron-gmicro 552 - os=-sysv 553 - ;; 554 - go32) 555 - basic_machine=i386-pc 556 - os=-go32 557 - ;; 558 - h3050r* | hiux*) 559 - basic_machine=hppa1.1-hitachi 560 - os=-hiuxwe2 561 - ;; 562 - h8300hms) 563 - basic_machine=h8300-hitachi 564 - os=-hms 565 - ;; 566 - h8300xray) 567 - basic_machine=h8300-hitachi 568 - os=-xray 569 - ;; 570 - h8500hms) 571 - basic_machine=h8500-hitachi 572 - os=-hms 573 - ;; 574 - harris) 575 - basic_machine=m88k-harris 576 - os=-sysv3 577 - ;; 578 - hp300-*) 579 - basic_machine=m68k-hp 580 - ;; 581 - hp300bsd) 582 - basic_machine=m68k-hp 583 - os=-bsd 584 - ;; 585 - hp300hpux) 586 - basic_machine=m68k-hp 587 - os=-hpux 588 - ;; 589 - hp3k9[0-9][0-9] | hp9[0-9][0-9]) 590 - basic_machine=hppa1.0-hp 591 - ;; 592 - hp9k2[0-9][0-9] | hp9k31[0-9]) 593 - basic_machine=m68000-hp 594 - ;; 595 - hp9k3[2-9][0-9]) 596 - basic_machine=m68k-hp 597 - ;; 598 - hp9k6[0-9][0-9] | hp6[0-9][0-9]) 599 - basic_machine=hppa1.0-hp 600 - ;; 601 - hp9k7[0-79][0-9] | hp7[0-79][0-9]) 602 - basic_machine=hppa1.1-hp 603 - ;; 604 - hp9k78[0-9] | hp78[0-9]) 605 - # FIXME: really hppa2.0-hp 606 - basic_machine=hppa1.1-hp 607 - ;; 608 - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) 609 - # FIXME: really hppa2.0-hp 610 - basic_machine=hppa1.1-hp 611 - ;; 612 - hp9k8[0-9][13679] | hp8[0-9][13679]) 613 - basic_machine=hppa1.1-hp 614 - ;; 615 - hp9k8[0-9][0-9] | hp8[0-9][0-9]) 616 - basic_machine=hppa1.0-hp 617 - ;; 618 - hppa-next) 619 - os=-nextstep3 620 - ;; 621 - hppaosf) 622 - basic_machine=hppa1.1-hp 623 - os=-osf 624 - ;; 625 - hppro) 626 - basic_machine=hppa1.1-hp 627 - os=-proelf 628 - ;; 629 - i370-ibm* | ibm*) 630 - basic_machine=i370-ibm 631 - ;; 632 -# I'm not sure what "Sysv32" means. Should this be sysv3.2? 633 - i*86v32) 634 - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` 635 - os=-sysv32 636 - ;; 637 - i*86v4*) 638 - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` 639 - os=-sysv4 640 - ;; 641 - i*86v) 642 - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` 643 - os=-sysv 644 - ;; 645 - i*86sol2) 646 - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` 647 - os=-solaris2 648 - ;; 649 - i386mach) 650 - basic_machine=i386-mach 651 - os=-mach 652 - ;; 653 - i386-vsta | vsta) 654 - basic_machine=i386-unknown 655 - os=-vsta 656 - ;; 657 - iris | iris4d) 658 - basic_machine=mips-sgi 659 - case $os in 660 - -irix*) 661 - ;; 662 - *) 663 - os=-irix4 664 - ;; 665 - esac 666 - ;; 667 - isi68 | isi) 668 - basic_machine=m68k-isi 669 - os=-sysv 670 - ;; 671 - m88k-omron*) 672 - basic_machine=m88k-omron 673 - ;; 674 - magnum | m3230) 675 - basic_machine=mips-mips 676 - os=-sysv 677 - ;; 678 - merlin) 679 - basic_machine=ns32k-utek 680 - os=-sysv 681 - ;; 682 - mingw32) 683 - basic_machine=i386-pc 684 - os=-mingw32 685 - ;; 686 - mingw32ce) 687 - basic_machine=arm-unknown 688 - os=-mingw32ce 689 - ;; 690 - miniframe) 691 - basic_machine=m68000-convergent 692 - ;; 693 - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) 694 - basic_machine=m68k-atari 695 - os=-mint 696 - ;; 697 - mipsEE* | ee | ps2) 698 - basic_machine=mips64r5900el-scei 699 - case $os in 700 - -linux*) 701 - ;; 702 - *) 703 - os=-elf 704 - ;; 705 - esac 706 - ;; 707 - iop) 708 - basic_machine=mipsel-scei 709 - os=-irx 710 - ;; 711 - dvp) 712 - basic_machine=dvp-scei 713 - os=-elf 714 - ;; 715 - mips3*-*) 716 - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` 717 - ;; 718 - mips3*) 719 - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown 720 - ;; 721 - monitor) 722 - basic_machine=m68k-rom68k 723 - os=-coff 724 - ;; 725 - morphos) 726 - basic_machine=powerpc-unknown 727 - os=-morphos 728 - ;; 729 - msdos) 730 - basic_machine=i386-pc 731 - os=-msdos 732 - ;; 733 - ms1-*) 734 - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` 735 - ;; 736 - mvs) 737 - basic_machine=i370-ibm 738 - os=-mvs 739 - ;; 740 - ncr3000) 741 - basic_machine=i486-ncr 742 - os=-sysv4 743 - ;; 744 - netbsd386) 745 - basic_machine=i386-unknown 746 - os=-netbsd 747 - ;; 748 - netwinder) 749 - basic_machine=armv4l-rebel 750 - os=-linux 751 - ;; 752 - news | news700 | news800 | news900) 753 - basic_machine=m68k-sony 754 - os=-newsos 755 - ;; 756 - news1000) 757 - basic_machine=m68030-sony 758 - os=-newsos 759 - ;; 760 - news-3600 | risc-news) 761 - basic_machine=mips-sony 762 - os=-newsos 763 - ;; 764 - necv70) 765 - basic_machine=v70-nec 766 - os=-sysv 767 - ;; 768 - next | m*-next ) 769 - basic_machine=m68k-next 770 - case $os in 771 - -nextstep* ) 772 - ;; 773 - -ns2*) 774 - os=-nextstep2 775 - ;; 776 - *) 777 - os=-nextstep3 778 - ;; 779 - esac 780 - ;; 781 - nh3000) 782 - basic_machine=m68k-harris 783 - os=-cxux 784 - ;; 785 - nh[45]000) 786 - basic_machine=m88k-harris 787 - os=-cxux 788 - ;; 789 - nindy960) 790 - basic_machine=i960-intel 791 - os=-nindy 792 - ;; 793 - mon960) 794 - basic_machine=i960-intel 795 - os=-mon960 796 - ;; 797 - nonstopux) 798 - basic_machine=mips-compaq 799 - os=-nonstopux 800 - ;; 801 - np1) 802 - basic_machine=np1-gould 803 - ;; 804 - nsr-tandem) 805 - basic_machine=nsr-tandem 806 - ;; 807 - op50n-* | op60c-*) 808 - basic_machine=hppa1.1-oki 809 - os=-proelf 810 - ;; 811 - openrisc | openrisc-*) 812 - basic_machine=or32-unknown 813 - ;; 814 - os400) 815 - basic_machine=powerpc-ibm 816 - os=-os400 817 - ;; 818 - OSE68000 | ose68000) 819 - basic_machine=m68000-ericsson 820 - os=-ose 821 - ;; 822 - os68k) 823 - basic_machine=m68k-none 824 - os=-os68k 825 - ;; 826 - pa-hitachi) 827 - basic_machine=hppa1.1-hitachi 828 - os=-hiuxwe2 829 - ;; 830 - paragon) 831 - basic_machine=i860-intel 832 - os=-osf 833 - ;; 834 - pbd) 835 - basic_machine=sparc-tti 836 - ;; 837 - pbb) 838 - basic_machine=m68k-tti 839 - ;; 840 - pc532 | pc532-*) 841 - basic_machine=ns32k-pc532 842 - ;; 843 - pc98) 844 - basic_machine=i386-pc 845 - ;; 846 - pc98-*) 847 - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` 848 - ;; 849 - pentium | p5 | k5 | k6 | nexgen | viac3) 850 - basic_machine=i586-pc 851 - ;; 852 - pentiumpro | p6 | 6x86 | athlon | athlon_*) 853 - basic_machine=i686-pc 854 - ;; 855 - pentiumii | pentium2 | pentiumiii | pentium3) 856 - basic_machine=i686-pc 857 - ;; 858 - pentium4) 859 - basic_machine=i786-pc 860 - ;; 861 - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) 862 - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` 863 - ;; 864 - pentiumpro-* | p6-* | 6x86-* | athlon-*) 865 - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` 866 - ;; 867 - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) 868 - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` 869 - ;; 870 - pentium4-*) 871 - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` 872 - ;; 873 - pn) 874 - basic_machine=pn-gould 875 - ;; 876 - power) basic_machine=power-ibm 877 - ;; 878 - ppc) basic_machine=powerpc-unknown 879 - ;; 880 - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` 881 - ;; 882 - ppcle | powerpclittle | ppc-le | powerpc-little) 883 - basic_machine=powerpcle-unknown 884 - ;; 885 - ppcle-* | powerpclittle-*) 886 - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` 887 - ;; 888 - ppc64) basic_machine=powerpc64-unknown 889 - ;; 890 - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` 891 - ;; 892 - ppc64le | powerpc64little | ppc64-le | powerpc64-little) 893 - basic_machine=powerpc64le-unknown 894 - ;; 895 - ppc64le-* | powerpc64little-*) 896 - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` 897 - ;; 898 - ps2) 899 - basic_machine=i386-ibm 900 - ;; 901 - pw32) 902 - basic_machine=i586-unknown 903 - os=-pw32 904 - ;; 905 - rdos) 906 - basic_machine=i386-pc 907 - os=-rdos 908 - ;; 909 - rom68k) 910 - basic_machine=m68k-rom68k 911 - os=-coff 912 - ;; 913 - rm[46]00) 914 - basic_machine=mips-siemens 915 - ;; 916 - rtpc | rtpc-*) 917 - basic_machine=romp-ibm 918 - ;; 919 - s390 | s390-*) 920 - basic_machine=s390-ibm 921 - ;; 922 - s390x | s390x-*) 923 - basic_machine=s390x-ibm 924 - ;; 925 - sa29200) 926 - basic_machine=a29k-amd 927 - os=-udi 928 - ;; 929 - sb1) 930 - basic_machine=mipsisa64sb1-unknown 931 - ;; 932 - sb1el) 933 - basic_machine=mipsisa64sb1el-unknown 934 - ;; 935 - sde) 936 - basic_machine=mipsisa32-sde 937 - os=-elf 938 - ;; 939 - sei) 940 - basic_machine=mips-sei 941 - os=-seiux 942 - ;; 943 - sequent) 944 - basic_machine=i386-sequent 945 - ;; 946 - sh) 947 - basic_machine=sh-hitachi 948 - os=-hms 949 - ;; 950 - sh5el) 951 - basic_machine=sh5le-unknown 952 - ;; 953 - sh64) 954 - basic_machine=sh64-unknown 955 - ;; 956 - sparclite-wrs | simso-wrs) 957 - basic_machine=sparclite-wrs 958 - os=-vxworks 959 - ;; 960 - sps7) 961 - basic_machine=m68k-bull 962 - os=-sysv2 963 - ;; 964 - spur) 965 - basic_machine=spur-unknown 966 - ;; 967 - st2000) 968 - basic_machine=m68k-tandem 969 - ;; 970 - stratus) 971 - basic_machine=i860-stratus 972 - os=-sysv4 973 - ;; 974 - sun2) 975 - basic_machine=m68000-sun 976 - ;; 977 - sun2os3) 978 - basic_machine=m68000-sun 979 - os=-sunos3 980 - ;; 981 - sun2os4) 982 - basic_machine=m68000-sun 983 - os=-sunos4 984 - ;; 985 - sun3os3) 986 - basic_machine=m68k-sun 987 - os=-sunos3 988 - ;; 989 - sun3os4) 990 - basic_machine=m68k-sun 991 - os=-sunos4 992 - ;; 993 - sun4os3) 994 - basic_machine=sparc-sun 995 - os=-sunos3 996 - ;; 997 - sun4os4) 998 - basic_machine=sparc-sun 999 - os=-sunos4 1000 - ;; 1001 - sun4sol2) 1002 - basic_machine=sparc-sun 1003 - os=-solaris2 1004 - ;; 1005 - sun3 | sun3-*) 1006 - basic_machine=m68k-sun 1007 - ;; 1008 - sun4) 1009 - basic_machine=sparc-sun 1010 - ;; 1011 - sun386 | sun386i | roadrunner) 1012 - basic_machine=i386-sun 1013 - ;; 1014 - sv1) 1015 - basic_machine=sv1-cray 1016 - os=-unicos 1017 - ;; 1018 - symmetry) 1019 - basic_machine=i386-sequent 1020 - os=-dynix 1021 - ;; 1022 - t3e) 1023 - basic_machine=alphaev5-cray 1024 - os=-unicos 1025 - ;; 1026 - t90) 1027 - basic_machine=t90-cray 1028 - os=-unicos 1029 - ;; 1030 - tic54x | c54x*) 1031 - basic_machine=tic54x-unknown 1032 - os=-coff 1033 - ;; 1034 - tic55x | c55x*) 1035 - basic_machine=tic55x-unknown 1036 - os=-coff 1037 - ;; 1038 - tic6x | c6x*) 1039 - basic_machine=tic6x-unknown 1040 - os=-coff 1041 - ;; 1042 - tx39) 1043 - basic_machine=mipstx39-unknown 1044 - ;; 1045 - tx39el) 1046 - basic_machine=mipstx39el-unknown 1047 - ;; 1048 - toad1) 1049 - basic_machine=pdp10-xkl 1050 - os=-tops20 1051 - ;; 1052 - tower | tower-32) 1053 - basic_machine=m68k-ncr 1054 - ;; 1055 - tpf) 1056 - basic_machine=s390x-ibm 1057 - os=-tpf 1058 - ;; 1059 - udi29k) 1060 - basic_machine=a29k-amd 1061 - os=-udi 1062 - ;; 1063 - ultra3) 1064 - basic_machine=a29k-nyu 1065 - os=-sym1 1066 - ;; 1067 - v810 | necv810) 1068 - basic_machine=v810-nec 1069 - os=-none 1070 - ;; 1071 - vaxv) 1072 - basic_machine=vax-dec 1073 - os=-sysv 1074 - ;; 1075 - vms) 1076 - basic_machine=vax-dec 1077 - os=-vms 1078 - ;; 1079 - vpp*|vx|vx-*) 1080 - basic_machine=f301-fujitsu 1081 - ;; 1082 - vxworks960) 1083 - basic_machine=i960-wrs 1084 - os=-vxworks 1085 - ;; 1086 - vxworks68) 1087 - basic_machine=m68k-wrs 1088 - os=-vxworks 1089 - ;; 1090 - vxworks29k) 1091 - basic_machine=a29k-wrs 1092 - os=-vxworks 1093 - ;; 1094 - w65*) 1095 - basic_machine=w65-wdc 1096 - os=-none 1097 - ;; 1098 - w89k-*) 1099 - basic_machine=hppa1.1-winbond 1100 - os=-proelf 1101 - ;; 1102 - xbox) 1103 - basic_machine=i686-pc 1104 - os=-mingw32 1105 - ;; 1106 - xps | xps100) 1107 - basic_machine=xps100-honeywell 1108 - ;; 1109 - ymp) 1110 - basic_machine=ymp-cray 1111 - os=-unicos 1112 - ;; 1113 - z8k-*-coff) 1114 - basic_machine=z8k-unknown 1115 - os=-sim 1116 - ;; 1117 - none) 1118 - basic_machine=none-none 1119 - os=-none 1120 - ;; 1121 - 1122 -# Here we handle the default manufacturer of certain CPU types. It is in 1123 -# some cases the only manufacturer, in others, it is the most popular. 1124 - w89k) 1125 - basic_machine=hppa1.1-winbond 1126 - ;; 1127 - op50n) 1128 - basic_machine=hppa1.1-oki 1129 - ;; 1130 - op60c) 1131 - basic_machine=hppa1.1-oki 1132 - ;; 1133 - romp) 1134 - basic_machine=romp-ibm 1135 - ;; 1136 - mmix) 1137 - basic_machine=mmix-knuth 1138 - ;; 1139 - rs6000) 1140 - basic_machine=rs6000-ibm 1141 - ;; 1142 - vax) 1143 - basic_machine=vax-dec 1144 - ;; 1145 - pdp10) 1146 - # there are many clones, so DEC is not a safe bet 1147 - basic_machine=pdp10-unknown 1148 - ;; 1149 - pdp11) 1150 - basic_machine=pdp11-dec 1151 - ;; 1152 - we32k) 1153 - basic_machine=we32k-att 1154 - ;; 1155 - sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) 1156 - basic_machine=sh-unknown 1157 - ;; 1158 - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) 1159 - basic_machine=sparc-sun 1160 - ;; 1161 - cydra) 1162 - basic_machine=cydra-cydrome 1163 - ;; 1164 - orion) 1165 - basic_machine=orion-highlevel 1166 - ;; 1167 - orion105) 1168 - basic_machine=clipper-highlevel 1169 - ;; 1170 - mac | mpw | mac-mpw) 1171 - basic_machine=m68k-apple 1172 - ;; 1173 - pmac | pmac-mpw) 1174 - basic_machine=powerpc-apple 1175 - ;; 1176 - *-unknown) 1177 - # Make sure to match an already-canonicalized machine name. 1178 - ;; 1179 - *) 1180 - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 1181 - exit 1 1263 + esac 1182 1264 ;; 1183 1265 esac 1184 1266 1185 1267 # Here we canonicalize certain aliases for manufacturers. 1186 -case $basic_machine in 1187 - *-digital*) 1188 - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` 1268 +case $vendor in 1269 + digital*) 1270 + vendor=dec 1189 1271 ;; 1190 - *-commodore*) 1191 - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` 1272 + commodore*) 1273 + vendor=cbm 1192 1274 ;; 1193 1275 *) 1194 1276 ;; 1195 1277 esac 1196 1278 1197 1279 # Decode manufacturer-specific aliases for certain operating systems. 1198 1280 1199 -if [ x"$os" != x"" ] 1281 +if [ x$os != x ] 1200 1282 then 1201 1283 case $os in 1202 - # First match some system type aliases 1203 - # that might get confused with valid system types. 1204 - # -solaris* is a basic system type, with this one exception. 1205 - -solaris1 | -solaris1.*) 1284 + # First match some system type aliases that might get confused 1285 + # with valid system types. 1286 + # solaris* is a basic system type, with this one exception. 1287 + auroraux) 1288 + os=auroraux 1289 + ;; 1290 + bluegene*) 1291 + os=cnk 1292 + ;; 1293 + solaris1 | solaris1.*) 1206 1294 os=`echo $os | sed -e 's|solaris1|sunos4|'` 1207 1295 ;; 1208 - -solaris) 1209 - os=-solaris2 1296 + solaris) 1297 + os=solaris2 1210 1298 ;; 1211 - -svr4*) 1212 - os=-sysv4 1299 + unixware*) 1300 + os=sysv4.2uw 1213 1301 ;; 1214 - -unixware*) 1215 - os=-sysv4.2uw 1216 - ;; 1217 - -gnu/linux*) 1302 + gnu/linux*) 1218 1303 os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` 1219 1304 ;; 1220 - # First accept the basic system types. 1305 + # es1800 is here to avoid being matched by es* (a different OS) 1306 + es1800*) 1307 + os=ose 1308 + ;; 1309 + # Some version numbers need modification 1310 + chorusos*) 1311 + os=chorusos 1312 + ;; 1313 + isc) 1314 + os=isc2.2 1315 + ;; 1316 + sco6) 1317 + os=sco5v6 1318 + ;; 1319 + sco5) 1320 + os=sco3.2v5 1321 + ;; 1322 + sco4) 1323 + os=sco3.2v4 1324 + ;; 1325 + sco3.2.[4-9]*) 1326 + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` 1327 + ;; 1328 + sco3.2v[4-9]* | sco5v6*) 1329 + # Don't forget version if it is 3.2v4 or newer. 1330 + ;; 1331 + scout) 1332 + # Don't match below 1333 + ;; 1334 + sco*) 1335 + os=sco3.2v2 1336 + ;; 1337 + psos*) 1338 + os=psos 1339 + ;; 1340 + # Now accept the basic system types. 1221 1341 # The portable systems comes first. 1222 - # Each alternative MUST END IN A *, to match a version number. 1223 - # -sysv* is not here because it comes later, after sysvr4. 1224 - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ 1225 - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ 1226 - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ 1227 - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ 1228 - | -aos* \ 1229 - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ 1230 - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ 1231 - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ 1232 - | -openbsd* | -solidbsd* \ 1233 - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ 1234 - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ 1235 - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ 1236 - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ 1237 - | -chorusos* | -chorusrdb* \ 1238 - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ 1239 - | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ 1240 - | -uxpv* | -beos* | -mpeix* | -udk* \ 1241 - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ 1242 - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ 1243 - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ 1244 - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ 1245 - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ 1246 - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ 1247 - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -irx*) 1342 + # Each alternative MUST end in a * to match a version number. 1343 + # sysv* is not here because it comes later, after sysvr4. 1344 + gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ 1345 + | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\ 1346 + | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ 1347 + | sym* | kopensolaris* | plan9* \ 1348 + | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ 1349 + | aos* | aros* | cloudabi* | sortix* \ 1350 + | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ 1351 + | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ 1352 + | knetbsd* | mirbsd* | netbsd* \ 1353 + | bitrig* | openbsd* | solidbsd* | libertybsd* \ 1354 + | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \ 1355 + | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ 1356 + | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ 1357 + | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \ 1358 + | chorusrdb* | cegcc* | glidix* \ 1359 + | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ 1360 + | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \ 1361 + | linux-newlib* | linux-musl* | linux-uclibc* \ 1362 + | uxpv* | beos* | mpeix* | udk* | moxiebox* \ 1363 + | interix* | uwin* | mks* | rhapsody* | darwin* \ 1364 + | openstep* | oskit* | conix* | pw32* | nonstopux* \ 1365 + | storm-chaos* | tops10* | tenex* | tops20* | its* \ 1366 + | os2* | vos* | palmos* | uclinux* | nucleus* \ 1367 + | morphos* | superux* | rtmk* | windiss* \ 1368 + | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ 1369 + | skyos* | haiku* | rdos* | toppers* | drops* | es* \ 1370 + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ 1371 + | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi*) 1248 1372 # Remember, each alternative MUST END IN *, to match a version number. 1249 1373 ;; 1250 - -qnx*) 1251 - case $basic_machine in 1252 - x86-* | i*86-*) 1374 + qnx*) 1375 + case $cpu in 1376 + x86 | i*86) 1377 + ;; 1378 + *) 1379 + os=nto-$os 1380 + ;; 1381 + esac 1382 + ;; 1383 + hiux*) 1384 + os=hiuxwe2 1385 + ;; 1386 + nto-qnx*) 1387 + ;; 1388 + nto*) 1389 + os=`echo $os | sed -e 's|nto|nto-qnx|'` 1390 + ;; 1391 + sim | xray | os68k* | v88r* \ 1392 + | windows* | osx | abug | netware* | os9* \ 1393 + | macos* | mpw* | magic* | mmixware* | mon960* | lnews*) 1394 + ;; 1395 + linux-dietlibc) 1396 + os=linux-dietlibc 1397 + ;; 1398 + linux*) 1399 + os=`echo $os | sed -e 's|linux|linux-gnu|'` 1400 + ;; 1401 + lynx*178) 1402 + os=lynxos178 1403 + ;; 1404 + lynx*5) 1405 + os=lynxos5 1406 + ;; 1407 + lynx*) 1408 + os=lynxos 1409 + ;; 1410 + mac*) 1411 + os=`echo "$os" | sed -e 's|mac|macos|'` 1412 + ;; 1413 + opened*) 1414 + os=openedition 1415 + ;; 1416 + os400*) 1417 + os=os400 1418 + ;; 1419 + sunos5*) 1420 + os=`echo "$os" | sed -e 's|sunos5|solaris2|'` 1421 + ;; 1422 + sunos6*) 1423 + os=`echo "$os" | sed -e 's|sunos6|solaris3|'` 1424 + ;; 1425 + wince*) 1426 + os=wince 1427 + ;; 1428 + utek*) 1429 + os=bsd 1430 + ;; 1431 + dynix*) 1432 + os=bsd 1433 + ;; 1434 + acis*) 1435 + os=aos 1436 + ;; 1437 + atheos*) 1438 + os=atheos 1439 + ;; 1440 + syllable*) 1441 + os=syllable 1442 + ;; 1443 + 386bsd) 1444 + os=bsd 1445 + ;; 1446 + ctix* | uts*) 1447 + os=sysv 1448 + ;; 1449 + nova*) 1450 + os=rtmk-nova 1451 + ;; 1452 + ns2) 1453 + os=nextstep2 1454 + ;; 1455 + nsk*) 1456 + os=nsk 1457 + ;; 1458 + # Preserve the version number of sinix5. 1459 + sinix5.*) 1460 + os=`echo $os | sed -e 's|sinix|sysv|'` 1461 + ;; 1462 + sinix*) 1463 + os=sysv4 1464 + ;; 1465 + tpf*) 1466 + os=tpf 1467 + ;; 1468 + triton*) 1469 + os=sysv3 1470 + ;; 1471 + oss*) 1472 + os=sysv3 1473 + ;; 1474 + svr4*) 1475 + os=sysv4 1476 + ;; 1477 + svr3) 1478 + os=sysv3 1479 + ;; 1480 + sysvr4) 1481 + os=sysv4 1482 + ;; 1483 + # This must come after sysvr4. 1484 + sysv*) 1485 + ;; 1486 + ose*) 1487 + os=ose 1488 + ;; 1489 + *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) 1490 + os=mint 1491 + ;; 1492 + zvmoe) 1493 + os=zvmoe 1494 + ;; 1495 + dicos*) 1496 + os=dicos 1497 + ;; 1498 + pikeos*) 1499 + # Until real need of OS specific support for 1500 + # particular features comes up, bare metal 1501 + # configurations are quite functional. 1502 + case $cpu in 1503 + arm*) 1504 + os=eabi 1253 1505 ;; 1254 1506 *) 1255 - os=-nto$os 1507 + os=elf 1256 1508 ;; 1257 1509 esac 1258 1510 ;; 1259 - -nto-qnx*) 1260 - ;; 1261 - -nto*) 1262 - os=`echo $os | sed -e 's|nto|nto-qnx|'` 1263 - ;; 1264 - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ 1265 - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ 1266 - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) 1267 - ;; 1268 - -mac*) 1269 - os=`echo $os | sed -e 's|mac|macos|'` 1270 - ;; 1271 - -linux-dietlibc) 1272 - os=-linux-dietlibc 1273 - ;; 1274 - -linux*) 1275 - os=`echo $os | sed -e 's|linux|linux-gnu|'` 1276 - ;; 1277 - -sunos5*) 1278 - os=`echo $os | sed -e 's|sunos5|solaris2|'` 1279 - ;; 1280 - -sunos6*) 1281 - os=`echo $os | sed -e 's|sunos6|solaris3|'` 1282 - ;; 1283 - -opened*) 1284 - os=-openedition 1285 - ;; 1286 - -os400*) 1287 - os=-os400 1288 - ;; 1289 - -wince*) 1290 - os=-wince 1291 - ;; 1292 - -osfrose*) 1293 - os=-osfrose 1294 - ;; 1295 - -osf*) 1296 - os=-osf 1297 - ;; 1298 - -utek*) 1299 - os=-bsd 1300 - ;; 1301 - -dynix*) 1302 - os=-bsd 1303 - ;; 1304 - -acis*) 1305 - os=-aos 1306 - ;; 1307 - -atheos*) 1308 - os=-atheos 1309 - ;; 1310 - -syllable*) 1311 - os=-syllable 1312 - ;; 1313 - -386bsd) 1314 - os=-bsd 1315 - ;; 1316 - -ctix* | -uts*) 1317 - os=-sysv 1318 - ;; 1319 - -nova*) 1320 - os=-rtmk-nova 1321 - ;; 1322 - -ns2 ) 1323 - os=-nextstep2 1324 - ;; 1325 - -nsk*) 1326 - os=-nsk 1327 - ;; 1328 - # Preserve the version number of sinix5. 1329 - -sinix5.*) 1330 - os=`echo $os | sed -e 's|sinix|sysv|'` 1331 - ;; 1332 - -sinix*) 1333 - os=-sysv4 1334 - ;; 1335 - -tpf*) 1336 - os=-tpf 1337 - ;; 1338 - -triton*) 1339 - os=-sysv3 1340 - ;; 1341 - -oss*) 1342 - os=-sysv3 1343 - ;; 1344 - -svr4) 1345 - os=-sysv4 1346 - ;; 1347 - -svr3) 1348 - os=-sysv3 1349 - ;; 1350 - -sysvr4) 1351 - os=-sysv4 1352 - ;; 1353 - # This must come after -sysvr4. 1354 - -sysv*) 1355 - ;; 1356 - -ose*) 1357 - os=-ose 1358 - ;; 1359 - -es1800*) 1360 - os=-ose 1361 - ;; 1362 - -xenix) 1363 - os=-xenix 1364 - ;; 1365 - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) 1366 - os=-mint 1367 - ;; 1368 - -aros*) 1369 - os=-aros 1370 - ;; 1371 - -kaos*) 1372 - os=-kaos 1373 - ;; 1374 - -zvmoe) 1375 - os=-zvmoe 1376 - ;; 1377 - -none) 1511 + nacl*) 1512 + ;; 1513 + ios) 1514 + ;; 1515 + none) 1516 + ;; 1517 + *-eabi) 1378 1518 ;; 1379 1519 *) 1380 - # Get rid of the `-' at the beginning of $os. 1381 - os=`echo $os | sed 's/[^-]*-//'` 1382 - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 1520 + echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 1383 1521 exit 1 1384 1522 ;; 1385 1523 esac 1386 1524 else 1387 1525 1388 1526 # Here we handle the default operating systems that come with various machines. 1389 1527 # The value should be what the vendor currently ships out the door with their ................................................................................ 1391 1529 1392 1530 # Note that if you're going to try to match "-MANUFACTURER" here (say, 1393 1531 # "-sun"), then you have to tell the case statement up towards the top 1394 1532 # that MANUFACTURER isn't an operating system. Otherwise, code above 1395 1533 # will signal an error saying that MANUFACTURER isn't an operating 1396 1534 # system, and we'll never get to this point. 1397 1535 1398 -case $basic_machine in 1536 +case $cpu-$vendor in 1399 1537 score-*) 1400 - os=-elf 1538 + os=elf 1401 1539 ;; 1402 1540 spu-*) 1403 - os=-elf 1541 + os=elf 1404 1542 ;; 1405 1543 *-acorn) 1406 - os=-riscix1.2 1544 + os=riscix1.2 1407 1545 ;; 1408 1546 arm*-rebel) 1409 - os=-linux 1547 + os=linux 1410 1548 ;; 1411 1549 arm*-semi) 1412 - os=-aout 1550 + os=aout 1413 1551 ;; 1414 1552 c4x-* | tic4x-*) 1415 - os=-coff 1553 + os=coff 1554 + ;; 1555 + c8051-*) 1556 + os=elf 1557 + ;; 1558 + clipper-intergraph) 1559 + os=clix 1560 + ;; 1561 + hexagon-*) 1562 + os=elf 1563 + ;; 1564 + tic54x-*) 1565 + os=coff 1566 + ;; 1567 + tic55x-*) 1568 + os=coff 1569 + ;; 1570 + tic6x-*) 1571 + os=coff 1416 1572 ;; 1417 1573 # This must come before the *-dec entry. 1418 1574 pdp10-*) 1419 - os=-tops20 1575 + os=tops20 1420 1576 ;; 1421 1577 pdp11-*) 1422 - os=-none 1578 + os=none 1423 1579 ;; 1424 1580 *-dec | vax-*) 1425 - os=-ultrix4.2 1581 + os=ultrix4.2 1426 1582 ;; 1427 1583 m68*-apollo) 1428 - os=-domain 1584 + os=domain 1429 1585 ;; 1430 1586 i386-sun) 1431 - os=-sunos4.0.2 1587 + os=sunos4.0.2 1432 1588 ;; 1433 1589 m68000-sun) 1434 - os=-sunos3 1435 - # This also exists in the configure program, but was not the 1436 - # default. 1437 - # os=-sunos4 1590 + os=sunos3 1438 1591 ;; 1439 1592 m68*-cisco) 1440 - os=-aout 1593 + os=aout 1441 1594 ;; 1442 1595 mep-*) 1443 - os=-elf 1596 + os=elf 1444 1597 ;; 1445 1598 mips*-cisco) 1446 - os=-elf 1599 + os=elf 1447 1600 ;; 1448 1601 mips*-*) 1449 - os=-elf 1602 + os=elf 1450 1603 ;; 1451 1604 or32-*) 1452 - os=-coff 1605 + os=coff 1453 1606 ;; 1454 1607 *-tti) # must be before sparc entry or we get the wrong os. 1455 - os=-sysv3 1608 + os=sysv3 1456 1609 ;; 1457 1610 sparc-* | *-sun) 1458 - os=-sunos4.1.1 1611 + os=sunos4.1.1 1612 + ;; 1613 + pru-*) 1614 + os=elf 1459 1615 ;; 1460 1616 *-be) 1461 - os=-beos 1462 - ;; 1463 - *-haiku) 1464 - os=-haiku 1617 + os=beos 1465 1618 ;; 1466 1619 *-ibm) 1467 - os=-aix 1620 + os=aix 1468 1621 ;; 1469 1622 *-knuth) 1470 - os=-mmixware 1623 + os=mmixware 1471 1624 ;; 1472 1625 *-wec) 1473 - os=-proelf 1626 + os=proelf 1474 1627 ;; 1475 1628 *-winbond) 1476 - os=-proelf 1629 + os=proelf 1477 1630 ;; 1478 1631 *-oki) 1479 - os=-proelf 1632 + os=proelf 1480 1633 ;; 1481 1634 *-hp) 1482 - os=-hpux 1635 + os=hpux 1483 1636 ;; 1484 1637 *-hitachi) 1485 - os=-hiux 1638 + os=hiux 1486 1639 ;; 1487 1640 i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) 1488 - os=-sysv 1641 + os=sysv 1489 1642 ;; 1490 1643 *-cbm) 1491 - os=-amigaos 1644 + os=amigaos 1492 1645 ;; 1493 1646 *-dg) 1494 - os=-dgux 1647 + os=dgux 1495 1648 ;; 1496 1649 *-dolphin) 1497 - os=-sysv3 1650 + os=sysv3 1498 1651 ;; 1499 1652 m68k-ccur) 1500 - os=-rtu 1653 + os=rtu 1501 1654 ;; 1502 1655 m88k-omron*) 1503 - os=-luna 1656 + os=luna 1504 1657 ;; 1505 1658 *-next ) 1506 - os=-nextstep 1659 + os=nextstep 1507 1660 ;; 1508 1661 *-sequent) 1509 - os=-ptx 1662 + os=ptx 1510 1663 ;; 1511 1664 *-crds) 1512 - os=-unos 1665 + os=unos 1513 1666 ;; 1514 1667 *-ns) 1515 - os=-genix 1668 + os=genix 1516 1669 ;; 1517 1670 i370-*) 1518 - os=-mvs 1519 - ;; 1520 - *-next) 1521 - os=-nextstep3 1671 + os=mvs 1522 1672 ;; 1523 1673 *-gould) 1524 - os=-sysv 1674 + os=sysv 1525 1675 ;; 1526 1676 *-highlevel) 1527 - os=-bsd 1677 + os=bsd 1528 1678 ;; 1529 1679 *-encore) 1530 - os=-bsd 1680 + os=bsd 1531 1681 ;; 1532 1682 *-sgi) 1533 - os=-irix 1683 + os=irix 1534 1684 ;; 1535 1685 *-siemens) 1536 - os=-sysv4 1686 + os=sysv4 1537 1687 ;; 1538 1688 *-masscomp) 1539 - os=-rtu 1689 + os=rtu 1540 1690 ;; 1541 1691 f30[01]-fujitsu | f700-fujitsu) 1542 - os=-uxpv 1692 + os=uxpv 1543 1693 ;; 1544 1694 *-rom68k) 1545 - os=-coff 1695 + os=coff 1546 1696 ;; 1547 1697 *-*bug) 1548 - os=-coff 1698 + os=coff 1549 1699 ;; 1550 1700 *-apple) 1551 - os=-macos 1701 + os=macos 1552 1702 ;; 1553 1703 *-atari*) 1554 - os=-mint 1704 + os=mint 1705 + ;; 1706 + *-wrs) 1707 + os=vxworks 1555 1708 ;; 1556 1709 *) 1557 - os=-none 1710 + os=none 1558 1711 ;; 1559 1712 esac 1560 1713 fi 1561 1714 1562 1715 # Here we handle the case where we know the os, and the CPU type, but not the 1563 1716 # manufacturer. We pick the logical manufacturer. 1564 -vendor=unknown 1565 -case $basic_machine in 1566 - *-unknown) 1717 +case $vendor in 1718 + unknown) 1567 1719 case $os in 1568 - -riscix*) 1720 + riscix*) 1569 1721 vendor=acorn 1570 1722 ;; 1571 - -sunos*) 1723 + sunos*) 1572 1724 vendor=sun 1573 1725 ;; 1574 - -aix*) 1726 + cnk*|-aix*) 1575 1727 vendor=ibm 1576 1728 ;; 1577 - -beos*) 1729 + beos*) 1578 1730 vendor=be 1579 1731 ;; 1580 - -hpux*) 1732 + hpux*) 1581 1733 vendor=hp 1582 1734 ;; 1583 - -mpeix*) 1735 + mpeix*) 1584 1736 vendor=hp 1585 1737 ;; 1586 - -hiux*) 1738 + hiux*) 1587 1739 vendor=hitachi 1588 1740 ;; 1589 - -unos*) 1741 + unos*) 1590 1742 vendor=crds 1591 1743 ;; 1592 - -dgux*) 1744 + dgux*) 1593 1745 vendor=dg 1594 1746 ;; 1595 - -luna*) 1747 + luna*) 1596 1748 vendor=omron 1597 1749 ;; 1598 - -genix*) 1750 + genix*) 1599 1751 vendor=ns 1600 1752 ;; 1601 - -mvs* | -opened*) 1753 + clix*) 1754 + vendor=intergraph 1755 + ;; 1756 + mvs* | opened*) 1602 1757 vendor=ibm 1603 1758 ;; 1604 - -os400*) 1759 + os400*) 1605 1760 vendor=ibm 1606 1761 ;; 1607 - -ptx*) 1762 + ptx*) 1608 1763 vendor=sequent 1609 1764 ;; 1610 - -tpf*) 1765 + tpf*) 1611 1766 vendor=ibm 1612 1767 ;; 1613 - -vxsim* | -vxworks* | -windiss*) 1768 + vxsim* | vxworks* | windiss*) 1614 1769 vendor=wrs 1615 1770 ;; 1616 - -aux*) 1771 + aux*) 1617 1772 vendor=apple 1618 1773 ;; 1619 - -hms*) 1774 + hms*) 1620 1775 vendor=hitachi 1621 1776 ;; 1622 - -mpw* | -macos*) 1777 + mpw* | macos*) 1623 1778 vendor=apple 1624 1779 ;; 1625 - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) 1780 + *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) 1626 1781 vendor=atari 1627 1782 ;; 1628 - -vos*) 1783 + vos*) 1629 1784 vendor=stratus 1630 1785 ;; 1631 1786 esac 1632 - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` 1633 1787 ;; 1634 1788 esac 1635 1789 1636 -echo $basic_machine$os 1790 +echo "$cpu-$vendor-$os" 1637 1791 exit 1638 1792 1639 1793 # Local variables: 1640 -# eval: (add-hook 'write-file-hooks 'time-stamp) 1794 +# eval: (add-hook 'before-save-hook 'time-stamp) 1641 1795 # time-stamp-start: "timestamp='" 1642 1796 # time-stamp-format: "%:y-%02m-%02d" 1643 1797 # time-stamp-end: "'" 1644 1798 # End:
Changes to ext/fts3/fts3_write.c.
2615 2615 if( iCol==iCurrent ){ 2616 2616 nList = (int)(p - pList); 2617 2617 break; 2618 2618 } 2619 2619 2620 2620 nList -= (int)(p - pList); 2621 2621 pList = p; 2622 - if( nList==0 ){ 2622 + if( nList<=0 ){ 2623 2623 break; 2624 2624 } 2625 2625 p = &pList[1]; 2626 2626 p += fts3GetVarint32(p, &iCurrent); 2627 2627 } 2628 2628 2629 - if( bZero && &pList[nList]!=pEnd ){ 2629 + if( bZero && (pEnd - &pList[nList])>0){ 2630 2630 memset(&pList[nList], 0, pEnd - &pList[nList]); 2631 2631 } 2632 2632 *ppList = pList; 2633 2633 *pnList = nList; 2634 2634 } 2635 2635 2636 2636 /* ................................................................................ 3930 3930 int bFirst = (pPrev->n==0); /* True if this is the first term written */ 3931 3931 int nPrefix; /* Size of term prefix in bytes */ 3932 3932 int nSuffix; /* Size of term suffix in bytes */ 3933 3933 3934 3934 /* Node must have already been started. There must be a doclist for a 3935 3935 ** leaf node, and there must not be a doclist for an internal node. */ 3936 3936 assert( pNode->n>0 ); 3937 - assert( (pNode->a[0]=='\0')==(aDoclist!=0) ); 3937 + assert_fts3_nc( (pNode->a[0]=='\0')==(aDoclist!=0) ); 3938 3938 3939 3939 blobGrowBuffer(pPrev, nTerm, &rc); 3940 3940 if( rc!=SQLITE_OK ) return rc; 3941 3941 3942 3942 nPrefix = fts3PrefixCompress(pPrev->a, pPrev->n, zTerm, nTerm); 3943 3943 nSuffix = nTerm - nPrefix; 3944 3944 memcpy(pPrev->a, zTerm, nTerm); ................................................................................ 4146 4146 static int fts3TermCmp( 4147 4147 const char *zLhs, int nLhs, /* LHS of comparison */ 4148 4148 const char *zRhs, int nRhs /* RHS of comparison */ 4149 4149 ){ 4150 4150 int nCmp = MIN(nLhs, nRhs); 4151 4151 int res; 4152 4152 4153 - res = memcmp(zLhs, zRhs, nCmp); 4153 + res = (nCmp ? memcmp(zLhs, zRhs, nCmp) : 0); 4154 4154 if( res==0 ) res = nLhs - nRhs; 4155 4155 4156 4156 return res; 4157 4157 } 4158 4158 4159 4159 4160 4160 /* ................................................................................ 4278 4278 4279 4279 for(i=nHeight+1; i<FTS_MAX_APPENDABLE_HEIGHT; i++){ 4280 4280 pWriter->aNodeWriter[i].iBlock = pWriter->iStart + i*pWriter->nLeafEst; 4281 4281 } 4282 4282 4283 4283 pNode = &pWriter->aNodeWriter[nHeight]; 4284 4284 pNode->iBlock = pWriter->iStart + pWriter->nLeafEst*nHeight; 4285 - blobGrowBuffer(&pNode->block, MAX(nRoot, p->nNodeSize), &rc); 4285 + blobGrowBuffer(&pNode->block, 4286 + MAX(nRoot, p->nNodeSize)+FTS3_NODE_PADDING, &rc 4287 + ); 4286 4288 if( rc==SQLITE_OK ){ 4287 4289 memcpy(pNode->block.a, aRoot, nRoot); 4288 4290 pNode->block.n = nRoot; 4291 + memset(&pNode->block.a[nRoot], 0, FTS3_NODE_PADDING); 4289 4292 } 4290 4293 4291 4294 for(i=nHeight; i>=0 && rc==SQLITE_OK; i--){ 4292 4295 NodeReader reader; 4293 4296 pNode = &pWriter->aNodeWriter[i]; 4294 4297 4295 4298 rc = nodeReaderInit(&reader, pNode->block.a, pNode->block.n); 4299 + if( reader.aNode ){ 4296 4300 while( reader.aNode && rc==SQLITE_OK ) rc = nodeReaderNext(&reader); 4297 4301 blobGrowBuffer(&pNode->key, reader.term.n, &rc); 4298 4302 if( rc==SQLITE_OK ){ 4299 4303 memcpy(pNode->key.a, reader.term.a, reader.term.n); 4300 4304 pNode->key.n = reader.term.n; 4301 4305 if( i>0 ){ 4302 4306 char *aBlock = 0; 4303 4307 int nBlock = 0; 4304 4308 pNode = &pWriter->aNodeWriter[i-1]; 4305 4309 pNode->iBlock = reader.iChild; 4306 4310 rc = sqlite3Fts3ReadBlock(p, reader.iChild, &aBlock, &nBlock, 0); 4307 - blobGrowBuffer(&pNode->block, MAX(nBlock, p->nNodeSize), &rc); 4311 + blobGrowBuffer(&pNode->block, 4312 + MAX(nBlock, p->nNodeSize)+FTS3_NODE_PADDING, &rc 4313 + ); 4308 4314 if( rc==SQLITE_OK ){ 4309 4315 memcpy(pNode->block.a, aBlock, nBlock); 4310 4316 pNode->block.n = nBlock; 4317 + memset(&pNode->block.a[nBlock], 0, FTS3_NODE_PADDING); 4311 4318 } 4312 4319 sqlite3_free(aBlock); 4313 4320 } 4314 4321 } 4322 + } 4315 4323 nodeReaderRelease(&reader); 4316 4324 } 4317 4325 } 4318 4326 4319 4327 rc2 = sqlite3_reset(pSelect); 4320 4328 if( rc==SQLITE_OK ) rc = rc2; 4321 4329 } ................................................................................ 4548 4556 const char *zTerm, /* Omit all terms smaller than this */ 4549 4557 int nTerm, /* Size of zTerm in bytes */ 4550 4558 sqlite3_int64 *piBlock /* OUT: Block number in next layer down */ 4551 4559 ){ 4552 4560 NodeReader reader; /* Reader object */ 4553 4561 Blob prev = {0, 0, 0}; /* Previous term written to new node */ 4554 4562 int rc = SQLITE_OK; /* Return code */ 4555 - int bLeaf = aNode[0]=='\0'; /* True for a leaf node */ 4563 + int bLeaf; /* True for a leaf node */ 4564 + 4565 + if( nNode<1 ) return FTS_CORRUPT_VTAB; 4566 + bLeaf = aNode[0]=='\0'; 4556 4567 4557 4568 /* Allocate required output space */ 4558 4569 blobGrowBuffer(pNew, nNode, &rc); 4559 4570 if( rc!=SQLITE_OK ) return rc; 4560 4571 pNew->n = 0; 4561 4572 4562 4573 /* Populate new node buffer */
Changes to ext/fts5/fts5_index.c.
988 988 Fts5Data *pData; 989 989 990 990 pData = fts5DataRead(p, FTS5_STRUCTURE_ROWID); 991 991 if( p->rc==SQLITE_OK ){ 992 992 /* TODO: Do we need this if the leaf-index is appended? Probably... */ 993 993 memset(&pData->p[pData->nn], 0, FTS5_DATA_PADDING); 994 994 p->rc = fts5StructureDecode(pData->p, pData->nn, &iCookie, &pRet); 995 - if( p->rc==SQLITE_OK && pConfig->iCookie!=iCookie ){ 995 + if( p->rc==SQLITE_OK && (pConfig->pgsz==0 || pConfig->iCookie!=iCookie) ){ 996 996 p->rc = sqlite3Fts5ConfigLoad(pConfig, iCookie); 997 997 } 998 998 fts5DataRelease(pData); 999 999 if( p->rc!=SQLITE_OK ){ 1000 1000 fts5StructureRelease(pRet); 1001 1001 pRet = 0; 1002 1002 }
Changes to ext/fts5/test/fts5corrupt3.test.
4664 4664 do_execsql_test 38.1 { 4665 4665 SELECT * FROM t1('a b') ORDER BY rank; 4666 4666 } {a b a b} 4667 4667 4668 4668 do_execsql_test 38.2 { 4669 4669 UPDATE t1_data SET block = X'000202' WHERE rowid=1; 4670 4670 } 4671 -breakpoint 4672 4671 do_catchsql_test 38.3 { 4673 4672 SELECT * FROM t1('a b') ORDER BY rank; 4674 4673 } {1 {database disk image is malformed}} 4675 4674 4676 4675 db close 4677 4676 sqlite3 db test.db 4678 4677 do_catchsql_test 38.4 { ................................................................................ 8949 8948 | end crash-e5fa281edabddf.db 8950 8949 }]} {} 8951 8950 8952 8951 do_execsql_test 61.1 { 8953 8952 CREATE VIRTUAL TABLE t3 USING fts5vocab('t1'(),'col' ); 8954 8953 } 8955 8954 8956 -do_catchsql_test 62.2 { 8955 +do_catchsql_test 61.2 { 8957 8956 SELECT * FROM t3 ORDER BY rowid; 8958 8957 } {1 {database disk image is malformed}} 8959 8958 8959 +breakpoint 8960 +#------------------------------------------------------------------------- 8961 +do_test 62.0 { 8962 + sqlite3 db {} 8963 + db deserialize [decode_hexdb { 8964 +.open --hexdb 8965 +| size 28672 pagesize 4096 filename crash-44942694542e1e.db 8966 +| page 1 offset 0 8967 +| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3. 8968 +| 16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 00 .....@ ........ 8969 +| 96: 00 00 00 00 0d 0f c7 00 07 0d 92 00 0f 8d 0f 36 ...............6 8970 +| 112: 0e cb 0e 6b 0e 0e 0d b6 0d 92 00 00 00 00 00 00 ...k............ 8971 +| 3472: 00 00 22 08 06 17 11 11 01 31 74 61 62 6c 65 74 .........1tablet 8972 +| 3488: 32 74 32 08 43 52 45 41 54 45 20 54 41 42 4c 45 2t2.CREATE TABLE 8973 +| 3504: 20 74 32 28 78 29 56 07 06 17 1f 1f 01 7d 74 61 t2(x)V.......ta 8974 +| 3520: 62 6c 65 74 31 5f 63 6f 6e 66 79 67 74 31 5f 63 blet1_confygt1_c 8975 +| 3536: 6f 6e 66 69 67 07 43 52 45 41 54 45 20 54 41 42 onfig.CREATE TAB 8976 +| 3552: 4c 45 20 27 74 31 5f 63 6f 6e 66 69 67 27 28 6b LE 't1_config'(k 8977 +| 3568: 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 76 29 PRIMARY KEY, v) 8978 +| 3584: 20 57 49 54 48 4f 55 54 20 52 4f 57 49 44 5b 06 WITHOUT ROWID[. 8979 +| 3600: 07 17 21 21 01 81 01 74 61 62 6c 65 74 31 5f 64 ..!!...tablet1_d 8980 +| 3616: 6f 63 73 69 7a 65 74 31 5f 64 6f 63 73 69 7a 65 ocsizet1_docsize 8981 +| 3632: 06 43 52 45 41 54 45 20 54 41 42 4c 45 20 27 74 .CREATE TABLE 't 8982 +| 3648: 31 5f 64 6f 63 73 69 7a 65 27 28 69 64 20 49 4e 1_docsize'(id IN 8983 +| 3664: 54 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 TEGER PRIMARY KE 8984 +| 3680: 59 2c 20 73 7a 20 52 4c 4f 42 29 5e 05 07 17 21 Y, sz RLOB)^...! 8985 +| 3696: 21 01 81 07 74 61 62 6c 65 74 31 5f 63 6f 6e 74 !...tablet1_cont 8986 +| 3712: 65 6e 74 74 35 ff 63 6f 6e 74 65 6e 74 05 43 52 entt5.content.CR 8987 +| 3728: 45 41 54 45 20 54 41 42 4c 45 20 27 74 31 5f 63 EATE TABLE 't1_c 8988 +| 3744: 6f 6e 74 65 6e 74 27 28 69 64 20 49 4e 54 45 47 ontent'(id INTEG 8989 +| 3760: 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 ER PRIMARY KEY, 8990 +| 3776: 63 30 2c 20 63 31 2c 20 63 42 29 69 04 07 17 19 c0, c1, cB)i.... 8991 +| 3792: 19 01 81 2d 74 61 62 6c 65 74 31 5f 69 64 78 74 ...-tablet1_idxt 8992 +| 3808: 31 5f 79 64 78 04 43 52 45 41 54 45 20 54 41 42 1_ydx.CREATE TAB 8993 +| 3824: 4c 45 20 27 74 31 5f 69 64 78 27 28 73 65 67 69 LE 't1_idx'(segi 8994 +| 3840: 64 2c 20 74 65 72 6d 2c 20 70 67 6e 6f 2c 20 50 d, term, pgno, P 8995 +| 3856: 52 49 4d 41 52 59 20 4b 45 59 28 73 65 67 69 64 RIMARY KEY(segid 8996 +| 3872: 2c 20 74 65 72 6d 29 29 20 57 49 54 48 4f 55 54 , term)) WITHOUT 8997 +| 3888: 20 52 4f 57 49 44 55 03 07 17 1b 1b 01 81 01 74 ROWIDU........t 8998 +| 3904: 61 62 6c 65 74 31 5f 64 61 74 61 74 31 5f 74 61 ablet1_datat1_ta 8999 +| 3920: 74 61 03 43 52 45 41 54 45 20 54 41 42 4c 45 20 ta.CREATE TABLE 9000 +| 3936: 27 74 31 5f 64 61 74 61 27 28 69 64 20 49 4e 54 't1_data'(id INT 9001 +| 3952: 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 EGER PRIMARY KEY 9002 +| 3968: 2c 20 62 6c 6f 63 6b 20 42 4c 4f 42 29 38 02 06 , block BLOB)8.. 9003 +| 3984: 17 11 11 08 5f 74 61 62 6c 65 74 31 74 31 43 52 ...._tablet1t1CR 9004 +| 4000: 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 EATE VIRTUAL TAB 9005 +| 4016: 4c 45 20 74 31 20 55 53 49 4e 47 20 66 74 73 35 LE t1 USING fts5 9006 +| 4032: 28 61 2c 62 2c 63 29 00 00 00 00 00 00 00 00 00 (a,b,c)......... 9007 +| page 3 offset 8192 9008 +| 0: 0d 00 00 00 03 0c 94 00 0f e6 0f ef 0c 94 00 00 ................ 9009 +| 3216: 00 00 00 00 86 4a 84 80 80 80 80 01 04 00 8d 18 .....J.......... 9010 +| 3232: 00 00 03 2b 02 30 30 01 02 06 01 02 06 01 02 06 ...+.00......... 9011 +| 3248: 2f 02 03 01 02 03 01 02 03 01 08 32 30 31 36 30 /..........20160 9012 +| 3264: 36 30 39 01 02 07 01 02 07 01 02 07 01 01 34 01 609...........4. 9013 +| 3280: 02 05 01 02 c7 01 02 05 01 01 35 01 02 04 01 02 ..........5..... 9014 +| 3296: 04 01 02 04 02 07 30 30 30 30 30 30 30 1c 02 04 ......0000000... 9015 +| 3312: 01 02 04 01 02 04 01 06 62 69 6e 61 72 79 03 06 ........binary.. 9016 +| 3328: 01 02 02 04 16 01 02 02 03 06 01 02 02 02 06 01 ................ 9017 +| 3344: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................ 9018 +| 3360: 02 03 06 01 02 02 03 06 01 02 02 02 06 01 02 02 ................ 9019 +| 3376: 03 06 01 02 02 03 06 01 02 02 01 08 63 6f 6d 70 ............comp 9020 +| 3392: 69 6c 65 72 01 02 02 01 02 02 01 02 02 01 06 64 iler...........d 9021 +| 3408: 62 73 74 61 74 07 02 03 00 02 03 01 02 03 02 04 bstat........... 9022 +| 3424: 65 62 74 67 04 02 02 01 02 02 01 02 02 01 06 65 ebtg...........e 9023 +| 3440: 6e 61 62 6c 65 07 02 02 01 02 02 01 02 02 01 02 nable........... 9024 +| 3456: 02 01 02 02 01 02 02 01 02 02 01 02 01 f1 02 02 ................ 9025 +| 3472: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 ................ 9026 +| 3488: 02 02 01 02 02 45 02 02 01 02 02 01 02 02 01 02 .....E.......... 9027 +| 3504: 02 01 02 02 02 08 78 74 65 6e 73 69 6f 6e 1f 02 ......xtension.. 9028 +| 3520: 04 01 02 09 c1 02 04 01 04 66 74 73 34 0a 02 03 .........fts4... 9029 +| 3536: 01 02 03 01 02 03 04 00 35 0d 02 03 01 02 04 01 ........5....... 9030 +| 3552: 02 03 01 0f d7 63 63 01 02 03 01 02 03 01 02 03 .....cc......... 9031 +| 3568: 02 06 65 6f 70 6f 6b 79 10 02 03 01 02 03 01 02 ..eopoky........ 9032 +| 3584: 03 01 05 6a 73 6f 6e 31 13 02 03 14 02 03 01 02 ...json1........ 9033 +| 3600: 03 01 04 6c 6f 61 64 1f 02 03 01 02 03 01 02 03 ...load......... 9034 +| 3616: 01 03 6d 61 78 1c 02 02 01 02 02 01 02 02 02 05 ..max........... 9035 +| 3632: 65 6d 6f 72 79 1c 02 03 01 02 03 01 02 03 04 04 emory........... 9036 +| 3648: 73 79 73 35 16 02 03 01 02 03 01 02 03 01 06 6e sys5...........n 9037 +| 3664: 6f 63 61 73 65 02 06 01 02 12 03 06 01 02 02 03 ocase........... 9038 +| 3680: 06 01 02 02 03 06 01 02 02 09 f6 01 02 02 03 06 ................ 9039 +| 3696: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................ 9040 +| 3712: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 11 02 ................ 9041 +| 3728: 02 01 04 6f 7d 69 74 1f 02 02 01 02 02 01 02 02 ...o.it......... 9042 +| 3744: 01 05 72 74 72 65 65 19 02 03 01 02 03 01 02 03 ..rtree......... 9043 +| 3760: 04 02 69 6d 01 06 01 02 02 03 06 01 02 02 03 06 ..im............ 9044 +| 3776: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................ 9045 +| 3792: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 11 02 ................ 9046 +| 3808: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................ 9047 +| 3824: 00 fa 74 68 72 65 61 64 73 61 66 65 22 02 02 01 ..threadsafe.... 9048 +| 3840: 02 02 01 02 02 01 04 76 74 61 62 07 03 04 01 40 .......vtab....@ 9049 +| 3856: 04 01 02 04 11 01 78 01 06 01 01 02 01 06 01 01 ......x......... 9050 +| 3872: 02 01 06 01 00 02 01 06 01 01 02 01 03 91 01 02 ................ 9051 +| 3888: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................ 9052 +| 3904: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................ 9053 +| 3920: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................ 9054 +| 3936: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................ 9055 +| 3952: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................ 9056 +| 3968: 01 06 01 01 02 01 76 01 01 02 01 06 01 01 02 5c ......v......... 9057 +| 3984: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 11 06 ................ 9058 +| 4000: 01 02 02 01 06 08 11 02 01 06 01 01 02 01 06 01 ................ 9059 +| 4016: 01 02 01 06 01 01 02 01 06 01 01 02 01 05 01 01 ................ 9060 +| 4032: 02 01 06 01 01 02 01 06 01 01 02 04 15 13 0c 0c ................ 9061 +| 4048: 12 44 13 11 0f 47 13 0f 0c 0e 11 10 ca 0e 10 0f .D...G.......... 9062 +| 4064: 44 0f 10 40 15 0f 07 01 03 00 14 24 5a 14 24 0f D..@.......$Z.$. 9063 +| 4080: 0a 03 00 24 ff ff ff ff 01 01 02 00 01 01 01 01 ...$............ 9064 +| page 4 offset 12288 9065 +| 0: 0a 00 00 00 01 0f fb 00 00 00 00 00 00 00 00 00 ................ 9066 +| 4080: 00 00 00 00 00 00 00 00 00 00 05 04 09 0c 01 02 ................ 9067 +| page 5 offset 16384 9068 +| 0: 0d 00 00 00 24 0c 09 00 00 00 00 00 00 00 00 00 ....$........... 9069 +| 3072: 00 00 00 00 00 00 00 00 00 00 18 24 05 00 25 0f ...........$..%. 9070 +| 3088: 19 54 48 52 45 41 44 53 41 46 45 3d 30 58 42 49 .THREADSAFE=0XBI 9071 +| 3104: 4e 41 52 59 18 23 05 00 25 0f 19 54 48 52 45 41 NARY.#..%..THREA 9072 +| 3120: 44 53 41 46 45 3d 30 58 4e 4f 43 41 53 47 17 22 DSAFE=0XNOCASG.. 9073 +| 3136: 05 00 25 0f 17 54 48 52 45 41 44 53 41 46 45 3d ..%..THREADSAFE= 9074 +| 3152: 30 58 52 54 52 49 4d 1f 21 05 00 33 0f 19 4f 4d 0XRTRIM.!..3..OM 9075 +| 3168: 49 54 20 4c 3f 41 44 20 45 58 54 45 4e 53 49 4f IT L?AD EXTENSIO 9076 +| 3184: 4e 58 42 49 4e 41 52 59 1f 20 05 00 33 0f 19 4f NXBINARY. ..3..O 9077 +| 3200: 4d 49 64 20 4c 4f 41 44 20 45 58 54 45 d9 53 49 MId LOAD EXTE.SI 9078 +| 3216: 4f 4e 58 4e 4f 43 41 53 45 1e 1f 05 00 33 0f 17 ONXNOCASE....3.. 9079 +| 3232: 4f 4d 39 54 20 4c 4f 41 44 20 45 58 55 45 4e 53 OM9T LOAD EXUENS 9080 +| 3248: 49 4f 4e 58 52 54 52 49 4d 1f 1e 05 00 33 0f 19 IONXRTRIM....3.. 9081 +| 3264: 4c 41 58 20 4d 45 4d 4f 52 59 3d 35 30 30 30 30 LAX MEMORY=50000 9082 +| 3280: 30 30 30 58 42 49 4e 41 52 59 1f 1d 05 00 33 0f 000XBINARY....3. 9083 +| 3296: 19 4d 41 58 20 4d 45 4d 4f 52 59 3d 35 30 30 30 .MAX MEMORY=5000 9084 +| 3312: 30 30 30 30 58 af 4f 43 41 53 45 1e 1c 05 00 33 0000X.OCASE....3 9085 +| 3328: 0f 17 4d 41 58 20 4d 45 4d 4f 52 59 3d 35 30 30 ..MAX MEMORY=500 9086 +| 3344: 30 30 ab 30 30 58 62 54 52 49 4d 18 1b 05 00 25 00.00XbTRIM....% 9087 +| 3360: 0f 19 45 4e 41 42 4c 45 20 52 54 52 45 45 58 42 ..ENABLE RTREEXB 9088 +| 3376: 49 4e 41 52 59 18 1b 05 00 25 0f 19 45 4e 41 42 INARY....%..ENAB 9089 +| 3392: 4c 45 20 52 54 52 45 45 58 4e 4f 43 41 53 45 17 LE RTREEXNOCASE. 9090 +| 3408: 19 05 00 25 0f 17 45 4e 41 42 4c 45 20 52 54 52 ...%..ENABLE RTR 9091 +| 3424: 45 45 58 52 54 52 49 4d 1a 18 05 00 29 0f 19 45 EEXRTRIM....)..E 9092 +| 3440: 4e 41 42 4c 45 20 4d 45 4d 53 59 63 35 58 42 49 NABLE MEMSYc5XBI 9093 +| 3456: 4e 41 52 59 1a 17 04 00 29 0f 19 45 4e 41 42 4c NARY....)..ENABL 9094 +| 3472: 45 20 4d 45 4d 53 59 53 35 58 4e 4f 43 41 53 45 E MEMSYS5XNOCASE 9095 +| 3488: 19 16 05 00 29 0f 17 45 4e 41 42 4c 45 20 3d 45 ....)..ENABLE =E 9096 +| 3504: 4d 53 59 53 35 58 52 54 52 49 4d 18 15 05 00 25 MSYS5XRTRIM....% 9097 +| 3520: 0f 19 45 4e 41 42 4c 45 20 4a 53 4f 4e 31 58 42 ..ENABLE JSON1XB 9098 +| 3536: 49 4e 41 52 59 18 14 05 00 25 0f 19 45 4e 41 42 INARY....%..ENAB 9099 +| 3552: 4c 46 20 4a 53 4f 4e 31 58 4e 4f 43 41 53 45 17 LF JSON1XNOCASE. 9100 +| 3568: 13 05 00 25 0f 17 45 4e 41 42 4c 45 20 4a 53 4f ...%..ENABLE JSO 9101 +| 3584: 4e 31 58 52 54 52 49 4d 1a 12 05 00 29 0f 19 45 N1XRTRIM....)..E 9102 +| 3600: 4e 41 42 4c 45 20 46 45 46 50 4f 4c 59 57 42 49 NABLE FEFPOLYWBI 9103 +| 3616: 4e 41 52 59 18 11 05 00 29 0f 19 45 4e 41 42 4c NARY....)..ENABL 9104 +| 3632: 45 20 47 45 4f 50 4f 4c 59 58 4e 5f 43 41 53 45 E GEOPOLYXN_CASE 9105 +| 3648: 19 10 05 00 29 0f 17 45 4e 41 42 4c 45 20 47 42 ....)..ENABLE GB 9106 +| 3664: 2f 50 4f 4c 59 58 51 54 52 49 4d 17 0f 05 00 23 /POLYXQTRIM....# 9107 +| 3680: 0f 19 45 4e 41 42 4c 45 20 46 54 53 35 58 42 49 ..ENABLE FTS5XBI 9108 +| 3696: 4e 41 52 59 17 0e 05 00 23 0f 19 45 4e 41 42 4c NARY....#..ENABL 9109 +| 3712: 45 20 46 54 53 35 58 4e 4f 43 41 53 45 16 0d 05 E FTS5XNOCASE... 9110 +| 3728: 00 23 0f 17 45 4e 41 42 4c 45 20 46 54 53 35 58 .#..ENABLE FTS5X 9111 +| 3744: 52 54 52 49 4d 17 1c 05 00 23 0f 19 45 4e 41 42 RTRIM....#..ENAB 9112 +| 3760: 4c 45 20 46 54 53 34 58 42 49 4e 41 52 59 16 0b LE FTS4XBINARY.. 9113 +| 3776: 05 00 22 0f e9 45 4e 41 42 4c 35 20 46 54 53 34 .....ENABL5 FTS4 9114 +| 3792: 58 4e 4f 43 41 53 45 16 0a 05 00 23 00 47 45 4e XNOCASE....#.GEN 9115 +| 3808: 41 42 4c 45 20 46 54 53 34 57 52 54 52 49 4d 1e ABLE FTS4WRTRIM. 9116 +| 3824: 60 05 00 31 0f 19 45 4e 41 42 4c 55 20 43 42 53 `..1..ENABLU CBS 9117 +| 3840: 54 41 54 20 56 54 42 42 58 42 49 4e 41 52 59 1e TAT VTBBXBINARY. 9118 +| 3856: 08 05 00 31 0f 19 45 4e 41 42 4c 45 20 44 42 53 ...1..ENABLE DBS 9119 +| 3872: 54 40 54 20 56 54 41 42 58 4e 4f 43 41 53 45 1d T@T VTABXNOCASE. 9120 +| 3888: 07 05 00 31 0f 17 45 4e 41 42 4c 55 20 44 42 53 ...1..ENABLU DBS 9121 +| 3904: 54 41 54 20 56 54 41 42 58 52 54 52 49 4d 12 06 TAT VTABXRTRIM.. 9122 +| 3920: 05 00 17 0f 19 44 45 42 55 47 58 42 49 4e 41 52 .....DEBUGXBINAR 9123 +| 3936: 59 21 05 05 00 17 0f 19 44 45 42 55 47 58 4e 4f Y!......DEBUGXNO 9124 +| 3952: 43 41 53 45 10 04 05 00 17 0f 18 44 45 42 55 47 CASE.......DEBUG 9125 +| 3968: 58 42 54 52 49 4d 27 11 05 00 43 0f 19 43 4f 4d XBTRIM'...C..COM 9126 +| 3984: 50 49 48 f5 52 3d 67 63 63 2d 35 2e 34 2e 30 20 PIH.R=gcc-5.4.0 9127 +| 4000: 32 30 31 36 30 36 30 39 58 42 49 4e 41 52 59 27 20160609XBINARY' 9128 +| 4016: 02 05 00 43 0f 19 43 4f 4d 50 49 4c 45 52 3d 67 ...C..COMPILER=g 9129 +| 4032: 63 63 2d 35 2e 34 2e 30 22 32 30 31 36 30 36 30 cc-5.4.0.2016060 9130 +| 4048: 39 c2 3e 4f 43 41 53 45 26 01 05 00 43 0f 17 43 9.>OCASE&...C..C 9131 +| 4064: 4f 4d 50 49 4c 45 52 3d 67 63 63 2d 35 2e 34 2e OMPILER=gcc-5.4. 9132 +| 4080: 30 30 32 30 31 26 30 36 30 39 58 52 54 52 49 4d 00201&0609XRTRIM 9133 +| page 6 offset 20480 9134 +| 0: 0d 00 00 00 24 0e e0 00 00 00 00 00 00 00 00 00 ....$........... 9135 +| 3808: 06 24 03 00 12 02 01 01 06 23 03 00 12 02 01 01 .$.......#...... 9136 +| 3824: 06 22 03 00 12 02 01 01 06 21 03 00 12 03 01 01 .........!...... 9137 +| 3840: 06 20 03 00 12 03 01 01 06 1f 03 00 12 03 01 01 . .............. 9138 +| 3856: 06 1e 03 00 12 03 01 01 06 1d 03 00 12 03 01 01 ................ 9139 +| 3872: 06 1c 03 00 12 03 01 01 06 1b 03 00 12 02 01 01 ................ 9140 +| 3888: 06 1a 03 00 12 02 01 01 06 19 03 00 12 02 01 01 ................ 9141 +| 3904: 06 18 03 00 12 02 01 00 f6 17 03 00 19 e2 f9 01 ................ 9142 +| 3920: 06 16 03 00 12 02 05 01 06 15 03 00 12 02 01 01 ................ 9143 +| 3936: 06 14 03 00 12 02 01 01 06 13 03 00 12 02 01 01 ................ 9144 +| 3952: 06 12 03 00 12 02 01 01 06 11 03 00 12 02 01 01 ................ 9145 +| 3968: 06 10 03 10 12 02 01 01 06 0f 03 00 12 02 01 01 ................ 9146 +| 3984: 06 0e 03 00 12 02 01 01 06 0d 03 00 12 02 00 f1 ................ 9147 +| 4000: 06 0c 03 00 12 02 01 01 06 0b 03 00 12 02 01 01 ................ 9148 +| 4016: 06 0a 03 00 12 02 01 01 05 09 03 00 12 03 01 01 ................ 9149 +| 4032: 06 08 03 00 12 03 01 01 06 07 03 00 12 03 01 01 ................ 9150 +| 4048: 06 06 03 00 12 01 01 01 06 05 02 ff 84 01 01 01 ................ 9151 +| 4064: 06 04 03 00 12 01 01 01 06 03 03 00 12 06 01 01 ................ 9152 +| 4080: 07 02 03 00 12 06 01 01 06 01 03 00 12 06 01 01 ................ 9153 +| page 7 offset 24576 9154 +| 0: 0a 00 00 00 01 0f f4 00 0f f4 00 00 00 00 00 00 ................ 9155 +| 4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04 ........version. 9156 +| end crash-44942694542e1e.db 9157 +}]} {} 9158 + 9159 +do_catchsql_test 62.1 { 9160 + WITH c(x) AS (VALUES(false) UNION ALL SELECT x+1 FROM c WHERE x<72) 9161 + INSERT INTO t1(a) SELECT randomblob(2829) FROM c; 9162 +} {0 {}} 8960 9163 8961 9164 sqlite3_fts5_may_be_corrupt 0 8962 9165 finish_test 8963 9166
Added ext/fts5/test/fts5corrupt4.test.
1 +# 2019 May 16 2 +# 3 +# The author disclaims copyright to this source code. In place of 4 +# a legal notice, here is a blessing: 5 +# 6 +# May you do good and not evil. 7 +# May you find forgiveness for yourself and forgive others. 8 +# May you share freely, never taking more than you give. 9 +# 10 +#*********************************************************************** 11 +# 12 +# 13 + 14 +source [file join [file dirname [info script]] fts5_common.tcl] 15 +set testprefix fts5corrupt4 16 + 17 +# If SQLITE_ENABLE_FTS5 is defined, omit this file. 18 +ifcapable !fts5 { 19 + finish_test 20 + return 21 +} 22 +sqlite3_fts5_may_be_corrupt 1 23 + 24 +do_execsql_test 1.0 { 25 + CREATE VIRTUAL TABLE ttt USING fts5(a, b); 26 + INSERT INTO ttt 27 + VALUES('e ee eee e ee eee e ee eee', 'eee ee e e e ee eee ee ee'); 28 + INSERT INTO ttt SELECT a||a, b||b FROM ttt; 29 + INSERT INTO ttt SELECT a||a, b||b FROM ttt; 30 +} 31 + 32 +proc mutate {blob i} { 33 + set o [expr {$i % [string length $blob]}] 34 + set a [string range $blob 0 $o-1] 35 + set b [string range $blob $o+1 end] 36 + set v [expr int(rand()*255) - 127] 37 + return "$a[binary format c $v]$b" 38 +} 39 +db func mutate mutate 40 + 41 +for {set j 1000} {$j <= 5000} {incr j 1000} { 42 + do_test 1.$j { 43 + for {set i 0} {$i < 1000} {incr i} { 44 + execsql { 45 + BEGIN; 46 + UPDATE ttt_data SET block = mutate(block, $i) WHERE id>10; 47 + } 48 + foreach sql { 49 + {SELECT snippet(ttt, -1, '.', '..', '[', ']'), * FROM ttt('e*')} 50 + {SELECT snippet(ttt, -1, '.', '..', '[', ']'), * FROM ttt('e* NOT ee*')} 51 + } { 52 + catch { execsql $sql } 53 + } 54 + execsql ROLLBACK 55 + } 56 + } {} 57 +} 58 + 59 +sqlite3_fts5_may_be_corrupt 0 60 +finish_test 61 +
Changes to ext/misc/blobio.c.
72 72 sqlite3_result_error(context, "cannot open BLOB pointer", -1); 73 73 return; 74 74 } 75 75 rc = sqlite3_blob_read(pBlob, aData, nData, iOfst); 76 76 sqlite3_blob_close(pBlob); 77 77 if( rc ){ 78 78 sqlite3_free(aData); 79 - sqlite3_result_error(context, "BLOB write failed", -1); 79 + sqlite3_result_error(context, "BLOB read failed", -1); 80 80 }else{ 81 81 sqlite3_result_blob(context, aData, nData, sqlite3_free); 82 82 } 83 83 } 84 84 85 85 static void writeblobFunc( 86 86 sqlite3_context *context,
Changes to ext/misc/fossildelta.c.
845 845 } 846 846 847 847 /* 848 848 ** Destructor for a deltaparsevtab_cursor. 849 849 */ 850 850 static int deltaparsevtabClose(sqlite3_vtab_cursor *cur){ 851 851 deltaparsevtab_cursor *pCur = (deltaparsevtab_cursor*)cur; 852 + sqlite3_free(pCur->aDelta); 852 853 sqlite3_free(pCur); 853 854 return SQLITE_OK; 854 855 } 855 856 856 857 857 858 /* 858 859 ** Advance a deltaparsevtab_cursor to its next row of output.
Changes to ext/misc/json1.c.
1119 1119 pRoot = &pParse->aNode[iRoot]; 1120 1120 j = 1; 1121 1121 } 1122 1122 if( pApnd ){ 1123 1123 u32 iStart, iLabel; 1124 1124 JsonNode *pNode; 1125 1125 iStart = jsonParseAddNode(pParse, JSON_OBJECT, 2, 0); 1126 - iLabel = jsonParseAddNode(pParse, JSON_STRING, i, zPath); 1126 + iLabel = jsonParseAddNode(pParse, JSON_STRING, nKey, zKey); 1127 1127 zPath += i; 1128 1128 pNode = jsonLookupAppend(pParse, zPath, pApnd, pzErr); 1129 1129 if( pParse->oom ) return 0; 1130 1130 if( pNode ){ 1131 1131 pRoot = &pParse->aNode[iRoot]; 1132 1132 pRoot->u.iAppend = iStart - iRoot; 1133 1133 pRoot->jnFlags |= JNODE_APPEND;
Changes to ext/session/sqlite3session.c.
1620 1620 if( sqlite3_stricmp(azCol[i], pTo->azCol[i]) ) bMismatch = 1; 1621 1621 if( abPK[i] ) bHasPk = 1; 1622 1622 } 1623 1623 } 1624 1624 } 1625 1625 sqlite3_free((char*)azCol); 1626 1626 if( bMismatch ){ 1627 + if( pzErrMsg ){ 1627 1628 *pzErrMsg = sqlite3_mprintf("table schemas do not match"); 1629 + } 1628 1630 rc = SQLITE_SCHEMA; 1629 1631 } 1630 1632 if( bHasPk==0 ){ 1631 1633 /* Ignore tables with no primary keys */ 1632 1634 goto diff_out; 1633 1635 } 1634 1636 } ................................................................................ 1826 1828 ** Ensure that there is room in the buffer to append nByte bytes of data. 1827 1829 ** If not, use sqlite3_realloc() to grow the buffer so that there is. 1828 1830 ** 1829 1831 ** If successful, return zero. Otherwise, if an OOM condition is encountered, 1830 1832 ** set *pRc to SQLITE_NOMEM and return non-zero. 1831 1833 */ 1832 1834 static int sessionBufferGrow(SessionBuffer *p, size_t nByte, int *pRc){ 1833 - if( *pRc==SQLITE_OK && p->nAlloc-p->nBuf<nByte ){ 1835 + if( *pRc==SQLITE_OK && (size_t)(p->nAlloc-p->nBuf)<nByte ){ 1834 1836 u8 *aNew; 1835 1837 i64 nNew = p->nAlloc ? p->nAlloc : 128; 1836 1838 do { 1837 1839 nNew = nNew*2; 1838 1840 }while( (nNew-p->nBuf)<nByte ); 1839 1841 1840 1842 aNew = (u8 *)sqlite3_realloc64(p->aBuf, nNew);
Changes to src/alter.c.
722 722 ** Walker callback used by sqlite3RenameExprUnmap(). 723 723 */ 724 724 static int renameUnmapExprCb(Walker *pWalker, Expr *pExpr){ 725 725 Parse *pParse = pWalker->pParse; 726 726 sqlite3RenameTokenRemap(pParse, 0, (void*)pExpr); 727 727 return WRC_Continue; 728 728 } 729 + 730 +/* 731 +** Walker callback used by sqlite3RenameExprUnmap(). 732 +*/ 733 +static int renameUnmapSelectCb(Walker *pWalker, Select *p){ 734 + Parse *pParse = pWalker->pParse; 735 + int i; 736 + if( ALWAYS(p->pEList) ){ 737 + ExprList *pList = p->pEList; 738 + for(i=0; i<pList->nExpr; i++){ 739 + if( pList->a[i].zName ){ 740 + sqlite3RenameTokenRemap(pParse, 0, (void*)pList->a[i].zName); 741 + } 742 + } 743 + } 744 + if( ALWAYS(p->pSrc) ){ /* Every Select as a SrcList, even if it is empty */ 745 + SrcList *pSrc = p->pSrc; 746 + for(i=0; i<pSrc->nSrc; i++){ 747 + sqlite3RenameTokenRemap(pParse, 0, (void*)pSrc->a[i].zName); 748 + } 749 + } 750 + return WRC_Continue; 751 +} 729 752 730 753 /* 731 754 ** Remove all nodes that are part of expression pExpr from the rename list. 732 755 */ 733 756 void sqlite3RenameExprUnmap(Parse *pParse, Expr *pExpr){ 734 757 Walker sWalker; 735 758 memset(&sWalker, 0, sizeof(Walker)); 736 759 sWalker.pParse = pParse; 737 760 sWalker.xExprCallback = renameUnmapExprCb; 761 + sWalker.xSelectCallback = renameUnmapSelectCb; 738 762 sqlite3WalkExpr(&sWalker, pExpr); 739 763 } 740 764 741 765 /* 742 766 ** Remove all nodes that are part of expression-list pEList from the 743 767 ** rename list. 744 768 */
Changes to src/btree.c.
5526 5526 ** 5527 5527 ** If the record is corrupt, the xRecordCompare routine may read 5528 5528 ** up to two varints past the end of the buffer. An extra 18 5529 5529 ** bytes of padding is allocated at the end of the buffer in 5530 5530 ** case this happens. */ 5531 5531 void *pCellKey; 5532 5532 u8 * const pCellBody = pCell - pPage->childPtrSize; 5533 + const int nOverrun = 18; /* Size of the overrun padding */ 5533 5534 pPage->xParseCell(pPage, pCellBody, &pCur->info); 5534 5535 nCell = (int)pCur->info.nKey; 5535 5536 testcase( nCell<0 ); /* True if key size is 2^32 or more */ 5536 5537 testcase( nCell==0 ); /* Invalid key size: 0x80 0x80 0x00 */ 5537 5538 testcase( nCell==1 ); /* Invalid key size: 0x80 0x80 0x01 */ 5538 5539 testcase( nCell==2 ); /* Minimum legal index key size */ 5539 5540 if( nCell<2 || nCell/pCur->pBt->usableSize>pCur->pBt->nPage ){ 5540 5541 rc = SQLITE_CORRUPT_PAGE(pPage); 5541 5542 goto moveto_finish; 5542 5543 } 5543 - pCellKey = sqlite3Malloc( nCell+18 ); 5544 + pCellKey = sqlite3Malloc( nCell+nOverrun ); 5544 5545 if( pCellKey==0 ){ 5545 5546 rc = SQLITE_NOMEM_BKPT; 5546 5547 goto moveto_finish; 5547 5548 } 5548 5549 pCur->ix = (u16)idx; 5549 5550 rc = accessPayload(pCur, 0, nCell, (unsigned char*)pCellKey, 0); 5551 + memset(((u8*)pCellKey)+nCell,0,nOverrun); /* Fix uninit warnings */ 5550 5552 pCur->curFlags &= ~BTCF_ValidOvfl; 5551 5553 if( rc ){ 5552 5554 sqlite3_free(pCellKey); 5553 5555 goto moveto_finish; 5554 5556 } 5555 5557 c = sqlite3VdbeRecordCompare(nCell, pCellKey, pIdxKey); 5556 5558 sqlite3_free(pCellKey);
Changes to src/build.c.
615 615 */ 616 616 static void SQLITE_NOINLINE deleteTable(sqlite3 *db, Table *pTable){ 617 617 Index *pIndex, *pNext; 618 618 619 619 #ifdef SQLITE_DEBUG 620 620 /* Record the number of outstanding lookaside allocations in schema Tables 621 621 ** prior to doing any free() operations. Since schema Tables do not use 622 - ** lookaside, this number should not change. */ 622 + ** lookaside, this number should not change. 623 + ** 624 + ** If malloc has already failed, it may be that it failed while allocating 625 + ** a Table object that was going to be marked ephemeral. So do not check 626 + ** that no lookaside memory is used in this case either. */ 623 627 int nLookaside = 0; 624 - if( db && (pTable->tabFlags & TF_Ephemeral)==0 ){ 628 + if( db && !db->mallocFailed && (pTable->tabFlags & TF_Ephemeral)==0 ){ 625 629 nLookaside = sqlite3LookasideUsed(db, 0); 626 630 } 627 631 #endif 628 632 629 633 /* Delete all indices associated with this table. */ 630 634 for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){ 631 635 pNext = pIndex->pNext; ................................................................................ 3046 3050 addr2 = sqlite3VdbeCurrentAddr(v); 3047 3051 sqlite3VdbeVerifyAbortable(v, OE_Abort); 3048 3052 sqlite3VdbeAddOp4Int(v, OP_SorterCompare, iSorter, j2, regRecord, 3049 3053 pIndex->nKeyCol); VdbeCoverage(v); 3050 3054 sqlite3UniqueConstraint(pParse, OE_Abort, pIndex); 3051 3055 sqlite3VdbeJumpHere(v, j2); 3052 3056 }else{ 3057 + /* Most CREATE INDEX and REINDEX statements that are not UNIQUE can not 3058 + ** abort. The exception is if one of the indexed expressions contains a 3059 + ** user function that throws an exception when it is evaluated. But the 3060 + ** overhead of adding a statement journal to a CREATE INDEX statement is 3061 + ** very small (since most of the pages written do not contain content that 3062 + ** needs to be restored if the statement aborts), so we call 3063 + ** sqlite3MayAbort() for all CREATE INDEX statements. */ 3064 + sqlite3MayAbort(pParse); 3053 3065 addr2 = sqlite3VdbeCurrentAddr(v); 3054 3066 } 3055 3067 sqlite3VdbeAddOp3(v, OP_SorterData, iSorter, regRecord, iIdx); 3056 3068 if( !pIndex->bAscKeyBug ){ 3057 3069 /* This OP_SeekEnd opcode makes index insert for a REINDEX go much 3058 3070 ** faster by avoiding unnecessary seeks. But the optimization does 3059 3071 ** not work for UNIQUE constraint indexes on WITHOUT ROWID tables
Changes to src/ctime.c.
10 10 ** 11 11 ************************************************************************* 12 12 ** 13 13 ** This file implements routines used to report what compile-time options 14 14 ** SQLite was built with. 15 15 */ 16 16 17 -#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS 17 +#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS /* IMP: R-16824-07538 */ 18 18 19 19 /* 20 20 ** Include the configuration header output by 'configure' if we're using the 21 21 ** autoconf-based build 22 22 */ 23 23 #if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H) 24 24 #include "config.h"
Changes to src/date.c.
384 384 double r; 385 385 if( parseYyyyMmDd(zDate,p)==0 ){ 386 386 return 0; 387 387 }else if( parseHhMmSs(zDate, p)==0 ){ 388 388 return 0; 389 389 }else if( sqlite3StrICmp(zDate,"now")==0 && sqlite3NotPureFunc(context) ){ 390 390 return setDateTimeToCurrent(context, p); 391 - }else if( sqlite3AtoF(zDate, &r, sqlite3Strlen30(zDate), SQLITE_UTF8) ){ 391 + }else if( sqlite3AtoF(zDate, &r, sqlite3Strlen30(zDate), SQLITE_UTF8)>0 ){ 392 392 setRawDateNumber(p, r); 393 393 return 0; 394 394 } 395 395 return 1; 396 396 } 397 397 398 398 /* The julian day number for 9999-12-31 23:59:59.999 is 5373484.4999999. ................................................................................ 718 718 ** weekday N 719 719 ** 720 720 ** Move the date to the same time on the next occurrence of 721 721 ** weekday N where 0==Sunday, 1==Monday, and so forth. If the 722 722 ** date is already on the appropriate weekday, this is a no-op. 723 723 */ 724 724 if( sqlite3_strnicmp(z, "weekday ", 8)==0 725 - && sqlite3AtoF(&z[8], &r, sqlite3Strlen30(&z[8]), SQLITE_UTF8) 725 + && sqlite3AtoF(&z[8], &r, sqlite3Strlen30(&z[8]), SQLITE_UTF8)>0 726 726 && (n=(int)r)==r && n>=0 && r<7 ){ 727 727 sqlite3_int64 Z; 728 728 computeYMD_HMS(p); 729 729 p->validTZ = 0; 730 730 p->validJD = 0; 731 731 computeJD(p); 732 732 Z = ((p->iJD + 129600000)/86400000) % 7; ................................................................................ 777 777 case '6': 778 778 case '7': 779 779 case '8': 780 780 case '9': { 781 781 double rRounder; 782 782 int i; 783 783 for(n=1; z[n] && z[n]!=':' && !sqlite3Isspace(z[n]); n++){} 784 - if( !sqlite3AtoF(z, &r, n, SQLITE_UTF8) ){ 784 + if( sqlite3AtoF(z, &r, n, SQLITE_UTF8)<=0 ){ 785 785 rc = 1; 786 786 break; 787 787 } 788 788 if( z[n]==':' ){ 789 789 /* A modifier of the form (+|-)HH:MM:SS.FFF adds (or subtracts) the 790 790 ** specified number of hours, minutes, seconds, and fractional seconds 791 791 ** to the time. The ".FFF" may be omitted. The ":SS.FFF" may be
Changes to src/expr.c.
40 40 ** CREATE TABLE t1(a); 41 41 ** SELECT * FROM t1 WHERE a; 42 42 ** SELECT a AS b FROM t1 WHERE b; 43 43 ** SELECT * FROM t1 WHERE (select a from t1); 44 44 */ 45 45 char sqlite3ExprAffinity(Expr *pExpr){ 46 46 int op; 47 - pExpr = sqlite3ExprSkipCollate(pExpr); 48 47 if( pExpr->flags & EP_Generic ) return 0; 48 + while( ExprHasProperty(pExpr, EP_Skip) ){ 49 + assert( pExpr->op==TK_COLLATE ); 50 + pExpr = pExpr->pLeft; 51 + assert( pExpr!=0 ); 52 + } 49 53 op = pExpr->op; 50 54 if( op==TK_SELECT ){ 51 55 assert( pExpr->flags&EP_xIsSelect ); 52 56 return sqlite3ExprAffinity(pExpr->x.pSelect->pEList->a[0].pExpr); 53 57 } 54 58 if( op==TK_REGISTER ) op = pExpr->op2; 55 59 #ifndef SQLITE_OMIT_CAST ................................................................................ 102 106 } 103 107 104 108 /* 105 109 ** Skip over any TK_COLLATE operators and any unlikely() 106 110 ** or likelihood() function at the root of an expression. 107 111 */ 108 112 Expr *sqlite3ExprSkipCollate(Expr *pExpr){ 109 - while( pExpr && ExprHasProperty(pExpr, EP_Skip) ){ 113 + while( pExpr && ExprHasProperty(pExpr, EP_Skip|EP_Unlikely) ){ 110 114 if( ExprHasProperty(pExpr, EP_Unlikely) ){ 111 115 assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); 112 116 assert( pExpr->x.pList->nExpr>0 ); 113 117 assert( pExpr->op==TK_FUNCTION ); 114 118 pExpr = pExpr->x.pList->a[0].pExpr; 115 119 }else{ 116 120 assert( pExpr->op==TK_COLLATE ); ................................................................................ 890 894 */ 891 895 Expr *sqlite3ExprAnd(Parse *pParse, Expr *pLeft, Expr *pRight){ 892 896 sqlite3 *db = pParse->db; 893 897 if( pLeft==0 ){ 894 898 return pRight; 895 899 }else if( pRight==0 ){ 896 900 return pLeft; 897 - }else if( pParse->nErr || IN_RENAME_OBJECT ){ 898 - return sqlite3PExpr(pParse, TK_AND, pLeft, pRight); 899 901 }else if( ExprAlwaysFalse(pLeft) || ExprAlwaysFalse(pRight) ){ 900 - sqlite3ExprDelete(db, pLeft); 901 - sqlite3ExprDelete(db, pRight); 902 + sqlite3ExprUnmapAndDelete(pParse, pLeft); 903 + sqlite3ExprUnmapAndDelete(pParse, pRight); 902 904 return sqlite3ExprAlloc(db, TK_INTEGER, &sqlite3IntTokens[0], 0); 903 905 }else{ 904 906 return sqlite3PExpr(pParse, TK_AND, pLeft, pRight); 905 907 } 906 908 } 907 909 908 910 /* ................................................................................ 1053 1055 if( !ExprHasProperty(p, EP_Static) ){ 1054 1056 sqlite3DbFreeNN(db, p); 1055 1057 } 1056 1058 } 1057 1059 void sqlite3ExprDelete(sqlite3 *db, Expr *p){ 1058 1060 if( p ) sqlite3ExprDeleteNN(db, p); 1059 1061 } 1062 + 1063 +/* Invoke sqlite3RenameExprUnmap() and sqlite3ExprDelete() on the 1064 +** expression. 1065 +*/ 1066 +void sqlite3ExprUnmapAndDelete(Parse *pParse, Expr *p){ 1067 + if( p ){ 1068 + if( IN_RENAME_OBJECT ){ 1069 + sqlite3RenameExprUnmap(pParse, p); 1070 + } 1071 + sqlite3ExprDeleteNN(pParse->db, p); 1072 + } 1073 +} 1060 1074 1061 1075 /* 1062 1076 ** Return the number of bytes allocated for the expression structure 1063 1077 ** passed as the first argument. This is always one of EXPR_FULLSIZE, 1064 1078 ** EXPR_REDUCEDSIZE or EXPR_TOKENONLYSIZE. 1065 1079 */ 1066 1080 static int exprStructSize(Expr *p){ ................................................................................ 1636 1650 1637 1651 /* Remember the size of the LHS in iTable so that we can check that 1638 1652 ** the RHS and LHS sizes match during code generation. */ 1639 1653 pFirst->iTable = pColumns->nId; 1640 1654 } 1641 1655 1642 1656 vector_append_error: 1643 - if( IN_RENAME_OBJECT ){ 1644 - sqlite3RenameExprUnmap(pParse, pExpr); 1645 - } 1646 - sqlite3ExprDelete(db, pExpr); 1657 + sqlite3ExprUnmapAndDelete(pParse, pExpr); 1647 1658 sqlite3IdListDelete(db, pColumns); 1648 1659 return pList; 1649 1660 } 1650 1661 1651 1662 /* 1652 1663 ** Set the sort order for the last element on the given ExprList. 1653 1664 */ ................................................................................ 1798 1809 } 1799 1810 1800 1811 /* 1801 1812 ** The argument must be a TK_TRUEFALSE Expr node. Return 1 if it is TRUE 1802 1813 ** and 0 if it is FALSE. 1803 1814 */ 1804 1815 int sqlite3ExprTruthValue(const Expr *pExpr){ 1816 + pExpr = sqlite3ExprSkipCollate((Expr*)pExpr); 1805 1817 assert( pExpr->op==TK_TRUEFALSE ); 1806 1818 assert( sqlite3StrICmp(pExpr->u.zToken,"true")==0 1807 1819 || sqlite3StrICmp(pExpr->u.zToken,"false")==0 ); 1808 1820 return pExpr->u.zToken[4]==0; 1809 1821 } 1810 1822 1811 1823 /* ................................................................................ 2804 2816 /* If the expression is not constant then we will need to 2805 2817 ** disable the test that was generated above that makes sure 2806 2818 ** this code only executes once. Because for a non-constant 2807 2819 ** expression we need to rerun this code each time. 2808 2820 */ 2809 2821 if( addrOnce && !sqlite3ExprIsConstant(pE2) ){ 2810 2822 sqlite3VdbeChangeToNoop(v, addrOnce); 2823 + ExprClearProperty(pExpr, EP_Subrtn); 2811 2824 addrOnce = 0; 2812 2825 } 2813 2826 2814 2827 /* Evaluate the expression and insert it into the temp table */ 2815 2828 r3 = sqlite3ExprCodeTarget(pParse, pE2, r1); 2816 2829 sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1); 2817 2830 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r2, r3, 1); ................................................................................ 3370 3383 } 3371 3384 3372 3385 /* 3373 3386 ** Convert a scalar expression node to a TK_REGISTER referencing 3374 3387 ** register iReg. The caller must ensure that iReg already contains 3375 3388 ** the correct value for the expression. 3376 3389 */ 3377 -static void exprToRegister(Expr *p, int iReg){ 3390 +static void exprToRegister(Expr *pExpr, int iReg){ 3391 + Expr *p = sqlite3ExprSkipCollate(pExpr); 3378 3392 p->op2 = p->op; 3379 3393 p->op = TK_REGISTER; 3380 3394 p->iTable = iReg; 3381 3395 ExprClearProperty(p, EP_Skip); 3382 3396 } 3383 3397 3384 3398 /* ................................................................................ 4857 4871 if( sqlite3ExprCompare(pParse, pA->pRight, pB->pRight, iTab) ) return 2; 4858 4872 if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2; 4859 4873 if( pA->op!=TK_STRING 4860 4874 && pA->op!=TK_TRUEFALSE 4861 4875 && (combinedFlags & EP_Reduced)==0 4862 4876 ){ 4863 4877 if( pA->iColumn!=pB->iColumn ) return 2; 4878 + if( pA->op2!=pB->op2 ) return 2; 4864 4879 if( pA->iTable!=pB->iTable 4865 4880 && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2; 4866 4881 } 4867 4882 } 4868 4883 return 0; 4869 4884 } 4870 4885
Changes to src/func.c.
383 383 } 384 384 if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return; 385 385 r = sqlite3_value_double(argv[0]); 386 386 /* If Y==0 and X will fit in a 64-bit int, 387 387 ** handle the rounding directly, 388 388 ** otherwise use printf. 389 389 */ 390 - if( n==0 && r>=0 && r<LARGEST_INT64-1 ){ 391 - r = (double)((sqlite_int64)(r+0.5)); 392 - }else if( n==0 && r<0 && (-r)<LARGEST_INT64-1 ){ 393 - r = -(double)((sqlite_int64)((-r)+0.5)); 390 + if( r<-4503599627370496.0 || r>+4503599627370496.0 ){ 391 + /* The value has no fractional part so there is nothing to round */ 392 + }else if( n==0 ){ 393 + r = (double)((sqlite_int64)(r+(r<0?-0.5:+0.5))); 394 394 }else{ 395 395 zBuf = sqlite3_mprintf("%.*f",n,r); 396 396 if( zBuf==0 ){ 397 397 sqlite3_result_error_nomem(context); 398 398 return; 399 399 } 400 - if( !sqlite3AtoF(zBuf, &r, sqlite3Strlen30(zBuf), SQLITE_UTF8) ){ 401 - assert( sqlite3_strglob("*Inf", zBuf)==0 ); 402 - r = zBuf[0]=='-' ? -HUGE_VAL : +HUGE_VAL; 403 - } 400 + sqlite3AtoF(zBuf, &r, sqlite3Strlen30(zBuf), SQLITE_UTF8); 404 401 sqlite3_free(zBuf); 405 402 } 406 403 sqlite3_result_double(context, r); 407 404 } 408 405 #endif 409 406 410 407 /*
Changes to src/global.c.
149 149 # endif 150 150 #endif 151 151 152 152 /* EVIDENCE-OF: R-38720-18127 The default setting is determined by the 153 153 ** SQLITE_ALLOW_COVERING_INDEX_SCAN compile-time option, or is "on" if 154 154 ** that compile-time option is omitted. 155 155 */ 156 -#ifndef SQLITE_ALLOW_COVERING_INDEX_SCAN 156 +#if !defined(SQLITE_ALLOW_COVERING_INDEX_SCAN) 157 157 # define SQLITE_ALLOW_COVERING_INDEX_SCAN 1 158 +#else 159 +# if !SQLITE_ALLOW_COVERING_INDEX_SCAN 160 +# error "Compile-time disabling of covering index scan using the\ 161 + -DSQLITE_ALLOW_COVERING_INDEX_SCAN=0 option is deprecated.\ 162 + Contact SQLite developers if this is a problem for you, and\ 163 + delete this #error macro to continue with your build." 164 +# endif 158 165 #endif 159 166 160 167 /* The minimum PMA size is set to this value multiplied by the database 161 168 ** page size in bytes. 162 169 */ 163 170 #ifndef SQLITE_SORTER_PMASZ 164 171 # define SQLITE_SORTER_PMASZ 250
Changes to src/insert.c.
1421 1421 sqlite3VdbeVerifyAbortable(v, onError); 1422 1422 sqlite3ExprIfTrue(pParse, pExpr, allOk, SQLITE_JUMPIFNULL); 1423 1423 if( onError==OE_Ignore ){ 1424 1424 sqlite3VdbeGoto(v, ignoreDest); 1425 1425 }else{ 1426 1426 char *zName = pCheck->a[i].zName; 1427 1427 if( zName==0 ) zName = pTab->zName; 1428 - if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-15569-63625 */ 1428 + if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-26383-51744 */ 1429 1429 sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_CHECK, 1430 1430 onError, zName, P4_TRANSIENT, 1431 1431 P5_ConstraintCheck); 1432 1432 } 1433 1433 sqlite3VdbeResolveLabel(v, allOk); 1434 1434 } 1435 1435 pParse->iSelfTab = 0;
Changes to src/main.c.
844 844 { SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE, SQLITE_NoCkptOnClose }, 845 845 { SQLITE_DBCONFIG_ENABLE_QPSG, SQLITE_EnableQPSG }, 846 846 { SQLITE_DBCONFIG_TRIGGER_EQP, SQLITE_TriggerEQP }, 847 847 { SQLITE_DBCONFIG_RESET_DATABASE, SQLITE_ResetDatabase }, 848 848 { SQLITE_DBCONFIG_DEFENSIVE, SQLITE_Defensive }, 849 849 { SQLITE_DBCONFIG_WRITABLE_SCHEMA, SQLITE_WriteSchema| 850 850 SQLITE_NoSchemaError }, 851 + { SQLITE_DBCONFIG_LEGACY_ALTER_TABLE, SQLITE_LegacyAlter }, 852 + { SQLITE_DBCONFIG_DQS_DDL, SQLITE_DqsDDL }, 853 + { SQLITE_DBCONFIG_DQS_DML, SQLITE_DqsDML }, 851 854 }; 852 855 unsigned int i; 853 856 rc = SQLITE_ERROR; /* IMP: R-42790-23372 */ 854 857 for(i=0; i<ArraySize(aFlagOp); i++){ 855 858 if( aFlagOp[i].op==op ){ 856 859 int onoff = va_arg(ap, int); 857 860 int *pRes = va_arg(ap, int*); ................................................................................ 874 877 break; 875 878 } 876 879 } 877 880 va_end(ap); 878 881 return rc; 879 882 } 880 883 881 - 882 -/* 883 -** Return true if the buffer z[0..n-1] contains all spaces. 884 -*/ 885 -static int allSpaces(const char *z, int n){ 886 - while( n>0 && z[n-1]==' ' ){ n--; } 887 - return n==0; 888 -} 889 - 890 884 /* 891 885 ** This is the default collating function named "BINARY" which is always 892 886 ** available. 893 -** 894 -** If the padFlag argument is not NULL then space padding at the end 895 -** of strings is ignored. This implements the RTRIM collation. 896 887 */ 897 888 static int binCollFunc( 898 - void *padFlag, 889 + void *NotUsed, 899 890 int nKey1, const void *pKey1, 900 891 int nKey2, const void *pKey2 901 892 ){ 902 893 int rc, n; 894 + UNUSED_PARAMETER(NotUsed); 903 895 n = nKey1<nKey2 ? nKey1 : nKey2; 904 896 /* EVIDENCE-OF: R-65033-28449 The built-in BINARY collation compares 905 897 ** strings byte by byte using the memcmp() function from the standard C 906 898 ** library. */ 907 899 assert( pKey1 && pKey2 ); 908 900 rc = memcmp(pKey1, pKey2, n); 909 901 if( rc==0 ){ 910 - if( padFlag 911 - && allSpaces(((char*)pKey1)+n, nKey1-n) 912 - && allSpaces(((char*)pKey2)+n, nKey2-n) 913 - ){ 914 - /* EVIDENCE-OF: R-31624-24737 RTRIM is like BINARY except that extra 915 - ** spaces at the end of either string do not change the result. In other 916 - ** words, strings will compare equal to one another as long as they 917 - ** differ only in the number of spaces at the end. 918 - */ 919 - }else{ 920 902 rc = nKey1 - nKey2; 921 903 } 904 + return rc; 922 905 } 923 - return rc; 906 + 907 +/* 908 +** This is the collating function named "RTRIM" which is always 909 +** available. Ignore trailing spaces. 910 +*/ 911 +static int rtrimCollFunc( 912 + void *pUser, 913 + int nKey1, const void *pKey1, 914 + int nKey2, const void *pKey2 915 +){ 916 + const u8 *pK1 = (const u8*)pKey1; 917 + const u8 *pK2 = (const u8*)pKey2; 918 + while( nKey1 && pK1[nKey1-1]==' ' ) nKey1--; 919 + while( nKey2 && pK2[nKey2-1]==' ' ) nKey2--; 920 + return binCollFunc(pUser, nKey1, pKey1, nKey2, pKey2); 924 921 } 925 922 926 923 /* 927 924 ** Return true if CollSeq is the default built-in BINARY. 928 925 */ 929 926 int sqlite3IsBinary(const CollSeq *p){ 930 - assert( p==0 || p->xCmp!=binCollFunc || p->pUser!=0 931 - || strcmp(p->zName,"BINARY")==0 ); 932 - return p==0 || (p->xCmp==binCollFunc && p->pUser==0); 927 + assert( p==0 || p->xCmp!=binCollFunc || strcmp(p->zName,"BINARY")==0 ); 928 + return p==0 || p->xCmp==binCollFunc; 933 929 } 934 930 935 931 /* 936 932 ** Another built-in collating sequence: NOCASE. 937 933 ** 938 934 ** This collating sequence is intended to be used for "case independent 939 935 ** comparison". SQLite's knowledge of upper and lower case equivalents ................................................................................ 3170 3166 memcpy(db->aLimit, aHardLimit, sizeof(db->aLimit)); 3171 3167 db->aLimit[SQLITE_LIMIT_WORKER_THREADS] = SQLITE_DEFAULT_WORKER_THREADS; 3172 3168 db->autoCommit = 1; 3173 3169 db->nextAutovac = -1; 3174 3170 db->szMmap = sqlite3GlobalConfig.szMmap; 3175 3171 db->nextPagesize = 0; 3176 3172 db->nMaxSorterMmap = 0x7FFFFFFF; 3177 - db->flags |= SQLITE_ShortColNames | SQLITE_EnableTrigger | SQLITE_CacheSpill 3173 + db->flags |= SQLITE_ShortColNames 3174 + | SQLITE_EnableTrigger 3175 + | SQLITE_CacheSpill 3176 + 3177 +/* The SQLITE_DQS compile-time option determines the default settings 3178 +** for SQLITE_DBCONFIG_DQS_DDL and SQLITE_DBCONFIG_DQS_DML. 3179 +** 3180 +** SQLITE_DQS SQLITE_DBCONFIG_DQS_DDL SQLITE_DBCONFIG_DQS_DML 3181 +** ---------- ----------------------- ----------------------- 3182 +** undefined on on 3183 +** 3 on on 3184 +** 2 on off 3185 +** 1 off on 3186 +** 0 off off 3187 +** 3188 +** Legacy behavior is 3 (double-quoted string literals are allowed anywhere) 3189 +** and so that is the default. But developers are encouranged to use 3190 +** -DSQLITE_DQS=0 (best) or -DSQLITE_DQS=1 (second choice) if possible. 3191 +*/ 3192 +#if !defined(SQLITE_DQS) 3193 +# define SQLITE_DQS 3 3194 +#endif 3195 +#if (SQLITE_DQS&1)==1 3196 + | SQLITE_DqsDML 3197 +#endif 3198 +#if (SQLITE_DQS&2)==2 3199 + | SQLITE_DqsDDL 3200 +#endif 3201 + 3178 3202 #if !defined(SQLITE_DEFAULT_AUTOMATIC_INDEX) || SQLITE_DEFAULT_AUTOMATIC_INDEX 3179 3203 | SQLITE_AutoIndex 3180 3204 #endif 3181 3205 #if SQLITE_DEFAULT_CKPTFULLFSYNC 3182 3206 | SQLITE_CkptFullFSync 3183 3207 #endif 3184 3208 #if SQLITE_DEFAULT_FILE_FORMAT<4 ................................................................................ 3221 3245 ** EVIDENCE-OF: R-52786-44878 SQLite defines three built-in collating 3222 3246 ** functions: 3223 3247 */ 3224 3248 createCollation(db, sqlite3StrBINARY, SQLITE_UTF8, 0, binCollFunc, 0); 3225 3249 createCollation(db, sqlite3StrBINARY, SQLITE_UTF16BE, 0, binCollFunc, 0); 3226 3250 createCollation(db, sqlite3StrBINARY, SQLITE_UTF16LE, 0, binCollFunc, 0); 3227 3251 createCollation(db, "NOCASE", SQLITE_UTF8, 0, nocaseCollatingFunc, 0); 3228 - createCollation(db, "RTRIM", SQLITE_UTF8, (void*)1, binCollFunc, 0); 3252 + createCollation(db, "RTRIM", SQLITE_UTF8, 0, rtrimCollFunc, 0); 3229 3253 if( db->mallocFailed ){ 3230 3254 goto opendb_out; 3231 3255 } 3232 3256 /* EVIDENCE-OF: R-08308-17224 The default collating function for all 3233 3257 ** strings is BINARY. 3234 3258 */ 3235 3259 db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, sqlite3StrBINARY, 0);
Changes to src/parse.y.
297 297 // post-processing, if needed. 298 298 // 299 299 %type scanpt {const char*} 300 300 scanpt(A) ::= . { 301 301 assert( yyLookahead!=YYNOCODE ); 302 302 A = yyLookaheadToken.z; 303 303 } 304 +scantok(A) ::= . { 305 + assert( yyLookahead!=YYNOCODE ); 306 + A = yyLookaheadToken; 307 +} 304 308 305 309 // "carglist" is a list of additional constraints that come after the 306 310 // column name and column type in a CREATE TABLE statement. 307 311 // 308 312 carglist ::= carglist ccons. 309 313 carglist ::= . 310 314 ccons ::= CONSTRAINT nm(X). {pParse->constraintName = X;} 311 -ccons ::= DEFAULT scanpt(A) term(X) scanpt(Z). 312 - {sqlite3AddDefaultValue(pParse,X,A,Z);} 315 +ccons ::= DEFAULT scantok(A) term(X). 316 + {sqlite3AddDefaultValue(pParse,X,A.z,&A.z[A.n]);} 313 317 ccons ::= DEFAULT LP(A) expr(X) RP(Z). 314 318 {sqlite3AddDefaultValue(pParse,X,A.z+1,Z.z);} 315 -ccons ::= DEFAULT PLUS(A) term(X) scanpt(Z). 316 - {sqlite3AddDefaultValue(pParse,X,A.z,Z);} 317 -ccons ::= DEFAULT MINUS(A) term(X) scanpt(Z). { 319 +ccons ::= DEFAULT PLUS(A) scantok(Z) term(X). 320 + {sqlite3AddDefaultValue(pParse,X,A.z,&Z.z[Z.n]);} 321 +ccons ::= DEFAULT MINUS(A) scantok(Z) term(X). { 318 322 Expr *p = sqlite3PExpr(pParse, TK_UMINUS, X, 0); 319 - sqlite3AddDefaultValue(pParse,p,A.z,Z); 323 + sqlite3AddDefaultValue(pParse,p,A.z,&Z.z[Z.n]); 320 324 } 321 -ccons ::= DEFAULT scanpt id(X). { 325 +ccons ::= DEFAULT scantok id(X). { 322 326 Expr *p = tokenExpr(pParse, TK_STRING, X); 323 327 if( p ){ 324 328 sqlite3ExprIdToTrueFalse(p); 325 329 testcase( p->op==TK_TRUEFALSE && sqlite3ExprTruthValue(p) ); 326 330 } 327 331 sqlite3AddDefaultValue(pParse,p,X.z,X.z+X.n); 328 332 } ................................................................................ 1165 1169 ** 1166 1170 ** expr1 IN () 1167 1171 ** expr1 NOT IN () 1168 1172 ** 1169 1173 ** simplify to constants 0 (false) and 1 (true), respectively, 1170 1174 ** regardless of the value of expr1. 1171 1175 */ 1172 - if( IN_RENAME_OBJECT==0 ){ 1173 - sqlite3ExprDelete(pParse->db, A); 1176 + sqlite3ExprUnmapAndDelete(pParse, A); 1174 1177 A = sqlite3ExprAlloc(pParse->db, TK_INTEGER,&sqlite3IntTokens[N],1); 1175 - } 1176 1178 }else if( Y->nExpr==1 ){ 1177 1179 /* Expressions of the form: 1178 1180 ** 1179 1181 ** expr1 IN (?1) 1180 1182 ** expr1 NOT IN (?2) 1181 1183 ** 1182 1184 ** with exactly one value on the RHS can be simplified to something
Changes to src/pcache.c.
239 239 */ 240 240 static int numberOfCachePages(PCache *p){ 241 241 if( p->szCache>=0 ){ 242 242 /* IMPLEMENTATION-OF: R-42059-47211 If the argument N is positive then the 243 243 ** suggested cache size is set to N. */ 244 244 return p->szCache; 245 245 }else{ 246 - /* IMPLEMENTATION-OF: R-61436-13639 If the argument N is negative, then 247 - ** the number of cache pages is adjusted to use approximately abs(N*1024) 248 - ** bytes of memory. */ 246 + /* IMPLEMANTATION-OF: R-59858-46238 If the argument N is negative, then the 247 + ** number of cache pages is adjusted to be a number of pages that would 248 + ** use approximately abs(N*1024) bytes of memory based on the current 249 + ** page size. */ 249 250 return (int)((-1024*(i64)p->szCache)/(p->szPage+p->szExtra)); 250 251 } 251 252 } 252 253 253 254 /*************************************************** General Interfaces ****** 254 255 ** 255 256 ** Initialize and shutdown the page cache subsystem. Neither of these
Changes to src/pcache1.c.
773 773 if( pCache ){ 774 774 if( pcache1.separateCache ){ 775 775 pGroup = (PGroup*)&pCache[1]; 776 776 pGroup->mxPinned = 10; 777 777 }else{ 778 778 pGroup = &pcache1.grp; 779 779 } 780 + pcache1EnterMutex(pGroup); 780 781 if( pGroup->lru.isAnchor==0 ){ 781 782 pGroup->lru.isAnchor = 1; 782 783 pGroup->lru.pLruPrev = pGroup->lru.pLruNext = &pGroup->lru; 783 784 } 784 785 pCache->pGroup = pGroup; 785 786 pCache->szPage = szPage; 786 787 pCache->szExtra = szExtra; 787 788 pCache->szAlloc = szPage + szExtra + ROUND8(sizeof(PgHdr1)); 788 789 pCache->bPurgeable = (bPurgeable ? 1 : 0); 789 - pcache1EnterMutex(pGroup); 790 790 pcache1ResizeHash(pCache); 791 791 if( bPurgeable ){ 792 792 pCache->nMin = 10; 793 793 pGroup->nMinPage += pCache->nMin; 794 794 pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage; 795 795 pCache->pnPurgeable = &pGroup->nPurgeable; 796 796 }else{
Changes to src/pragma.c.
640 640 if( sqlite3StrNICmp(zRight, zMode, n)==0 ) break; 641 641 } 642 642 if( !zMode ){ 643 643 /* If the "=MODE" part does not match any known journal mode, 644 644 ** then do a query */ 645 645 eMode = PAGER_JOURNALMODE_QUERY; 646 646 } 647 + if( eMode==PAGER_JOURNALMODE_OFF && (db->flags & SQLITE_Defensive)!=0 ){ 648 + /* Do not allow journal-mode "OFF" in defensive since the database 649 + ** can become corrupted using ordinary SQL when the journal is off */ 650 + eMode = PAGER_JOURNALMODE_QUERY; 651 + } 647 652 } 648 653 if( eMode==PAGER_JOURNALMODE_QUERY && pId2->n==0 ){ 649 654 /* Convert "PRAGMA journal_mode" into "PRAGMA main.journal_mode" */ 650 655 iDb = 0; 651 656 pId2->n = 1; 652 657 } 653 658 for(ii=db->nDb-1; ii>=0; ii--){ ................................................................................ 2121 2126 ** hexkey 2 2122 2127 ** hexrekey 3 2123 2128 ** textkey 4 2124 2129 ** textrekey 5 2125 2130 */ 2126 2131 case PragTyp_KEY: { 2127 2132 if( zRight ){ 2128 - int n = pPragma->iArg<4 ? sqlite3Strlen30(zRight) : -1; 2129 - if( (pPragma->iArg & 1)==0 ){ 2130 - sqlite3_key_v2(db, zDb, zRight, n); 2131 - }else{ 2132 - sqlite3_rekey_v2(db, zDb, zRight, n); 2133 - } 2134 - } 2135 - break; 2136 - } 2137 - case PragTyp_HEXKEY: { 2138 - if( zRight ){ 2133 + char zBuf[40]; 2134 + const char *zKey = zRight; 2135 + int n; 2136 + if( pPragma->iArg==2 || pPragma->iArg==3 ){ 2139 2137 u8 iByte; 2140 2138 int i; 2141 - char zKey[40]; 2142 - for(i=0, iByte=0; i<sizeof(zKey)*2 && sqlite3Isxdigit(zRight[i]); i++){ 2139 + for(i=0, iByte=0; i<sizeof(zBuf)*2 && sqlite3Isxdigit(zRight[i]); i++){ 2143 2140 iByte = (iByte<<4) + sqlite3HexToInt(zRight[i]); 2144 - if( (i&1)!=0 ) zKey[i/2] = iByte; 2141 + if( (i&1)!=0 ) zBuf[i/2] = iByte; 2142 + } 2143 + zKey = zBuf; 2144 + n = i/2; 2145 + }else{ 2146 + n = pPragma->iArg<4 ? sqlite3Strlen30(zRight) : -1; 2145 2147 } 2146 2148 if( (pPragma->iArg & 1)==0 ){ 2147 - sqlite3_key_v2(db, zDb, zKey, i/2); 2149 + rc = sqlite3_key_v2(db, zDb, zKey, n); 2148 2150 }else{ 2149 - sqlite3_rekey_v2(db, zDb, zKey, i/2); 2151 + rc = sqlite3_rekey_v2(db, zDb, zKey, n); 2152 + } 2153 + if( rc==SQLITE_OK && n!=0 ){ 2154 + sqlite3VdbeSetNumCols(v, 1); 2155 + sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "ok", SQLITE_STATIC); 2156 + returnSingleText(v, "ok"); 2150 2157 } 2151 2158 } 2152 2159 break; 2153 2160 } 2154 2161 #endif 2155 2162 #if defined(SQLITE_HAS_CODEC) || defined(SQLITE_ENABLE_CEROD) 2156 2163 case PragTyp_ACTIVATE_EXTENSIONS: if( zRight ){
Changes to src/pragma.h.
42 42 #define PragTyp_TABLE_INFO 34 43 43 #define PragTyp_TEMP_STORE 35 44 44 #define PragTyp_TEMP_STORE_DIRECTORY 36 45 45 #define PragTyp_THREADS 37 46 46 #define PragTyp_WAL_AUTOCHECKPOINT 38 47 47 #define PragTyp_WAL_CHECKPOINT 39 48 48 #define PragTyp_ACTIVATE_EXTENSIONS 40 49 -#define PragTyp_HEXKEY 41 50 -#define PragTyp_KEY 42 51 -#define PragTyp_LOCK_STATUS 43 52 -#define PragTyp_STATS 44 49 +#define PragTyp_KEY 41 50 +#define PragTyp_LOCK_STATUS 42 51 +#define PragTyp_STATS 43 53 52 54 53 /* Property flags associated with various pragma. */ 55 54 #define PragFlg_NeedSchema 0x01 /* Force schema load before running */ 56 55 #define PragFlg_NoColumns 0x02 /* OP_ResultRow called with zero columns */ 57 56 #define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */ 58 57 #define PragFlg_ReadOnly 0x08 /* Read-only HEADER_VALUE */ 59 58 #define PragFlg_Result0 0x10 /* Acts as query when no argument */ ................................................................................ 318 317 /* ePragFlg: */ PragFlg_Result0, 319 318 /* ColNames: */ 41, 2, 320 319 /* iArg: */ 0 }, 321 320 #endif 322 321 #endif 323 322 #if defined(SQLITE_HAS_CODEC) 324 323 {/* zName: */ "hexkey", 325 - /* ePragTyp: */ PragTyp_HEXKEY, 324 + /* ePragTyp: */ PragTyp_KEY, 326 325 /* ePragFlg: */ 0, 327 326 /* ColNames: */ 0, 0, 328 327 /* iArg: */ 2 }, 329 328 {/* zName: */ "hexrekey", 330 - /* ePragTyp: */ PragTyp_HEXKEY, 329 + /* ePragTyp: */ PragTyp_KEY, 331 330 /* ePragFlg: */ 0, 332 331 /* ColNames: */ 0, 0, 333 332 /* iArg: */ 3 }, 334 333 #endif 335 334 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS) 336 335 #if !defined(SQLITE_OMIT_CHECK) 337 336 {/* zName: */ "ignore_check_constraints",
Changes to src/printf.c.
95 95 96 96 /* All the rest are undocumented and are for internal use only */ 97 97 { 'T', 0, 0, etTOKEN, 0, 0 }, 98 98 { 'S', 0, 0, etSRCLIST, 0, 0 }, 99 99 { 'r', 10, 1, etORDINAL, 0, 0 }, 100 100 }; 101 101 102 +/* Floating point constants used for rounding */ 103 +static const double arRound[] = { 104 + 5.0e-01, 5.0e-02, 5.0e-03, 5.0e-04, 5.0e-05, 105 + 5.0e-06, 5.0e-07, 5.0e-08, 5.0e-09, 5.0e-10, 106 +}; 107 + 102 108 /* 103 109 ** If SQLITE_OMIT_FLOATING_POINT is defined, then none of the floating point 104 110 ** conversions will work. 105 111 */ 106 112 #ifndef SQLITE_OMIT_FLOATING_POINT 107 113 /* 108 114 ** "*val" is a double such that 0.1 <= *val < 10.0 ................................................................................ 513 519 realvalue = -realvalue; 514 520 prefix = '-'; 515 521 }else{ 516 522 prefix = flag_prefix; 517 523 } 518 524 if( xtype==etGENERIC && precision>0 ) precision--; 519 525 testcase( precision>0xfff ); 520 - for(idx=precision&0xfff, rounder=0.5; idx>0; idx--, rounder*=0.1){} 521 - if( xtype==etFLOAT ) realvalue += rounder; 526 + idx = precision & 0xfff; 527 + rounder = arRound[idx%10]; 528 + while( idx>=10 ){ rounder *= 1.0e-10; idx -= 10; } 529 + if( xtype==etFLOAT ){ 530 + double rx = (double)realvalue; 531 + sqlite3_uint64 u; 532 + int ex; 533 + memcpy(&u, &rx, sizeof(u)); 534 + ex = -1023 + (int)((u>>52)&0x7ff); 535 + if( precision+(ex/3) < 15 ) rounder += realvalue*3e-16; 536 + realvalue += rounder; 537 + } 522 538 /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */ 523 539 exp = 0; 524 540 if( sqlite3IsNaN((double)realvalue) ){ 525 541 bufpt = "NaN"; 526 542 length = 3; 527 543 break; 528 544 }
Changes to src/resolve.c.
143 143 } 144 144 zSpan += n+1; 145 145 if( zCol && sqlite3StrICmp(zSpan, zCol)!=0 ){ 146 146 return 0; 147 147 } 148 148 return 1; 149 149 } 150 + 151 +/* 152 +** Return TRUE if the double-quoted string mis-feature should be supported. 153 +*/ 154 +static int areDoubleQuotedStringsEnabled(sqlite3 *db, NameContext *pTopNC){ 155 + if( db->init.busy ) return 1; /* Always support for legacy schemas */ 156 + if( pTopNC->ncFlags & NC_IsDDL ){ 157 + /* Currently parsing a DDL statement */ 158 + if( sqlite3WritableSchema(db) && (db->flags & SQLITE_DqsDML)!=0 ){ 159 + return 1; 160 + } 161 + return (db->flags & SQLITE_DqsDDL)!=0; 162 + }else{ 163 + /* Currently parsing a DML statement */ 164 + return (db->flags & SQLITE_DqsDML)!=0; 165 + } 166 +} 150 167 151 168 /* 152 169 ** Given the name of a column of the form X.Y.Z or Y.Z or just Z, look up 153 170 ** that name in the set of source tables in pSrcList and make the pExpr 154 171 ** expression node refer back to that source column. The following changes 155 172 ** are made to pExpr: 156 173 ** ................................................................................ 472 489 ** pExpr. 473 490 ** 474 491 ** Because no reference was made to outer contexts, the pNC->nRef 475 492 ** fields are not changed in any context. 476 493 */ 477 494 if( cnt==0 && zTab==0 ){ 478 495 assert( pExpr->op==TK_ID ); 479 - if( ExprHasProperty(pExpr,EP_DblQuoted) ){ 496 + if( ExprHasProperty(pExpr,EP_DblQuoted) 497 + && areDoubleQuotedStringsEnabled(db, pTopNC) 498 + ){ 480 499 /* If a double-quoted identifier does not match any known column name, 481 500 ** then treat it as a string. 482 501 ** 483 502 ** This hack was added in the early days of SQLite in a misguided attempt 484 503 ** to be compatible with MySQL 3.x, which used double-quotes for strings. 485 504 ** I now sorely regret putting in this hack. The effect of this hack is 486 505 ** that misspelled identifier names are silently converted into strings ................................................................................ 741 760 no_such_func = 1; 742 761 }else{ 743 762 wrong_num_args = 1; 744 763 } 745 764 }else{ 746 765 is_agg = pDef->xFinalize!=0; 747 766 if( pDef->funcFlags & SQLITE_FUNC_UNLIKELY ){ 748 - ExprSetProperty(pExpr, EP_Unlikely|EP_Skip); 767 + ExprSetProperty(pExpr, EP_Unlikely); 749 768 if( n==2 ){ 750 769 pExpr->iTable = exprProbability(pList->a[1].pExpr); 751 770 if( pExpr->iTable<0 ){ 752 771 sqlite3ErrorMsg(pParse, 753 772 "second argument to likelihood() must be a " 754 773 "constant between 0.0 and 1.0"); 755 774 pNC->nErr++; ................................................................................ 924 943 } 925 944 case TK_VARIABLE: { 926 945 notValid(pParse, pNC, "parameters", NC_IsCheck|NC_PartIdx|NC_IdxExpr); 927 946 break; 928 947 } 929 948 case TK_IS: 930 949 case TK_ISNOT: { 931 - Expr *pRight; 950 + Expr *pRight = sqlite3ExprSkipCollate(pExpr->pRight); 932 951 assert( !ExprHasProperty(pExpr, EP_Reduced) ); 933 952 /* Handle special cases of "x IS TRUE", "x IS FALSE", "x IS NOT TRUE", 934 953 ** and "x IS NOT FALSE". */ 935 - if( (pRight = pExpr->pRight)->op==TK_ID ){ 954 + if( pRight->op==TK_ID ){ 936 955 int rc = resolveExprStep(pWalker, pRight); 937 956 if( rc==WRC_Abort ) return WRC_Abort; 938 957 if( pRight->op==TK_TRUEFALSE ){ 939 958 pExpr->op2 = pExpr->op; 940 959 pExpr->op = TK_TRUTH; 941 960 return WRC_Continue; 942 961 } ................................................................................ 1650 1669 ** An error message is left in pParse if anything is amiss. The number 1651 1670 ** if errors is returned. 1652 1671 */ 1653 1672 int sqlite3ResolveExprNames( 1654 1673 NameContext *pNC, /* Namespace to resolve expressions in. */ 1655 1674 Expr *pExpr /* The expression to be analyzed. */ 1656 1675 ){ 1657 - u16 savedHasAgg; 1676 + int savedHasAgg; 1658 1677 Walker w; 1659 1678 1660 1679 if( pExpr==0 ) return SQLITE_OK; 1661 1680 savedHasAgg = pNC->ncFlags & (NC_HasAgg|NC_MinMaxAgg|NC_HasWin); 1662 1681 pNC->ncFlags &= ~(NC_HasAgg|NC_MinMaxAgg|NC_HasWin); 1663 1682 w.pParse = pNC->pParse; 1664 1683 w.xExprCallback = resolveExprStep; ................................................................................ 1764 1783 sSrc.nSrc = 1; 1765 1784 sSrc.a[0].zName = pTab->zName; 1766 1785 sSrc.a[0].pTab = pTab; 1767 1786 sSrc.a[0].iCursor = -1; 1768 1787 } 1769 1788 sNC.pParse = pParse; 1770 1789 sNC.pSrcList = &sSrc; 1771 - sNC.ncFlags = type; 1790 + sNC.ncFlags = type | NC_IsDDL; 1772 1791 if( (rc = sqlite3ResolveExprNames(&sNC, pExpr))!=SQLITE_OK ) return rc; 1773 1792 if( pList ) rc = sqlite3ResolveExprListNames(&sNC, pList); 1774 1793 return rc; 1775 1794 }
Changes to src/select.c.
2092 2092 db->flags = savedFlags; 2093 2093 if( pParse->nErr ) return 0; 2094 2094 while( pSelect->pPrior ) pSelect = pSelect->pPrior; 2095 2095 pTab = sqlite3DbMallocZero(db, sizeof(Table) ); 2096 2096 if( pTab==0 ){ 2097 2097 return 0; 2098 2098 } 2099 - /* The sqlite3ResultSetOfSelect() is only used n contexts where lookaside 2100 - ** is disabled */ 2101 - assert( db->lookaside.bDisable ); 2102 2099 pTab->nTabRef = 1; 2103 2100 pTab->zName = 0; 2104 2101 pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) ); 2105 2102 sqlite3ColumnsFromExprList(pParse, pSelect->pEList, &pTab->nCol, &pTab->aCol); 2106 2103 sqlite3SelectAddColumnTypeAndCollation(pParse, pTab, pSelect); 2107 2104 pTab->iPKey = -1; 2108 2105 if( db->mallocFailed ){ ................................................................................ 2536 2533 sqlite3 *db; /* Database connection */ 2537 2534 2538 2535 /* Make sure there is no ORDER BY or LIMIT clause on prior SELECTs. Only 2539 2536 ** the last (right-most) SELECT in the series may have an ORDER BY or LIMIT. 2540 2537 */ 2541 2538 assert( p && p->pPrior ); /* Calling function guarantees this much */ 2542 2539 assert( (p->selFlags & SF_Recursive)==0 || p->op==TK_ALL || p->op==TK_UNION ); 2540 + assert( p->selFlags & SF_Compound ); 2543 2541 db = pParse->db; 2544 2542 pPrior = p->pPrior; 2545 2543 dest = *pDest; 2546 2544 if( pPrior->pOrderBy || pPrior->pLimit ){ 2547 2545 sqlite3ErrorMsg(pParse,"%s clause should come after %s not before", 2548 2546 pPrior->pOrderBy!=0 ? "ORDER BY" : "LIMIT", selectOpName(p->op)); 2549 2547 rc = 1; ................................................................................ 4041 4039 x.iTable = iParent; 4042 4040 x.iNewTable = iNewParent; 4043 4041 x.isLeftJoin = isLeftJoin; 4044 4042 x.pEList = pSub->pEList; 4045 4043 substSelect(&x, pParent, 0); 4046 4044 } 4047 4045 4048 - /* The flattened query is distinct if either the inner or the 4049 - ** outer query is distinct. 4050 - */ 4051 - pParent->selFlags |= pSub->selFlags & SF_Distinct; 4046 + /* The flattened query is a compound if either the inner or the 4047 + ** outer query is a compound. */ 4048 + pParent->selFlags |= pSub->selFlags & SF_Compound; 4049 + assert( (pSub->selFlags & SF_Distinct)==0 ); /* restriction (17b) */ 4052 4050 4053 4051 /* 4054 4052 ** SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y; 4055 4053 ** 4056 4054 ** One is tempted to try to add a and b to combine the limits. But this 4057 4055 ** does not work if either limit is negative. 4058 4056 */ ................................................................................ 4839 4837 if( db->mallocFailed ){ 4840 4838 return WRC_Abort; 4841 4839 } 4842 4840 assert( p->pSrc!=0 ); 4843 4841 if( (selFlags & SF_Expanded)!=0 ){ 4844 4842 return WRC_Prune; 4845 4843 } 4844 + if( pWalker->eCode ){ 4845 + /* Renumber selId because it has been copied from a view */ 4846 + p->selId = ++pParse->nSelect; 4847 + } 4846 4848 pTabList = p->pSrc; 4847 4849 pEList = p->pEList; 4848 4850 sqlite3WithPush(pParse, p->pWith, 0); 4849 4851 4850 4852 /* Make sure cursor numbers have been assigned to all entries in 4851 4853 ** the FROM clause of the SELECT statement. 4852 4854 */ ................................................................................ 4888 4890 pTab->nTabRef++; 4889 4891 if( !IsVirtual(pTab) && cannotBeFunction(pParse, pFrom) ){ 4890 4892 return WRC_Abort; 4891 4893 } 4892 4894 #if !defined(SQLITE_OMIT_VIEW) || !defined (SQLITE_OMIT_VIRTUALTABLE) 4893 4895 if( IsVirtual(pTab) || pTab->pSelect ){ 4894 4896 i16 nCol; 4897 + u8 eCodeOrig = pWalker->eCode; 4895 4898 if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort; 4896 4899 assert( pFrom->pSelect==0 ); 4897 4900 pFrom->pSelect = sqlite3SelectDup(db, pTab->pSelect, 0); 4898 4901 nCol = pTab->nCol; 4899 4902 pTab->nCol = -1; 4903 + pWalker->eCode = 1; /* Turn on Select.selId renumbering */ 4900 4904 sqlite3WalkSelect(pWalker, pFrom->pSelect); 4905 + pWalker->eCode = eCodeOrig; 4901 4906 pTab->nCol = nCol; 4902 4907 } 4903 4908 #endif 4904 4909 } 4905 4910 4906 4911 /* Locate the index named by the INDEXED BY clause, if any. */ 4907 4912 if( sqlite3IndexedByLookup(pParse, pFrom) ){ ................................................................................ 5143 5148 if( OK_IF_ALWAYS_TRUE(pParse->hasCompound) ){ 5144 5149 w.xSelectCallback = convertCompoundSelectToSubquery; 5145 5150 w.xSelectCallback2 = 0; 5146 5151 sqlite3WalkSelect(&w, pSelect); 5147 5152 } 5148 5153 w.xSelectCallback = selectExpander; 5149 5154 w.xSelectCallback2 = selectPopWith; 5155 + w.eCode = 0; 5150 5156 sqlite3WalkSelect(&w, pSelect); 5151 5157 } 5152 5158 5153 5159 5154 5160 #ifndef SQLITE_OMIT_SUBQUERY 5155 5161 /* 5156 5162 ** This is a Walker.xSelectCallback callback for the sqlite3SelectTypeInfo() ................................................................................ 5469 5475 ){ 5470 5476 struct SrcList_item *pItem; 5471 5477 for(pItem = pTabList->a; pItem<pThis; pItem++){ 5472 5478 Select *pS1; 5473 5479 if( pItem->pSelect==0 ) continue; 5474 5480 if( pItem->fg.viaCoroutine ) continue; 5475 5481 if( pItem->zName==0 ) continue; 5476 - if( sqlite3_stricmp(pItem->zDatabase, pThis->zDatabase)!=0 ) continue; 5482 + assert( pItem->pTab!=0 ); 5483 + assert( pThis->pTab!=0 ); 5484 + if( pItem->pTab->pSchema!=pThis->pTab->pSchema ) continue; 5477 5485 if( sqlite3_stricmp(pItem->zName, pThis->zName)!=0 ) continue; 5478 5486 pS1 = pItem->pSelect; 5479 - if( pThis->pSelect->selId!=pS1->selId ){ 5487 + if( pItem->pTab->pSchema==0 && pThis->pSelect->selId!=pS1->selId ){ 5480 5488 /* The query flattener left two different CTE tables with identical 5481 5489 ** names in the same FROM clause. */ 5482 5490 continue; 5483 5491 } 5484 5492 if( sqlite3ExprCompare(0, pThis->pSelect->pWhere, pS1->pWhere, -1) 5485 5493 || sqlite3ExprCompare(0, pThis->pSelect->pHaving, pS1->pHaving, -1) 5486 5494 ){ ................................................................................ 5504 5512 ** SELECT (SELECT count(*) FROM t1)+(SELECT count(*) FROM t2) 5505 5513 ** 5506 5514 ** The transformation only works if all of the following are true: 5507 5515 ** 5508 5516 ** * The subquery is a UNION ALL of two or more terms 5509 5517 ** * The subquery does not have a LIMIT clause 5510 5518 ** * There is no WHERE or GROUP BY or HAVING clauses on the subqueries 5511 -** * The outer query is a simple count(*) 5519 +** * The outer query is a simple count(*) with no WHERE clause or other 5520 +** extraneous syntax. 5512 5521 ** 5513 5522 ** Return TRUE if the optimization is undertaken. 5514 5523 */ 5515 5524 static int countOfViewOptimization(Parse *pParse, Select *p){ 5516 5525 Select *pSub, *pPrior; 5517 5526 Expr *pExpr; 5518 5527 Expr *pCount; 5519 5528 sqlite3 *db; 5520 5529 if( (p->selFlags & SF_Aggregate)==0 ) return 0; /* This is an aggregate */ 5521 5530 if( p->pEList->nExpr!=1 ) return 0; /* Single result column */ 5531 + if( p->pWhere ) return 0; 5532 + if( p->pGroupBy ) return 0; 5522 5533 pExpr = p->pEList->a[0].pExpr; 5523 5534 if( pExpr->op!=TK_AGG_FUNCTION ) return 0; /* Result is an aggregate */ 5524 5535 if( sqlite3_stricmp(pExpr->u.zToken,"count") ) return 0; /* Is count() */ 5525 5536 if( pExpr->x.pList!=0 ) return 0; /* Must be count(*) */ 5526 5537 if( p->pSrc->nSrc!=1 ) return 0; /* One table in FROM */ 5527 5538 pSub = p->pSrc->a[0].pSelect; 5528 5539 if( pSub==0 ) return 0; /* The FROM is a subquery */
Changes to src/shell.c.in.
3506 3506 " trigger Like \"full\" but also show trigger bytecode", 3507 3507 ".excel Display the output of next command in a spreadsheet", 3508 3508 ".exit ?CODE? Exit this program with return-code CODE", 3509 3509 ".expert EXPERIMENTAL. Suggest indexes for specified queries", 3510 3510 /* Because explain mode comes on automatically now, the ".explain" mode 3511 3511 ** is removed from the help screen. It is still supported for legacy, however */ 3512 3512 /*".explain ?on|off|auto? Turn EXPLAIN output mode on or off or to automatic",*/ 3513 + ".filectrl CMD ... Run various sqlite3_file_control() operations", 3514 + " Run \".filectrl\" with no arguments for details", 3513 3515 ".fullschema ?--indent? Show schema and the content of sqlite_stat tables", 3514 3516 ".headers on|off Turn display of headers on or off", 3515 3517 ".help ?-all? ?PATTERN? Show help text for PATTERN", 3516 3518 ".import FILE TABLE Import data from FILE into TABLE", 3517 3519 #ifndef SQLITE_OMIT_TEST_CONTROL 3518 3520 ".imposter INDEX TABLE Create imposter table TABLE on index INDEX", 3519 3521 #endif ................................................................................ 3623 3625 ".show Show the current values for various settings", 3624 3626 ".stats ?on|off? Show stats or turn stats on or off", 3625 3627 #ifndef SQLITE_NOHAVE_SYSTEM 3626 3628 ".system CMD ARGS... Run CMD ARGS... in a system shell", 3627 3629 #endif 3628 3630 ".tables ?TABLE? List names of tables matching LIKE pattern TABLE", 3629 3631 ".testcase NAME Begin redirecting output to 'testcase-out.txt'", 3632 + ".testctrl CMD ... Run various sqlite3_test_control() operations", 3633 + " Run \".testctrl\" with no arguments for details", 3630 3634 ".timeout MS Try opening locked tables for MS milliseconds", 3631 3635 ".timer on|off Turn SQL timer on or off", 3632 3636 #ifndef SQLITE_OMIT_TRACE 3633 3637 ".trace ?OPTIONS? Output each SQL statement as it is run", 3634 3638 " FILE Send output to FILE", 3635 3639 " stdout Send output to stdout", 3636 3640 " stderr Send output to stderr", ................................................................................ 4845 4849 zCmd = sqlite3_mprintf("%s %s", zXdgOpenCmd, p->zTempFile); 4846 4850 if( system(zCmd) ){ 4847 4851 utf8_printf(stderr, "Failed: [%s]\n", zCmd); 4848 4852 } 4849 4853 sqlite3_free(zCmd); 4850 4854 outputModePop(p); 4851 4855 p->doXdgOpen = 0; 4856 + sqlite3_sleep(100); 4852 4857 } 4853 4858 #endif /* !defined(SQLITE_NOHAVE_SYSTEM) */ 4854 4859 } 4855 4860 p->outfile[0] = 0; 4856 4861 p->out = stdout; 4857 4862 } 4858 4863 ................................................................................ 6553 6558 RecoverTable *pOrphan = 0; 6554 6559 6555 6560 int bFreelist = 1; /* 0 if --freelist-corrupt is specified */ 6556 6561 for(i=1; i<nArg; i++){ 6557 6562 char *z = azArg[i]; 6558 6563 int n; 6559 6564 if( z[0]=='-' && z[1]=='-' ) z++; 6560 - n = strlen(z); 6565 + n = strlen30(z); 6561 6566 if( n<=17 && memcmp("-freelist-corrupt", z, n)==0 ){ 6562 6567 bFreelist = 0; 6563 6568 }else 6564 6569 if( n<=12 && memcmp("-recovery-db", z, n)==0 && i<(nArg-1) ){ 6565 6570 i++; 6566 6571 zRecoveryDb = azArg[i]; 6567 6572 }else ................................................................................ 7075 7080 { "fts3_tokenizer", SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER }, 7076 7081 { "load_extension", SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION }, 7077 7082 { "no_ckpt_on_close", SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE }, 7078 7083 { "enable_qpsg", SQLITE_DBCONFIG_ENABLE_QPSG }, 7079 7084 { "trigger_eqp", SQLITE_DBCONFIG_TRIGGER_EQP }, 7080 7085 { "reset_database", SQLITE_DBCONFIG_RESET_DATABASE }, 7081 7086 { "defensive", SQLITE_DBCONFIG_DEFENSIVE }, 7087 + { "writable_schema", SQLITE_DBCONFIG_WRITABLE_SCHEMA }, 7088 + { "legacy_alter_table", SQLITE_DBCONFIG_LEGACY_ALTER_TABLE }, 7089 + { "dqs_dml", SQLITE_DBCONFIG_DQS_DML }, 7090 + { "dqs_ddl", SQLITE_DBCONFIG_DQS_DDL }, 7082 7091 }; 7083 7092 int ii, v; 7084 7093 open_db(p, 0); 7085 7094 for(ii=0; ii<ArraySize(aDbConfig); ii++){ 7086 7095 if( nArg>1 && strcmp(azArg[1], aDbConfig[ii].zName)!=0 ) continue; 7087 7096 if( nArg>=3 ){ 7088 7097 sqlite3_db_config(p->db, aDbConfig[ii].op, booleanValue(azArg[2]), 0); ................................................................................ 7271 7280 7272 7281 #ifndef SQLITE_OMIT_VIRTUALTABLE 7273 7282 if( c=='e' && strncmp(azArg[0], "expert", n)==0 ){ 7274 7283 open_db(p, 0); 7275 7284 expertDotCommand(p, azArg, nArg); 7276 7285 }else 7277 7286 #endif 7287 + 7288 + if( c=='f' && strncmp(azArg[0], "filectrl", n)==0 ){ 7289 + static const struct { 7290 + const char *zCtrlName; /* Name of a test-control option */ 7291 + int ctrlCode; /* Integer code for that option */ 7292 + const char *zUsage; /* Usage notes */ 7293 + } aCtrl[] = { 7294 + { "size_limit", SQLITE_FCNTL_SIZE_LIMIT, "[LIMIT]" }, 7295 + { "chunk_size", SQLITE_FCNTL_CHUNK_SIZE, "SIZE" }, 7296 + /* { "win32_av_retry", SQLITE_FCNTL_WIN32_AV_RETRY, "COUNT DELAY" },*/ 7297 + { "persist_wal", SQLITE_FCNTL_PERSIST_WAL, "[BOOLEAN]" }, 7298 + { "psow", SQLITE_FCNTL_POWERSAFE_OVERWRITE, "[BOOLEAN]" }, 7299 + /* { "pragma", SQLITE_FCNTL_PRAGMA, "NAME ARG" },*/ 7300 + { "tempfilename", SQLITE_FCNTL_TEMPFILENAME, "" }, 7301 + { "has_moved", SQLITE_FCNTL_HAS_MOVED, "" }, 7302 + { "lock_timeout", SQLITE_FCNTL_LOCK_TIMEOUT, "MILLISEC" }, 7303 + }; 7304 + int filectrl = -1; 7305 + int iCtrl = -1; 7306 + sqlite3_int64 iRes = 0; /* Integer result to display if rc2==1 */ 7307 + int isOk = 0; /* 0: usage 1: %lld 2: no-result */ 7308 + int n2, i; 7309 + const char *zCmd = 0; 7310 + 7311 + open_db(p, 0); 7312 + zCmd = nArg>=2 ? azArg[1] : "help"; 7313 + 7314 + /* The argument can optionally begin with "-" or "--" */ 7315 + if( zCmd[0]=='-' && zCmd[1] ){ 7316 + zCmd++; 7317 + if( zCmd[0]=='-' && zCmd[1] ) zCmd++; 7318 + } 7319 + 7320 + /* --help lists all file-controls */ 7321 + if( strcmp(zCmd,"help")==0 ){ 7322 + utf8_printf(p->out, "Available file-controls:\n"); 7323 + for(i=0; i<ArraySize(aCtrl); i++){ 7324 + utf8_printf(p->out, " .filectrl %s %s\n", 7325 + aCtrl[i].zCtrlName, aCtrl[i].zUsage); 7326 + } 7327 + rc = 1; 7328 + goto meta_command_exit; 7329 + } 7330 + 7331 + /* convert filectrl text option to value. allow any unique prefix 7332 + ** of the option name, or a numerical value. */ 7333 + n2 = strlen30(zCmd); 7334 + for(i=0; i<ArraySize(aCtrl); i++){ 7335 + if( strncmp(zCmd, aCtrl[i].zCtrlName, n2)==0 ){ 7336 + if( filectrl<0 ){ 7337 + filectrl = aCtrl[i].ctrlCode; 7338 + iCtrl = i; 7339 + }else{ 7340 + utf8_printf(stderr, "Error: ambiguous file-control: \"%s\"\n" 7341 + "Use \".filectrl --help\" for help\n", zCmd); 7342 + rc = 1; 7343 + goto meta_command_exit; 7344 + } 7345 + } 7346 + } 7347 + if( filectrl<0 ){ 7348 + utf8_printf(stderr,"Error: unknown file-control: %s\n" 7349 + "Use \".filectrl --help\" for help\n", zCmd); 7350 + }else{ 7351 + switch(filectrl){ 7352 + case SQLITE_FCNTL_SIZE_LIMIT: { 7353 + if( nArg!=2 && nArg!=3 ) break; 7354 + iRes = nArg==3 ? integerValue(azArg[2]) : -1; 7355 + sqlite3_file_control(p->db, 0, SQLITE_FCNTL_SIZE_LIMIT, &iRes); 7356 + isOk = 1; 7357 + break; 7358 + } 7359 + case SQLITE_FCNTL_LOCK_TIMEOUT: 7360 + case SQLITE_FCNTL_CHUNK_SIZE: { 7361 + int x; 7362 + if( nArg!=3 ) break; 7363 + x = (int)integerValue(azArg[2]); 7364 + sqlite3_file_control(p->db, 0, filectrl, &x); 7365 + isOk = 2; 7366 + break; 7367 + } 7368 + case SQLITE_FCNTL_PERSIST_WAL: 7369 + case SQLITE_FCNTL_POWERSAFE_OVERWRITE: { 7370 + int x; 7371 + if( nArg!=2 && nArg!=3 ) break; 7372 + x = nArg==3 ? booleanValue(azArg[2]) : -1; 7373 + sqlite3_file_control(p->db, 0, filectrl, &x); 7374 + iRes = x; 7375 + isOk = 1; 7376 + break; 7377 + } 7378 + case SQLITE_FCNTL_HAS_MOVED: { 7379 + int x; 7380 + if( nArg!=2 ) break; 7381 + sqlite3_file_control(p->db, 0, filectrl, &x); 7382 + iRes = x; 7383 + isOk = 1; 7384 + break; 7385 + } 7386 + case SQLITE_FCNTL_TEMPFILENAME: { 7387 + char *z = 0; 7388 + if( nArg!=2 ) break; 7389 + sqlite3_file_control(p->db, 0, filectrl, &z); 7390 + if( z ){ 7391 + utf8_printf(p->out, "%s\n", z); 7392 + sqlite3_free(z); 7393 + } 7394 + isOk = 2; 7395 + break; 7396 + } 7397 + } 7398 + } 7399 + if( isOk==0 && iCtrl>=0 ){ 7400 + utf8_printf(p->out, "Usage: .filectrl %s %s\n", zCmd,aCtrl[iCtrl].zUsage); 7401 + rc = 1; 7402 + }else if( isOk==1 ){ 7403 + char zBuf[100]; 7404 + sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", iRes); 7405 + raw_printf(p->out, "%s\n", zBuf); 7406 + } 7407 + }else 7278 7408 7279 7409 if( c=='f' && strncmp(azArg[0], "fullschema", n)==0 ){ 7280 7410 ShellState data; 7281 7411 char *zErrMsg = 0; 7282 7412 int doStats = 0; 7283 7413 memcpy(&data, p, sizeof(data)); 7284 7414 data.showHeader = 0;
Changes to src/sqlite.h.in.
1293 1293 ** element will be valid after xOpen returns regardless of the success 1294 1294 ** or failure of the xOpen call. 1295 1295 ** 1296 1296 ** [[sqlite3_vfs.xAccess]] 1297 1297 ** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] 1298 1298 ** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to 1299 1299 ** test whether a file is readable and writable, or [SQLITE_ACCESS_READ] 1300 -** to test whether a file is at least readable. The file can be a 1301 -** directory. 1300 +** to test whether a file is at least readable. The SQLITE_ACCESS_READ 1301 +** flag is never actually used and is not implemented in the built-in 1302 +** VFSes of SQLite. The file is named by the second argument and can be a 1303 +** directory. The xAccess method returns [SQLITE_OK] on success or some 1304 +** non-zero error code if there is an I/O error or if the name of 1305 +** the file given in the second argument is illegal. If SQLITE_OK 1306 +** is returned, then non-zero or zero is written into *pResOut to indicate 1307 +** whether or not the file is accessible. 1302 1308 ** 1303 1309 ** ^SQLite will always allocate at least mxPathname+1 bytes for the 1304 1310 ** output buffer xFullPathname. The exact size of the output buffer 1305 1311 ** is also passed as a parameter to both methods. If the output buffer 1306 1312 ** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is 1307 1313 ** handled as a fatal error by SQLite, vfs implementations should endeavor 1308 1314 ** to prevent this by setting mxPathname to a sufficiently large value. ................................................................................ 2195 2201 ** <dd>The SQLITE_DBCONFIG_DEFENSIVE option activates or deactivates the 2196 2202 ** "defensive" flag for a database connection. When the defensive 2197 2203 ** flag is enabled, language features that allow ordinary SQL to 2198 2204 ** deliberately corrupt the database file are disabled. The disabled 2199 2205 ** features include but are not limited to the following: 2200 2206 ** <ul> 2201 2207 ** <li> The [PRAGMA writable_schema=ON] statement. 2208 +** <li> The [PRAGMA journal_mode=OFF] statement. 2202 2209 ** <li> Writes to the [sqlite_dbpage] virtual table. 2203 2210 ** <li> Direct writes to [shadow tables]. 2204 2211 ** </ul> 2205 2212 ** </dd> 2206 2213 ** 2207 2214 ** [[SQLITE_DBCONFIG_WRITABLE_SCHEMA]] <dt>SQLITE_DBCONFIG_WRITABLE_SCHEMA</dt> 2208 2215 ** <dd>The SQLITE_DBCONFIG_WRITABLE_SCHEMA option activates or deactivates the ................................................................................ 2210 2217 ** to setting [PRAGMA writable_schema=ON] or [PRAGMA writable_schema=OFF]. 2211 2218 ** The first argument to this setting is an integer which is 0 to disable 2212 2219 ** the writable_schema, positive to enable writable_schema, or negative to 2213 2220 ** leave the setting unchanged. The second parameter is a pointer to an 2214 2221 ** integer into which is written 0 or 1 to indicate whether the writable_schema 2215 2222 ** is enabled or disabled following this call. 2216 2223 ** </dd> 2224 +** 2225 +** [[SQLITE_DBCONFIG_LEGACY_ALTER_TABLE]] 2226 +** <dt>SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</dt> 2227 +** <dd>The SQLITE_DBCONFIG_LEGACY_ALTER_TABLE option activates or deactivates 2228 +** the legacy behavior of the [ALTER TABLE RENAME] command such it 2229 +** behaves as it did prior to [version 3.24.0] (2018-06-04). See the 2230 +** "Compatibility Notice" on the [ALTER TABLE RENAME documentation] for 2231 +** additional information. This feature can also be turned on and off 2232 +** using the [PRAGMA legacy_alter_table] statement. 2233 +** </dd> 2234 +** 2235 +** [[SQLITE_DBCONFIG_DQS_DML]] 2236 +** <dt>SQLITE_DBCONFIG_DQS_DML</td> 2237 +** <dd>The SQLITE_DBCONFIG_DQS_DML option activates or deactivates 2238 +** the legacy [double-quoted string literal] misfeature for DML statement 2239 +** only, that is DELETE, INSERT, SELECT, and UPDATE statements. The 2240 +** default value of this setting is determined by the [-DSQLITE_DQS] 2241 +** compile-time option. 2242 +** </dd> 2243 +** 2244 +** [[SQLITE_DBCONFIG_DQS_DDL]] 2245 +** <dt>SQLITE_DBCONFIG_DQS_DDL</td> 2246 +** <dd>The SQLITE_DBCONFIG_DQS option activates or deactivates 2247 +** the legacy [double-quoted string literal] misfeature for DDL statements, 2248 +** such as CREATE TABLE and CREATE INDEX. The 2249 +** default value of this setting is determined by the [-DSQLITE_DQS] 2250 +** compile-time option. 2251 +** </dd> 2217 2252 ** </dl> 2218 2253 */ 2219 2254 #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */ 2220 2255 #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ 2221 2256 #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ 2222 2257 #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ 2223 2258 #define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */ ................................................................................ 2224 2259 #define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */ 2225 2260 #define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */ 2226 2261 #define SQLITE_DBCONFIG_ENABLE_QPSG 1007 /* int int* */ 2227 2262 #define SQLITE_DBCONFIG_TRIGGER_EQP 1008 /* int int* */ 2228 2263 #define SQLITE_DBCONFIG_RESET_DATABASE 1009 /* int int* */ 2229 2264 #define SQLITE_DBCONFIG_DEFENSIVE 1010 /* int int* */ 2230 2265 #define SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011 /* int int* */ 2231 -#define SQLITE_DBCONFIG_MAX 1011 /* Largest DBCONFIG */ 2266 +#define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012 /* int int* */ 2267 +#define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */ 2268 +#define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */ 2269 +#define SQLITE_DBCONFIG_MAX 1014 /* Largest DBCONFIG */ 2232 2270 2233 2271 /* 2234 2272 ** CAPI3REF: Enable Or Disable Extended Result Codes 2235 2273 ** METHOD: sqlite3 2236 2274 ** 2237 2275 ** ^The sqlite3_extended_result_codes() routine enables or disables the 2238 2276 ** [extended result codes] feature of SQLite. ^The extended result
Changes to src/sqliteInt.h.
845 845 ** -DSQLITE_BYTEORDER=0 is set, then byte-order is determined 846 846 ** at run-time. 847 847 */ 848 848 #ifndef SQLITE_BYTEORDER 849 849 # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \ 850 850 defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \ 851 851 defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \ 852 - defined(__arm__) || defined(_M_ARM64) 852 + defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) 853 853 # define SQLITE_BYTEORDER 1234 854 -# elif defined(sparc) || defined(__ppc__) 854 +# elif defined(sparc) || defined(__ppc__) || \ 855 + defined(__ARMEB__) || defined(__AARCH64EB__) 855 856 # define SQLITE_BYTEORDER 4321 856 857 # else 857 858 # define SQLITE_BYTEORDER 0 858 859 # endif 859 860 #endif 860 861 #if SQLITE_BYTEORDER==4321 861 862 # define SQLITE_BIGENDIAN 1 ................................................................................ 1559 1560 #define SQLITE_Fts3Tokenizer 0x00400000 /* Enable fts3_tokenizer(2) */ 1560 1561 #define SQLITE_EnableQPSG 0x00800000 /* Query Planner Stability Guarantee*/ 1561 1562 #define SQLITE_TriggerEQP 0x01000000 /* Show trigger EXPLAIN QUERY PLAN */ 1562 1563 #define SQLITE_ResetDatabase 0x02000000 /* Reset the database */ 1563 1564 #define SQLITE_LegacyAlter 0x04000000 /* Legacy ALTER TABLE behaviour */ 1564 1565 #define SQLITE_NoSchemaError 0x08000000 /* Do not report schema parse errors*/ 1565 1566 #define SQLITE_Defensive 0x10000000 /* Input SQL is likely hostile */ 1567 +#define SQLITE_DqsDDL 0x20000000 /* dbl-quoted strings allowed in DDL*/ 1568 +#define SQLITE_DqsDML 0x40000000 /* dbl-quoted strings allowed in DML*/ 1566 1569 1567 1570 /* Flags used only if debugging */ 1568 1571 #define HI(X) ((u64)(X)<<32) 1569 1572 #ifdef SQLITE_DEBUG 1570 1573 #define SQLITE_SqlTrace HI(0x0001) /* Debug print SQL as it executes */ 1571 1574 #define SQLITE_VdbeListing HI(0x0002) /* Debug listings of VDBE progs */ 1572 1575 #define SQLITE_VdbeTrace HI(0x0004) /* True to trace VDBE execution */ ................................................................................ 2493 2496 ** EP_Unlikely: 134217728 times likelihood 2494 2497 ** TK_SELECT: 1st register of result vector */ 2495 2498 ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid. 2496 2499 ** TK_VARIABLE: variable number (always >= 1). 2497 2500 ** TK_SELECT_COLUMN: column of the result vector */ 2498 2501 i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */ 2499 2502 i16 iRightJoinTable; /* If EP_FromJoin, the right table of the join */ 2500 - u8 op2; /* TK_REGISTER: original value of Expr.op 2503 + u8 op2; /* TK_REGISTER/TK_TRUTH: original value of Expr.op 2501 2504 ** TK_COLUMN: the value of p5 for OP_Column 2502 2505 ** TK_AGG_FUNCTION: nesting depth */ 2503 2506 AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */ 2504 2507 union { 2505 2508 Table *pTab; /* TK_COLUMN: Table containing column. Can be NULL 2506 2509 ** for a column of an index on an expression */ 2507 2510 Window *pWin; /* TK_FUNCTION: Window definition for the func */ ................................................................................ 2527 2530 #define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */ 2528 2531 #define EP_DblQuoted 0x000040 /* token.z was originally in "..." */ 2529 2532 #define EP_InfixFunc 0x000080 /* True for an infix function: LIKE, GLOB, etc */ 2530 2533 #define EP_Collate 0x000100 /* Tree contains a TK_COLLATE operator */ 2531 2534 #define EP_Generic 0x000200 /* Ignore COLLATE or affinity on this tree */ 2532 2535 #define EP_IntValue 0x000400 /* Integer value contained in u.iValue */ 2533 2536 #define EP_xIsSelect 0x000800 /* x.pSelect is valid (otherwise x.pList is) */ 2534 -#define EP_Skip 0x001000 /* COLLATE, AS, or UNLIKELY */ 2537 +#define EP_Skip 0x001000 /* Operator does not contribute to affinity */ 2535 2538 #define EP_Reduced 0x002000 /* Expr struct EXPR_REDUCEDSIZE bytes only */ 2536 2539 #define EP_TokenOnly 0x004000 /* Expr struct EXPR_TOKENONLYSIZE bytes only */ 2537 2540 #define EP_Win 0x008000 /* Contains window functions */ 2538 2541 #define EP_MemToken 0x010000 /* Need to sqlite3DbFree() Expr.zToken */ 2539 2542 #define EP_NoReduce 0x020000 /* Cannot EXPRDUP_REDUCE this Expr */ 2540 2543 #define EP_Unlikely 0x040000 /* unlikely() or likelihood() function */ 2541 2544 #define EP_ConstFunc 0x080000 /* A SQLITE_FUNC_CONSTANT or _SLOCHNG function */ ................................................................................ 2778 2781 ExprList *pEList; /* Optional list of result-set columns */ 2779 2782 AggInfo *pAggInfo; /* Information about aggregates at this level */ 2780 2783 Upsert *pUpsert; /* ON CONFLICT clause information from an upsert */ 2781 2784 } uNC; 2782 2785 NameContext *pNext; /* Next outer name context. NULL for outermost */ 2783 2786 int nRef; /* Number of names resolved by this context */ 2784 2787 int nErr; /* Number of errors encountered while resolving names */ 2785 - u16 ncFlags; /* Zero or more NC_* flags defined below */ 2788 + int ncFlags; /* Zero or more NC_* flags defined below */ 2786 2789 Select *pWinSelect; /* SELECT statement for any window functions */ 2787 2790 }; 2788 2791 2789 2792 /* 2790 2793 ** Allowed values for the NameContext, ncFlags field. 2791 2794 ** 2792 2795 ** Value constraints (all checked via assert()): ................................................................................ 2805 2808 #define NC_UEList 0x0080 /* True if uNC.pEList is used */ 2806 2809 #define NC_UAggInfo 0x0100 /* True if uNC.pAggInfo is used */ 2807 2810 #define NC_UUpsert 0x0200 /* True if uNC.pUpsert is used */ 2808 2811 #define NC_MinMaxAgg 0x1000 /* min/max aggregates seen. See note above */ 2809 2812 #define NC_Complex 0x2000 /* True if a function or subquery seen */ 2810 2813 #define NC_AllowWin 0x4000 /* Window functions are allowed here */ 2811 2814 #define NC_HasWin 0x8000 /* One or more window functions seen */ 2815 +#define NC_IsDDL 0x10000 /* Resolving names in a CREATE statement */ 2812 2816 2813 2817 /* 2814 2818 ** An instance of the following object describes a single ON CONFLICT 2815 2819 ** clause in an upsert. 2816 2820 ** 2817 2821 ** The pUpsertTarget field is only set if the ON CONFLICT clause includes 2818 2822 ** conflict-target clause. (In "ON CONFLICT(a,b)" the "(a,b)" is the ................................................................................ 3811 3815 #if defined(SQLITE_ENABLE_MULTITHREADED_CHECKS) && !defined(SQLITE_MUTEX_OMIT) 3812 3816 void sqlite3MutexWarnOnContention(sqlite3_mutex*); 3813 3817 #else 3814 3818 # define sqlite3MutexWarnOnContention(x) 3815 3819 #endif 3816 3820 3817 3821 #ifndef SQLITE_OMIT_FLOATING_POINT 3822 +# define EXP754 (((u64)0x7ff)<<52) 3823 +# define MAN754 ((((u64)1)<<52)-1) 3824 +# define IsNaN(X) (((X)&EXP754)==EXP754 && ((X)&MAN754)!=0) 3818 3825 int sqlite3IsNaN(double); 3819 3826 #else 3827 +# define IsNaN(X) 0 3820 3828 # define sqlite3IsNaN(X) 0 3821 3829 #endif 3822 3830 3823 3831 /* 3824 3832 ** An instance of the following structure holds information about SQL 3825 3833 ** functions arguments that are the parameters to the printf() function. 3826 3834 */ ................................................................................ 3876 3884 Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*); 3877 3885 void sqlite3PExprAddSelect(Parse*, Expr*, Select*); 3878 3886 Expr *sqlite3ExprAnd(Parse*,Expr*, Expr*); 3879 3887 Expr *sqlite3ExprSimplifiedAndOr(Expr*); 3880 3888 Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*, int); 3881 3889 void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32); 3882 3890 void sqlite3ExprDelete(sqlite3*, Expr*); 3891 +void sqlite3ExprUnmapAndDelete(Parse*, Expr*); 3883 3892 ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*); 3884 3893 ExprList *sqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*); 3885 3894 void sqlite3ExprListSetSortOrder(ExprList*,int); 3886 3895 void sqlite3ExprListSetName(Parse*,ExprList*,Token*,int); 3887 3896 void sqlite3ExprListSetSpan(Parse*,ExprList*,const char*,const char*); 3888 3897 void sqlite3ExprListDelete(sqlite3*, ExprList*); 3889 3898 u32 sqlite3ExprListFlags(const ExprList*); ................................................................................ 4184 4193 void sqlite3Detach(Parse*, Expr*); 4185 4194 void sqlite3FixInit(DbFixer*, Parse*, int, const char*, const Token*); 4186 4195 int sqlite3FixSrcList(DbFixer*, SrcList*); 4187 4196 int sqlite3FixSelect(DbFixer*, Select*); 4188 4197 int sqlite3FixExpr(DbFixer*, Expr*); 4189 4198 int sqlite3FixExprList(DbFixer*, ExprList*); 4190 4199 int sqlite3FixTriggerStep(DbFixer*, TriggerStep*); 4200 +int sqlite3RealSameAsInt(double,sqlite3_int64); 4191 4201 int sqlite3AtoF(const char *z, double*, int, u8); 4192 4202 int sqlite3GetInt32(const char *, int*); 4193 4203 int sqlite3Atoi(const char*); 4194 4204 #ifndef SQLITE_OMIT_UTF16 4195 4205 int sqlite3Utf16ByteLen(const void *pData, int nChar); 4196 4206 #endif 4197 4207 int sqlite3Utf8CharLen(const char *pData, int nByte);
Changes to src/test1.c.
7804 7804 { "FTS3_TOKENIZER", SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER }, 7805 7805 { "LOAD_EXTENSION", SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION }, 7806 7806 { "NO_CKPT_ON_CLOSE",SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE }, 7807 7807 { "QPSG", SQLITE_DBCONFIG_ENABLE_QPSG }, 7808 7808 { "TRIGGER_EQP", SQLITE_DBCONFIG_TRIGGER_EQP }, 7809 7809 { "RESET_DB", SQLITE_DBCONFIG_RESET_DATABASE }, 7810 7810 { "DEFENSIVE", SQLITE_DBCONFIG_DEFENSIVE }, 7811 + { "WRITABLE_SCHEMA", SQLITE_DBCONFIG_WRITABLE_SCHEMA }, 7812 + { "LEGACY_ALTER_TABLE", SQLITE_DBCONFIG_LEGACY_ALTER_TABLE }, 7813 + { "DQS_DML", SQLITE_DBCONFIG_DQS_DML }, 7814 + { "DQS_DDL", SQLITE_DBCONFIG_DQS_DDL }, 7811 7815 }; 7812 7816 int i; 7813 7817 int v; 7814 7818 const char *zSetting; 7815 7819 sqlite3 *db; 7816 7820 7817 7821 if( objc!=4 ){
Changes to src/test_demovfs.c.
236 236 return SQLITE_IOERR_READ; 237 237 } 238 238 nRead = read(p->fd, zBuf, iAmt); 239 239 240 240 if( nRead==iAmt ){ 241 241 return SQLITE_OK; 242 242 }else if( nRead>=0 ){ 243 + if( nRead<iAmt ){ 244 + memset(&((char*)zBuf)[nRead], 0, iAmt-nRead); 245 + } 243 246 return SQLITE_IOERR_SHORT_READ; 244 247 } 245 248 246 249 return SQLITE_IOERR_READ; 247 250 } 248 251 249 252 /* ................................................................................ 365 368 return SQLITE_OK; 366 369 } 367 370 368 371 /* 369 372 ** No xFileControl() verbs are implemented by this VFS. 370 373 */ 371 374 static int demoFileControl(sqlite3_file *pFile, int op, void *pArg){ 372 - return SQLITE_OK; 375 + return SQLITE_NOTFOUND; 373 376 } 374 377 375 378 /* 376 379 ** The xSectorSize() and xDeviceCharacteristics() methods. These two 377 380 ** may return special values allowing SQLite to optimize file-system 378 381 ** access to some extent. But it is also safe to simply return 0. 379 382 */
Changes to src/test_devsym.c.
501 501 }else{ 502 502 g.iSectorSize = 512; 503 503 } 504 504 } 505 505 506 506 void devsym_unregister(){ 507 507 sqlite3_vfs_unregister(&devsym_vfs); 508 + sqlite3_vfs_unregister(&writecrash_vfs); 508 509 g.pVfs = 0; 509 510 g.iDeviceChar = 0; 510 511 g.iSectorSize = 0; 511 512 } 512 513 513 514 void devsym_crash_on_write(int nWrite){ 514 515 if( g.pVfs==0 ){
Changes to src/treeview.c.
510 510 case TK_TRUTH: { 511 511 int x; 512 512 const char *azOp[] = { 513 513 "IS-FALSE", "IS-TRUE", "IS-NOT-FALSE", "IS-NOT-TRUE" 514 514 }; 515 515 assert( pExpr->op2==TK_IS || pExpr->op2==TK_ISNOT ); 516 516 assert( pExpr->pRight ); 517 - assert( pExpr->pRight->op==TK_TRUEFALSE ); 517 + assert( sqlite3ExprSkipCollate(pExpr->pRight)->op==TK_TRUEFALSE ); 518 518 x = (pExpr->op2==TK_ISNOT)*2 + sqlite3ExprTruthValue(pExpr->pRight); 519 519 zUniOp = azOp[x]; 520 520 break; 521 521 } 522 522 523 523 case TK_SPAN: { 524 524 sqlite3TreeViewLine(pView, "SPAN %Q", pExpr->u.zToken);
Changes to src/util.c.
54 54 return xCallback ? xCallback(iTest) : SQLITE_OK; 55 55 } 56 56 #endif 57 57 58 58 #ifndef SQLITE_OMIT_FLOATING_POINT 59 59 /* 60 60 ** Return true if the floating point value is Not a Number (NaN). 61 -** 62 -** Use the math library isnan() function if compiled with SQLITE_HAVE_ISNAN. 63 -** Otherwise, we have our own implementation that works on most systems. 64 61 */ 65 62 int sqlite3IsNaN(double x){ 66 - int rc; /* The value return */ 67 -#if !SQLITE_HAVE_ISNAN && !HAVE_ISNAN 68 - /* 69 - ** Systems that support the isnan() library function should probably 70 - ** make use of it by compiling with -DSQLITE_HAVE_ISNAN. But we have 71 - ** found that many systems do not have a working isnan() function so 72 - ** this implementation is provided as an alternative. 73 - ** 74 - ** This NaN test sometimes fails if compiled on GCC with -ffast-math. 75 - ** On the other hand, the use of -ffast-math comes with the following 76 - ** warning: 77 - ** 78 - ** This option [-ffast-math] should never be turned on by any 79 - ** -O option since it can result in incorrect output for programs 80 - ** which depend on an exact implementation of IEEE or ISO 81 - ** rules/specifications for math functions. 82 - ** 83 - ** Under MSVC, this NaN test may fail if compiled with a floating- 84 - ** point precision mode other than /fp:precise. From the MSDN 85 - ** documentation: 86 - ** 87 - ** The compiler [with /fp:precise] will properly handle comparisons 88 - ** involving NaN. For example, x != x evaluates to true if x is NaN 89 - ** ... 90 - */ 91 -#ifdef __FAST_MATH__ 92 -# error SQLite will not work correctly with the -ffast-math option of GCC. 93 -#endif 94 - volatile double y = x; 95 - volatile double z = y; 96 - rc = (y!=z); 97 -#else /* if HAVE_ISNAN */ 98 - rc = isnan(x); 99 -#endif /* HAVE_ISNAN */ 100 - testcase( rc ); 101 - return rc; 63 + u64 y; 64 + memcpy(&y,&x,sizeof(y)); 65 + return IsNaN(y); 102 66 } 103 67 #endif /* SQLITE_OMIT_FLOATING_POINT */ 104 68 105 69 /* 106 70 ** Compute a string length that is limited to what can be stored in 107 71 ** lower 30 bits of a 32-bit signed integer. 108 72 ** ................................................................................ 355 319 ** E==2 results in 100. E==50 results in 1.0e50. 356 320 ** 357 321 ** This routine only works for values of E between 1 and 341. 358 322 */ 359 323 static LONGDOUBLE_TYPE sqlite3Pow10(int E){ 360 324 #if defined(_MSC_VER) 361 325 static const LONGDOUBLE_TYPE x[] = { 362 - 1.0e+001, 363 - 1.0e+002, 364 - 1.0e+004, 365 - 1.0e+008, 366 - 1.0e+016, 367 - 1.0e+032, 368 - 1.0e+064, 369 - 1.0e+128, 370 - 1.0e+256 326 + 1.0e+001L, 327 + 1.0e+002L, 328 + 1.0e+004L, 329 + 1.0e+008L, 330 + 1.0e+016L, 331 + 1.0e+032L, 332 + 1.0e+064L, 333 + 1.0e+128L, 334 + 1.0e+256L 371 335 }; 372 336 LONGDOUBLE_TYPE r = 1.0; 373 337 int i; 374 338 assert( E>=0 && E<=307 ); 375 339 for(i=0; E!=0; i++, E >>=1){ 376 340 if( E & 1 ) r *= x[i]; 377 341 } ................................................................................ 393 357 ** The string z[] is an text representation of a real number. 394 358 ** Convert this string to a double and write it into *pResult. 395 359 ** 396 360 ** The string z[] is length bytes in length (bytes, not characters) and 397 361 ** uses the encoding enc. The string is not necessarily zero-terminated. 398 362 ** 399 363 ** Return TRUE if the result is a valid real number (or integer) and FALSE 400 -** if the string is empty or contains extraneous text. Valid numbers 401 -** are in one of these formats: 364 +** if the string is empty or contains extraneous text. More specifically 365 +** return 366 +** 1 => The input string is a pure integer 367 +** 2 or more => The input has a decimal point or eNNN clause 368 +** 0 or less => The input string is not a valid number 369 +** -1 => Not a valid number, but has a valid prefix which 370 +** includes a decimal point and/or an eNNN clause 371 +** 372 +** Valid numbers are in one of these formats: 402 373 ** 403 374 ** [+-]digits[E[+-]digits] 404 375 ** [+-]digits.[digits][E[+-]digits] 405 376 ** [+-].digits[E[+-]digits] 406 377 ** 407 378 ** Leading and trailing whitespace is ignored for the purpose of determining 408 379 ** validity. ................................................................................ 419 390 int sign = 1; /* sign of significand */ 420 391 i64 s = 0; /* significand */ 421 392 int d = 0; /* adjust exponent for shifting decimal point */ 422 393 int esign = 1; /* sign of exponent */ 423 394 int e = 0; /* exponent */ 424 395 int eValid = 1; /* True exponent is either not used or is well-formed */ 425 396 double result; 426 - int nDigits = 0; 427 - int nonNum = 0; /* True if input contains UTF16 with high byte non-zero */ 397 + int nDigit = 0; /* Number of digits processed */ 398 + int eType = 1; /* 1: pure integer, 2+: fractional -1 or less: bad UTF16 */ 428 399 429 400 assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE ); 430 401 *pResult = 0.0; /* Default return value, in case of an error */ 431 402 432 403 if( enc==SQLITE_UTF8 ){ 433 404 incr = 1; 434 405 }else{ 435 406 int i; 436 407 incr = 2; 437 408 assert( SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 ); 409 + testcase( enc==SQLITE_UTF16LE ); 410 + testcase( enc==SQLITE_UTF16BE ); 438 411 for(i=3-enc; i<length && z[i]==0; i+=2){} 439 - nonNum = i<length; 412 + if( i<length ) eType = -100; 440 413 zEnd = &z[i^1]; 441 414 z += (enc&1); 442 415 } 443 416 444 417 /* skip leading spaces */ 445 418 while( z<zEnd && sqlite3Isspace(*z) ) z+=incr; 446 419 if( z>=zEnd ) return 0; ................................................................................ 450 423 sign = -1; 451 424 z+=incr; 452 425 }else if( *z=='+' ){ 453 426 z+=incr; 454 427 } 455 428 456 429 /* copy max significant digits to significand */ 457 - while( z<zEnd && sqlite3Isdigit(*z) && s<((LARGEST_INT64-9)/10) ){ 430 + while( z<zEnd && sqlite3Isdigit(*z) ){ 458 431 s = s*10 + (*z - '0'); 459 - z+=incr; nDigits++; 460 - } 461 - 432 + z+=incr; nDigit++; 433 + if( s>=((LARGEST_INT64-9)/10) ){ 462 434 /* skip non-significant significand digits 463 435 ** (increase exponent by d to shift decimal left) */ 464 - while( z<zEnd && sqlite3Isdigit(*z) ){ z+=incr; nDigits++; d++; } 436 + while( z<zEnd && sqlite3Isdigit(*z) ){ z+=incr; d++; } 437 + } 438 + } 465 439 if( z>=zEnd ) goto do_atof_calc; 466 440 467 441 /* if decimal point is present */ 468 442 if( *z=='.' ){ 469 443 z+=incr; 444 + eType++; 470 445 /* copy digits from after decimal to significand 471 446 ** (decrease exponent by d to shift decimal right) */ 472 447 while( z<zEnd && sqlite3Isdigit(*z) ){ 473 448 if( s<((LARGEST_INT64-9)/10) ){ 474 449 s = s*10 + (*z - '0'); 475 450 d--; 451 + nDigit++; 476 452 } 477 - z+=incr; nDigits++; 453 + z+=incr; 478 454 } 479 455 } 480 456 if( z>=zEnd ) goto do_atof_calc; 481 457 482 458 /* if exponent is present */ 483 459 if( *z=='e' || *z=='E' ){ 484 460 z+=incr; 485 461 eValid = 0; 462 + eType++; 486 463 487 464 /* This branch is needed to avoid a (harmless) buffer overread. The 488 465 ** special comment alerts the mutation tester that the correct answer 489 466 ** is obtained even if the branch is omitted */ 490 467 if( z>=zEnd ) goto do_atof_calc; /*PREVENTS-HARMLESS-OVERREAD*/ 491 468 492 469 /* get sign of exponent */ ................................................................................ 577 554 } 578 555 } 579 556 580 557 /* store the result */ 581 558 *pResult = result; 582 559 583 560 /* return true if number and no extra non-whitespace chracters after */ 584 - return z==zEnd && nDigits>0 && eValid && nonNum==0; 561 + if( z==zEnd && nDigit>0 && eValid && eType>0 ){ 562 + return eType; 563 + }else if( eType>=2 && (eType==3 || eValid) && nDigit>0 ){ 564 + return -1; 565 + }else{ 566 + return 0; 567 + } 585 568 #else 586 569 return !sqlite3Atoi64(z, pResult, length, enc); 587 570 #endif /* SQLITE_OMIT_FLOATING_POINT */ 588 571 } 589 572 590 573 /* 591 574 ** Compare the 19-character string zNum against the text representation ................................................................................ 620 603 621 604 /* 622 605 ** Convert zNum to a 64-bit signed integer. zNum must be decimal. This 623 606 ** routine does *not* accept hexadecimal notation. 624 607 ** 625 608 ** Returns: 626 609 ** 610 +** -1 Not even a prefix of the input text looks like an integer 627 611 ** 0 Successful transformation. Fits in a 64-bit signed integer. 628 612 ** 1 Excess non-space text after the integer value 629 613 ** 2 Integer too large for a 64-bit signed integer or is malformed 630 614 ** 3 Special case of 9223372036854775808 631 615 ** 632 616 ** length is the number of bytes in the string (bytes, not characters). 633 617 ** The string is not necessarily zero-terminated. The encoding is ................................................................................ 679 663 *pNum = neg ? SMALLEST_INT64 : LARGEST_INT64; 680 664 }else if( neg ){ 681 665 *pNum = -(i64)u; 682 666 }else{ 683 667 *pNum = (i64)u; 684 668 } 685 669 rc = 0; 686 - if( (i==0 && zStart==zNum) /* No digits */ 687 - || nonNum /* UTF16 with high-order bytes non-zero */ 688 - ){ 670 + if( i==0 && zStart==zNum ){ /* No digits */ 671 + rc = -1; 672 + }else if( nonNum ){ /* UTF16 with high-order bytes non-zero */ 689 673 rc = 1; 690 674 }else if( &zNum[i]<zEnd ){ /* Extra bytes at the end */ 691 675 int jj = i; 692 676 do{ 693 677 if( !sqlite3Isspace(zNum[jj]) ){ 694 678 rc = 1; /* Extra non-space text after the integer */ 695 679 break;
Changes to src/vdbe.c.
271 271 pCx->uc.pCursor = (BtCursor*) 272 272 &pMem->z[ROUND8(sizeof(VdbeCursor))+2*sizeof(u32)*nField]; 273 273 sqlite3BtreeCursorZero(pCx->uc.pCursor); 274 274 } 275 275 } 276 276 return pCx; 277 277 } 278 + 279 +/* 280 +** The string in pRec is known to look like an integer and to have a 281 +** floating point value of rValue. Return true and set *piValue to the 282 +** integer value if the string is in range to be an integer. Otherwise, 283 +** return false. 284 +*/ 285 +static int alsoAnInt(Mem *pRec, double rValue, i64 *piValue){ 286 + i64 iValue = (double)rValue; 287 + if( sqlite3RealSameAsInt(rValue,iValue) ){ 288 + *piValue = iValue; 289 + return 1; 290 + } 291 + return 0==sqlite3Atoi64(pRec->z, piValue, pRec->n, pRec->enc); 292 +} 278 293 279 294 /* 280 295 ** Try to convert a value into a numeric representation if we can 281 296 ** do so without loss of information. In other words, if the string 282 297 ** looks like a number, convert it into a number. If it does not 283 298 ** look like a number, leave it alone. 284 299 ** ................................................................................ 289 304 ** 290 305 ** If bTryForInt is false, then if the input string contains a decimal 291 306 ** point or exponential notation, the result is only MEM_Real, even 292 307 ** if there is an exact integer representation of the quantity. 293 308 */ 294 309 static void applyNumericAffinity(Mem *pRec, int bTryForInt){ 295 310 double rValue; 296 - i64 iValue; 297 311 u8 enc = pRec->enc; 312 + int rc; 298 313 assert( (pRec->flags & (MEM_Str|MEM_Int|MEM_Real|MEM_IntReal))==MEM_Str ); 299 - if( sqlite3AtoF(pRec->z, &rValue, pRec->n, enc)==0 ) return; 300 - if( 0==sqlite3Atoi64(pRec->z, &iValue, pRec->n, enc) ){ 301 - pRec->u.i = iValue; 314 + rc = sqlite3AtoF(pRec->z, &rValue, pRec->n, enc); 315 + if( rc<=0 ) return; 316 + if( rc==1 && alsoAnInt(pRec, rValue, &pRec->u.i) ){ 302 317 pRec->flags |= MEM_Int; 303 318 }else{ 304 319 pRec->u.r = rValue; 305 320 pRec->flags |= MEM_Real; 306 321 if( bTryForInt ) sqlite3VdbeIntegerAffinity(pRec); 307 322 } 308 323 /* TEXT->NUMERIC is many->one. Hence, it is important to invalidate the ................................................................................ 394 409 /* 395 410 ** pMem currently only holds a string type (or maybe a BLOB that we can 396 411 ** interpret as a string if we want to). Compute its corresponding 397 412 ** numeric type, if has one. Set the pMem->u.r and pMem->u.i fields 398 413 ** accordingly. 399 414 */ 400 415 static u16 SQLITE_NOINLINE computeNumericType(Mem *pMem){ 416 + int rc; 417 + sqlite3_int64 ix; 401 418 assert( (pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal))==0 ); 402 419 assert( (pMem->flags & (MEM_Str|MEM_Blob))!=0 ); 403 420 ExpandBlob(pMem); 404 - if( sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc)==0 ){ 405 - return 0; 421 + rc = sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc); 422 + if( rc<=0 ){ 423 + if( rc==0 && sqlite3Atoi64(pMem->z, &ix, pMem->n, pMem->enc)<=1 ){ 424 + pMem->u.i = ix; 425 + return MEM_Int; 426 + }else{ 427 + return MEM_Real; 406 428 } 407 - if( sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc)==0 ){ 429 + }else if( rc==1 && sqlite3Atoi64(pMem->z, &ix, pMem->n, pMem->enc)==0 ){ 430 + pMem->u.i = ix; 408 431 return MEM_Int; 409 432 } 410 433 return MEM_Real; 411 434 } 412 435 413 436 /* 414 437 ** Return the numeric type for pMem, either MEM_Int or MEM_Real or both or ................................................................................ 1498 1521 if( sqlite3VdbeMemExpandBlob(pIn2) ) goto no_mem; 1499 1522 flags2 = pIn2->flags & ~MEM_Str; 1500 1523 } 1501 1524 nByte = pIn1->n + pIn2->n; 1502 1525 if( nByte>db->aLimit[SQLITE_LIMIT_LENGTH] ){ 1503 1526 goto too_big; 1504 1527 } 1505 - if( sqlite3VdbeMemGrow(pOut, (int)nByte+2, pOut==pIn2) ){ 1528 + if( sqlite3VdbeMemGrow(pOut, (int)nByte+3, pOut==pIn2) ){ 1506 1529 goto no_mem; 1507 1530 } 1508 1531 MemSetTypeFlag(pOut, MEM_Str); 1509 1532 if( pOut!=pIn2 ){ 1510 1533 memcpy(pOut->z, pIn2->z, pIn2->n); 1511 1534 assert( (pIn2->flags & MEM_Dyn) == (flags2 & MEM_Dyn) ); 1512 1535 pIn2->flags = flags2; 1513 1536 } 1514 1537 memcpy(&pOut->z[pIn2->n], pIn1->z, pIn1->n); 1515 1538 assert( (pIn1->flags & MEM_Dyn) == (flags1 & MEM_Dyn) ); 1516 1539 pIn1->flags = flags1; 1517 1540 pOut->z[nByte]=0; 1518 1541 pOut->z[nByte+1] = 0; 1542 + pOut->z[nByte+2] = 0; 1519 1543 pOut->flags |= MEM_Term; 1520 1544 pOut->n = (int)nByte; 1521 1545 pOut->enc = encoding; 1522 1546 UPDATE_MAX_BLOBSIZE(pOut); 1523 1547 break; 1524 1548 } 1525 1549 ................................................................................ 1562 1586 ** If either operand is NULL, the result is NULL. 1563 1587 */ 1564 1588 case OP_Add: /* same as TK_PLUS, in1, in2, out3 */ 1565 1589 case OP_Subtract: /* same as TK_MINUS, in1, in2, out3 */ 1566 1590 case OP_Multiply: /* same as TK_STAR, in1, in2, out3 */ 1567 1591 case OP_Divide: /* same as TK_SLASH, in1, in2, out3 */ 1568 1592 case OP_Remainder: { /* same as TK_REM, in1, in2, out3 */ 1569 - char bIntint; /* Started out as two integer operands */ 1570 1593 u16 flags; /* Combined MEM_* flags from both inputs */ 1571 1594 u16 type1; /* Numeric type of left operand */ 1572 1595 u16 type2; /* Numeric type of right operand */ 1573 1596 i64 iA; /* Integer value of left operand */ 1574 1597 i64 iB; /* Integer value of right operand */ 1575 1598 double rA; /* Real value of left operand */ 1576 1599 double rB; /* Real value of right operand */ ................................................................................ 1580 1603 pIn2 = &aMem[pOp->p2]; 1581 1604 type2 = numericType(pIn2); 1582 1605 pOut = &aMem[pOp->p3]; 1583 1606 flags = pIn1->flags | pIn2->flags; 1584 1607 if( (type1 & type2 & MEM_Int)!=0 ){ 1585 1608 iA = pIn1->u.i; 1586 1609 iB = pIn2->u.i; 1587 - bIntint = 1; 1588 1610 switch( pOp->opcode ){ 1589 1611 case OP_Add: if( sqlite3AddInt64(&iB,iA) ) goto fp_math; break; 1590 1612 case OP_Subtract: if( sqlite3SubInt64(&iB,iA) ) goto fp_math; break; 1591 1613 case OP_Multiply: if( sqlite3MulInt64(&iB,iA) ) goto fp_math; break; 1592 1614 case OP_Divide: { 1593 1615 if( iA==0 ) goto arithmetic_result_is_null; 1594 1616 if( iA==-1 && iB==SMALLEST_INT64 ) goto fp_math; ................................................................................ 1603 1625 } 1604 1626 } 1605 1627 pOut->u.i = iB; 1606 1628 MemSetTypeFlag(pOut, MEM_Int); 1607 1629 }else if( (flags & MEM_Null)!=0 ){ 1608 1630 goto arithmetic_result_is_null; 1609 1631 }else{ 1610 - bIntint = 0; 1611 1632 fp_math: 1612 1633 rA = sqlite3VdbeRealValue(pIn1); 1613 1634 rB = sqlite3VdbeRealValue(pIn2); 1614 1635 switch( pOp->opcode ){ 1615 1636 case OP_Add: rB += rA; break; 1616 1637 case OP_Subtract: rB -= rA; break; 1617 1638 case OP_Multiply: rB *= rA; break; ................................................................................ 1635 1656 MemSetTypeFlag(pOut, MEM_Int); 1636 1657 #else 1637 1658 if( sqlite3IsNaN(rB) ){ 1638 1659 goto arithmetic_result_is_null; 1639 1660 } 1640 1661 pOut->u.r = rB; 1641 1662 MemSetTypeFlag(pOut, MEM_Real); 1642 - if( ((type1|type2)&(MEM_Real|MEM_IntReal))==0 && !bIntint ){ 1643 - sqlite3VdbeIntegerAffinity(pOut); 1644 - } 1645 1663 #endif 1646 1664 } 1647 1665 break; 1648 1666 1649 1667 arithmetic_result_is_null: 1650 1668 sqlite3VdbeMemSetNull(pOut); 1651 1669 break; ................................................................................ 2880 2898 /* Apply the requested affinity to all inputs 2881 2899 */ 2882 2900 assert( pData0<=pLast ); 2883 2901 if( zAffinity ){ 2884 2902 pRec = pData0; 2885 2903 do{ 2886 2904 applyAffinity(pRec, zAffinity[0], encoding); 2905 + if( zAffinity[0]==SQLITE_AFF_REAL && (pRec->flags & MEM_Int) ){ 2906 + pRec->flags |= MEM_IntReal; 2907 + pRec->flags &= ~(MEM_Int); 2908 + } 2887 2909 REGISTER_TRACE((int)(pRec-aMem), pRec); 2888 2910 zAffinity++; 2889 2911 pRec++; 2890 2912 assert( zAffinity[0]==0 || pRec<=pLast ); 2891 2913 }while( zAffinity[0] ); 2892 2914 } 2893 2915 ................................................................................ 3728 3750 assert( pOp->p1>=0 ); 3729 3751 assert( pOp->p2>=0 ); 3730 3752 pCx = p->apCsr[pOp->p1]; 3731 3753 if( pCx ){ 3732 3754 /* If the ephermeral table is already open, erase all existing content 3733 3755 ** so that the table is empty again, rather than creating a new table. */ 3734 3756 assert( pCx->isEphemeral ); 3757 + pCx->seqCount = 0; 3758 + pCx->cacheStatus = CACHE_STALE; 3735 3759 if( pCx->pBtx ){ 3736 3760 rc = sqlite3BtreeClearTable(pCx->pBtx, pCx->pgnoRoot, 0); 3737 3761 } 3738 3762 }else{ 3739 3763 pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, CURTYPE_BTREE); 3740 3764 if( pCx==0 ) goto no_mem; 3741 - pCx->nullRow = 1; 3742 3765 pCx->isEphemeral = 1; 3743 3766 rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pCx->pBtx, 3744 3767 BTREE_OMIT_JOURNAL | BTREE_SINGLE | pOp->p5, 3745 3768 vfsFlags); 3746 3769 if( rc==SQLITE_OK ){ 3747 3770 rc = sqlite3BtreeBeginTrans(pCx->pBtx, 1, 0); 3748 3771 } ................................................................................ 3770 3793 0, pCx->uc.pCursor); 3771 3794 pCx->isTable = 1; 3772 3795 } 3773 3796 } 3774 3797 pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED); 3775 3798 } 3776 3799 if( rc ) goto abort_due_to_error; 3800 + pCx->nullRow = 1; 3777 3801 break; 3778 3802 } 3779 3803 3780 3804 /* Opcode: SorterOpen P1 P2 P3 P4 * 3781 3805 ** 3782 3806 ** This opcode works like OP_OpenEphemeral except that it opens 3783 3807 ** a transient index that is specifically designed to sort large ................................................................................ 3998 4022 oc = pOp->opcode; 3999 4023 eqOnly = 0; 4000 4024 pC->nullRow = 0; 4001 4025 #ifdef SQLITE_DEBUG 4002 4026 pC->seekOp = pOp->opcode; 4003 4027 #endif 4004 4028 4029 + pC->deferredMoveto = 0; 4030 + pC->cacheStatus = CACHE_STALE; 4005 4031 if( pC->isTable ){ 4006 4032 /* The BTREE_SEEK_EQ flag is only set on index cursors */ 4007 4033 assert( sqlite3BtreeCursorHasHint(pC->uc.pCursor, BTREE_SEEK_EQ)==0 4008 4034 || CORRUPT_DB ); 4009 4035 4010 4036 /* The input value in P3 might be of any type: integer, real, string, 4011 4037 ** blob, or NULL. But it needs to be an integer before we can do ................................................................................ 4102 4128 goto abort_due_to_error; 4103 4129 } 4104 4130 if( eqOnly && r.eqSeen==0 ){ 4105 4131 assert( res!=0 ); 4106 4132 goto seek_not_found; 4107 4133 } 4108 4134 } 4109 - pC->deferredMoveto = 0; 4110 - pC->cacheStatus = CACHE_STALE; 4111 4135 #ifdef SQLITE_TEST 4112 4136 sqlite3_search_count++; 4113 4137 #endif 4114 4138 if( oc>=OP_SeekGE ){ assert( oc==OP_SeekGE || oc==OP_SeekGT ); 4115 4139 if( res<0 || (res==0 && oc==OP_SeekGT) ){ 4116 4140 res = 0; 4117 4141 rc = sqlite3BtreeNext(pC->uc.pCursor, 0); ................................................................................ 4780 4804 4781 4805 #ifdef SQLITE_DEBUG 4782 4806 if( pOp->p4type==P4_TABLE && HasRowid(pOp->p4.pTab) && pOp->p5==0 ){ 4783 4807 /* If p5 is zero, the seek operation that positioned the cursor prior to 4784 4808 ** OP_Delete will have also set the pC->movetoTarget field to the rowid of 4785 4809 ** the row that is being deleted */ 4786 4810 i64 iKey = sqlite3BtreeIntegerKey(pC->uc.pCursor); 4787 - assert( pC->movetoTarget==iKey ); 4811 + assert( CORRUPT_DB || pC->movetoTarget==iKey ); 4788 4812 } 4789 4813 #endif 4790 4814 4791 4815 /* If the update-hook or pre-update-hook will be invoked, set zDb to 4792 4816 ** the name of the db to pass as to it. Also set local pTab to a copy 4793 4817 ** of p4.pTab. Finally, if p5 is true, indicating that this cursor was 4794 4818 ** last moved with OP_Next or OP_Prev, not Seek or NotFound, set
Changes to src/vdbeaux.c.
625 625 ** 626 626 ** assert( sqlite3VdbeAssertMayAbort(pParse->pVdbe, pParse->mayAbort) ); 627 627 */ 628 628 int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){ 629 629 int hasAbort = 0; 630 630 int hasFkCounter = 0; 631 631 int hasCreateTable = 0; 632 + int hasCreateIndex = 0; 632 633 int hasInitCoroutine = 0; 633 634 Op *pOp; 634 635 VdbeOpIter sIter; 635 636 memset(&sIter, 0, sizeof(sIter)); 636 637 sIter.v = v; 637 638 638 639 while( (pOp = opIterNext(&sIter))!=0 ){ ................................................................................ 643 644 || ((opcode==OP_Halt || opcode==OP_HaltIfNull) 644 645 && ((pOp->p1)!=SQLITE_OK && pOp->p2==OE_Abort)) 645 646 ){ 646 647 hasAbort = 1; 647 648 break; 648 649 } 649 650 if( opcode==OP_CreateBtree && pOp->p3==BTREE_INTKEY ) hasCreateTable = 1; 651 + if( mayAbort ){ 652 + /* hasCreateIndex may also be set for some DELETE statements that use 653 + ** OP_Clear. So this routine may end up returning true in the case 654 + ** where a "DELETE FROM tbl" has a statement-journal but does not 655 + ** require one. This is not so bad - it is an inefficiency, not a bug. */ 656 + if( opcode==OP_CreateBtree && pOp->p3==BTREE_BLOBKEY ) hasCreateIndex = 1; 657 + if( opcode==OP_Clear ) hasCreateIndex = 1; 658 + } 650 659 if( opcode==OP_InitCoroutine ) hasInitCoroutine = 1; 651 660 #ifndef SQLITE_OMIT_FOREIGN_KEY 652 661 if( opcode==OP_FkCounter && pOp->p1==0 && pOp->p2==1 ){ 653 662 hasFkCounter = 1; 654 663 } 655 664 #endif 656 665 } ................................................................................ 658 667 659 668 /* Return true if hasAbort==mayAbort. Or if a malloc failure occurred. 660 669 ** If malloc failed, then the while() loop above may not have iterated 661 670 ** through all opcodes and hasAbort may be set incorrectly. Return 662 671 ** true for this case to prevent the assert() in the callers frame 663 672 ** from failing. */ 664 673 return ( v->db->mallocFailed || hasAbort==mayAbort || hasFkCounter 665 - || (hasCreateTable && hasInitCoroutine) ); 674 + || (hasCreateTable && hasInitCoroutine) || hasCreateIndex 675 + ); 666 676 } 667 677 #endif /* SQLITE_DEBUG - the sqlite3AssertMayAbort() function */ 668 678 669 679 #ifdef SQLITE_DEBUG 670 680 /* 671 681 ** Increment the nWrite counter in the VDBE if the cursor is not an 672 682 ** ephemeral cursor, or if the cursor argument is NULL. ................................................................................ 3638 3648 ** and store the result in pMem. Return the number of bytes read. 3639 3649 ** 3640 3650 ** This function is implemented as two separate routines for performance. 3641 3651 ** The few cases that require local variables are broken out into a separate 3642 3652 ** routine so that in most cases the overhead of moving the stack pointer 3643 3653 ** is avoided. 3644 3654 */ 3645 -static u32 SQLITE_NOINLINE serialGet( 3655 +static u32 serialGet( 3646 3656 const unsigned char *buf, /* Buffer to deserialize from */ 3647 3657 u32 serial_type, /* Serial type to deserialize */ 3648 3658 Mem *pMem /* Memory cell to write value into */ 3649 3659 ){ 3650 3660 u64 x = FOUR_BYTE_UINT(buf); 3651 3661 u32 y = FOUR_BYTE_UINT(buf+4); 3652 3662 x = (x<<32) + y; ................................................................................ 3670 3680 u64 t2 = t1; 3671 3681 swapMixedEndianFloat(t2); 3672 3682 assert( sizeof(r1)==sizeof(t2) && memcmp(&r1, &t2, sizeof(r1))==0 ); 3673 3683 #endif 3674 3684 assert( sizeof(x)==8 && sizeof(pMem->u.r)==8 ); 3675 3685 swapMixedEndianFloat(x); 3676 3686 memcpy(&pMem->u.r, &x, sizeof(x)); 3677 - pMem->flags = sqlite3IsNaN(pMem->u.r) ? MEM_Null : MEM_Real; 3687 + pMem->flags = IsNaN(x) ? MEM_Null : MEM_Real; 3678 3688 } 3679 3689 return 8; 3680 3690 } 3681 3691 u32 sqlite3VdbeSerialGet( 3682 3692 const unsigned char *buf, /* Buffer to deserialize from */ 3683 3693 u32 serial_type, /* Serial type to deserialize */ 3684 3694 Mem *pMem /* Memory cell to write value into */
Changes to src/vdbemem.c.
114 114 } 115 115 assert( acc.zText==zBuf && acc.mxAlloc<=0 ); 116 116 zBuf[acc.nChar] = 0; /* Fast version of sqlite3StrAccumFinish(&acc) */ 117 117 } 118 118 119 119 #ifdef SQLITE_DEBUG 120 120 /* 121 -** Check that string value of pMem agrees with its integer or real value. 121 +** Validity checks on pMem. pMem holds a string. 122 +** 123 +** (1) Check that string value of pMem agrees with its integer or real value. 124 +** (2) Check that the string is correctly zero terminated 122 125 ** 123 126 ** A single int or real value always converts to the same strings. But 124 127 ** many different strings can be converted into the same int or real. 125 128 ** If a table contains a numeric value and an index is based on the 126 129 ** corresponding string value, then it is important that the string be 127 130 ** derived from the numeric value, not the other way around, to ensure 128 131 ** that the index and table are consistent. See ticket ................................................................................ 132 135 ** This routine looks at pMem to verify that if it has both a numeric 133 136 ** representation and a string representation then the string rep has 134 137 ** been derived from the numeric and not the other way around. It returns 135 138 ** true if everything is ok and false if there is a problem. 136 139 ** 137 140 ** This routine is for use inside of assert() statements only. 138 141 */ 139 -int sqlite3VdbeMemConsistentDualRep(Mem *p){ 142 +int sqlite3VdbeMemValidStrRep(Mem *p){ 140 143 char zBuf[100]; 141 144 char *z; 142 145 int i, j, incr; 143 146 if( (p->flags & MEM_Str)==0 ) return 1; 147 + if( p->flags & MEM_Term ){ 148 + /* Insure that the string is properly zero-terminated. Pay particular 149 + ** attention to the case where p->n is odd */ 150 + if( p->szMalloc>0 && p->z==p->zMalloc ){ 151 + assert( p->enc==SQLITE_UTF8 || p->szMalloc >= ((p->n+1)&~1)+2 ); 152 + assert( p->enc!=SQLITE_UTF8 || p->szMalloc >= p->n+1 ); 153 + } 154 + assert( p->z[p->n]==0 ); 155 + assert( p->enc==SQLITE_UTF8 || p->z[(p->n+1)&~1]==0 ); 156 + assert( p->enc==SQLITE_UTF8 || p->z[((p->n+1)&~1)+1]==0 ); 157 + } 144 158 if( (p->flags & (MEM_Int|MEM_Real|MEM_IntReal))==0 ) return 1; 145 159 vdbeMemRenderNum(sizeof(zBuf), zBuf, p); 146 160 z = p->z; 147 161 i = j = 0; 148 162 incr = 1; 149 163 if( p->enc!=SQLITE_UTF8 ){ 150 164 incr = 2; ................................................................................ 674 688 pMem->u.r = sqlite3VdbeRealValue(pMem); 675 689 MemSetTypeFlag(pMem, MEM_Real); 676 690 return SQLITE_OK; 677 691 } 678 692 679 693 /* Compare a floating point value to an integer. Return true if the two 680 694 ** values are the same within the precision of the floating point value. 695 +** 696 +** This function assumes that i was obtained by assignment from r1. 681 697 ** 682 698 ** For some versions of GCC on 32-bit machines, if you do the more obvious 683 699 ** comparison of "r1==(double)i" you sometimes get an answer of false even 684 700 ** though the r1 and (double)i values are bit-for-bit the same. 685 701 */ 686 -static int sqlite3RealSameAsInt(double r1, sqlite3_int64 i){ 702 +int sqlite3RealSameAsInt(double r1, sqlite3_int64 i){ 687 703 double r2 = (double)i; 688 - return memcmp(&r1, &r2, sizeof(r1))==0; 704 + return r1==0.0 705 + || (memcmp(&r1, &r2, sizeof(r1))==0 706 + && i >= -2251799813685248 && i < 2251799813685248); 689 707 } 690 708 691 709 /* 692 710 ** Convert pMem so that it has type MEM_Real or MEM_Int. 693 711 ** Invalidate any prior representations. 694 712 ** 695 713 ** Every effort is made to force the conversion, even if the input ................................................................................ 699 717 int sqlite3VdbeMemNumerify(Mem *pMem){ 700 718 testcase( pMem->flags & MEM_Int ); 701 719 testcase( pMem->flags & MEM_Real ); 702 720 testcase( pMem->flags & MEM_IntReal ); 703 721 testcase( pMem->flags & MEM_Null ); 704 722 if( (pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal|MEM_Null))==0 ){ 705 723 int rc; 724 + sqlite3_int64 ix; 706 725 assert( (pMem->flags & (MEM_Blob|MEM_Str))!=0 ); 707 726 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); 708 - rc = sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc); 709 - if( rc==0 ){ 710 - MemSetTypeFlag(pMem, MEM_Int); 711 - }else{ 712 - i64 i = pMem->u.i; 713 - sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc); 714 - if( rc==1 && sqlite3RealSameAsInt(pMem->u.r, i) ){ 715 - pMem->u.i = i; 727 + rc = sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc); 728 + if( ((rc==0 || rc==1) && sqlite3Atoi64(pMem->z, &ix, pMem->n, pMem->enc)<=1) 729 + || sqlite3RealSameAsInt(pMem->u.r, (ix = (i64)pMem->u.r)) 730 + ){ 731 + pMem->u.i = ix; 716 732 MemSetTypeFlag(pMem, MEM_Int); 717 733 }else{ 718 734 MemSetTypeFlag(pMem, MEM_Real); 719 735 } 720 736 } 721 - } 722 737 assert( (pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal|MEM_Null))!=0 ); 723 738 pMem->flags &= ~(MEM_Str|MEM_Blob|MEM_Zero); 724 739 return SQLITE_OK; 725 740 } 726 741 727 742 /* 728 743 ** Cast the datatype of the value in pMem according to the affinity ................................................................................ 1217 1232 }else{ 1218 1233 sqlite3VdbeMemStringify(pVal, enc, 0); 1219 1234 assert( 0==(1&SQLITE_PTR_TO_INT(pVal->z)) ); 1220 1235 } 1221 1236 assert(pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) || pVal->db==0 1222 1237 || pVal->db->mallocFailed ); 1223 1238 if( pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) ){ 1224 - assert( sqlite3VdbeMemConsistentDualRep(pVal) ); 1239 + assert( sqlite3VdbeMemValidStrRep(pVal) ); 1225 1240 return pVal->z; 1226 1241 }else{ 1227 1242 return 0; 1228 1243 } 1229 1244 } 1230 1245 1231 1246 /* This function is only available internally, it is not part of the ................................................................................ 1240 1255 */ 1241 1256 const void *sqlite3ValueText(sqlite3_value* pVal, u8 enc){ 1242 1257 if( !pVal ) return 0; 1243 1258 assert( pVal->db==0 || sqlite3_mutex_held(pVal->db->mutex) ); 1244 1259 assert( (enc&3)==(enc&~SQLITE_UTF16_ALIGNED) ); 1245 1260 assert( !sqlite3VdbeMemIsRowSet(pVal) ); 1246 1261 if( (pVal->flags&(MEM_Str|MEM_Term))==(MEM_Str|MEM_Term) && pVal->enc==enc ){ 1247 - assert( sqlite3VdbeMemConsistentDualRep(pVal) ); 1262 + assert( sqlite3VdbeMemValidStrRep(pVal) ); 1248 1263 return pVal->z; 1249 1264 } 1250 1265 if( pVal->flags&MEM_Null ){ 1251 1266 return 0; 1252 1267 } 1253 1268 return valueToText(pVal, enc); 1254 1269 }
Changes to src/where.c.
558 558 /* 559 559 ** Convert OP_Column opcodes to OP_Copy in previously generated code. 560 560 ** 561 561 ** This routine runs over generated VDBE code and translates OP_Column 562 562 ** opcodes into OP_Copy when the table is being accessed via co-routine 563 563 ** instead of via table lookup. 564 564 ** 565 -** If the bIncrRowid parameter is 0, then any OP_Rowid instructions on 566 -** cursor iTabCur are transformed into OP_Null. Or, if bIncrRowid is non-zero, 567 -** then each OP_Rowid is transformed into an instruction to increment the 568 -** value stored in its output register. 565 +** If the iAutoidxCur is not zero, then any OP_Rowid instructions on 566 +** cursor iTabCur are transformed into OP_Sequence opcode for the 567 +** iAutoidxCur cursor, in order to generate unique rowids for the 568 +** automatic index being generated. 569 569 */ 570 570 static void translateColumnToCopy( 571 571 Parse *pParse, /* Parsing context */ 572 572 int iStart, /* Translate from this opcode to the end */ 573 573 int iTabCur, /* OP_Column/OP_Rowid references to this table */ 574 574 int iRegister, /* The first column is in this register */ 575 - int bIncrRowid /* If non-zero, transform OP_rowid to OP_AddImm(1) */ 575 + int iAutoidxCur /* If non-zero, cursor of autoindex being generated */ 576 576 ){ 577 577 Vdbe *v = pParse->pVdbe; 578 578 VdbeOp *pOp = sqlite3VdbeGetOp(v, iStart); 579 579 int iEnd = sqlite3VdbeCurrentAddr(v); 580 580 if( pParse->db->mallocFailed ) return; 581 581 for(; iStart<iEnd; iStart++, pOp++){ 582 582 if( pOp->p1!=iTabCur ) continue; 583 583 if( pOp->opcode==OP_Column ){ 584 584 pOp->opcode = OP_Copy; 585 585 pOp->p1 = pOp->p2 + iRegister; 586 586 pOp->p2 = pOp->p3; 587 587 pOp->p3 = 0; 588 588 }else if( pOp->opcode==OP_Rowid ){ 589 - if( bIncrRowid ){ 590 - /* Increment the value stored in the P2 operand of the OP_Rowid. */ 591 - pOp->opcode = OP_AddImm; 592 - pOp->p1 = pOp->p2; 593 - pOp->p2 = 1; 589 + if( iAutoidxCur ){ 590 + pOp->opcode = OP_Sequence; 591 + pOp->p1 = iAutoidxCur; 594 592 }else{ 595 593 pOp->opcode = OP_Null; 596 594 pOp->p1 = 0; 597 595 pOp->p3 = 0; 598 596 } 599 597 } 600 598 } ................................................................................ 860 858 ); 861 859 sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord); 862 860 sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); 863 861 if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue); 864 862 if( pTabItem->fg.viaCoroutine ){ 865 863 sqlite3VdbeChangeP2(v, addrCounter, regBase+n); 866 864 testcase( pParse->db->mallocFailed ); 865 + assert( pLevel->iIdxCur>0 ); 867 866 translateColumnToCopy(pParse, addrTop, pLevel->iTabCur, 868 - pTabItem->regResult, 1); 867 + pTabItem->regResult, pLevel->iIdxCur); 869 868 sqlite3VdbeGoto(v, addrTop); 870 869 pTabItem->fg.viaCoroutine = 0; 871 870 }else{ 872 871 sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v); 873 872 } 874 873 sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX); 875 874 sqlite3VdbeJumpHere(v, addrTop);
Changes to src/whereexpr.c.
260 260 for(iFrom=iTo=0; iFrom<cnt; iFrom++){ 261 261 if( zNew[iFrom]==wc[3] ) iFrom++; 262 262 zNew[iTo++] = zNew[iFrom]; 263 263 } 264 264 zNew[iTo] = 0; 265 265 assert( iTo>0 ); 266 266 267 - /* If the RHS begins with a digit or a +/- sign, then the LHS must be 268 - ** an ordinary column (not a virtual table column) with TEXT affinity. 269 - ** Otherwise the LHS might be numeric and "lhs >= rhs" would be false 270 - ** even though "lhs LIKE rhs" is true. But if the RHS does not start 271 - ** with a digit or +/-, then "lhs LIKE rhs" will always be false if 272 - ** the LHS is numeric and so the optimization still works. 267 + /* If the LHS is not an ordinary column with TEXT affinity, then the 268 + ** pattern prefix boundaries (both the start and end boundaries) must 269 + ** not look like a number. Otherwise the pattern might be treated as 270 + ** a number, which will invalidate the LIKE optimization. 273 271 ** 274 - ** 2018-09-10 ticket c94369cae9b561b1f996d0054bfab11389f9d033 275 - ** The RHS pattern must not be '/%' because the termination condition 276 - ** will then become "x<'0'" and if the affinity is numeric, will then 277 - ** be converted into "x<0", which is incorrect. 272 + ** Getting this right has been a persistent source of bugs in the 273 + ** LIKE optimization. See, for example: 274 + ** 2018-09-10 https://sqlite.org/src/info/c94369cae9b561b1 275 + ** 2019-05-02 https://sqlite.org/src/info/b043a54c3de54b28 276 + ** 2019-06-10 https://sqlite.org/src/info/fd76310a5e843e07 277 + ** 2019-06-14 https://sqlite.org/src/info/ce8717f0885af975 278 278 */ 279 - if( sqlite3Isdigit(zNew[0]) 280 - || zNew[0]=='-' 281 - || zNew[0]=='+' 282 - || zNew[iTo-1]=='0'-1 283 - ){ 284 279 if( pLeft->op!=TK_COLUMN 285 280 || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT 286 281 || IsVirtual(pLeft->y.pTab) /* Value might be numeric */ 287 282 ){ 283 + int isNum; 284 + double rDummy; 285 + isNum = sqlite3AtoF(zNew, &rDummy, iTo, SQLITE_UTF8); 286 + if( isNum<=0 ){ 287 + zNew[iTo-1]++; 288 + isNum = sqlite3AtoF(zNew, &rDummy, iTo, SQLITE_UTF8); 289 + zNew[iTo-1]--; 290 + } 291 + if( isNum>0 ){ 288 292 sqlite3ExprDelete(db, pPrefix); 289 293 sqlite3ValueFree(pVal); 290 294 return 0; 291 295 } 292 296 } 293 297 } 294 298 *ppPrefix = pPrefix;
Changes to src/window.c.
732 732 ** selectWindowRewriteExprCb() by selectWindowRewriteEList(). 733 733 */ 734 734 typedef struct WindowRewrite WindowRewrite; 735 735 struct WindowRewrite { 736 736 Window *pWin; 737 737 SrcList *pSrc; 738 738 ExprList *pSub; 739 + Table *pTab; 739 740 Select *pSubSelect; /* Current sub-select, if any */ 740 741 }; 741 742 742 743 /* 743 744 ** Callback function used by selectWindowRewriteEList(). If necessary, 744 745 ** this function appends to the output expression-list and updates 745 746 ** expression (*ppExpr) in place. ................................................................................ 792 793 sqlite3ExprDelete(pParse->db, pExpr); 793 794 ExprClearProperty(pExpr, EP_Static); 794 795 memset(pExpr, 0, sizeof(Expr)); 795 796 796 797 pExpr->op = TK_COLUMN; 797 798 pExpr->iColumn = p->pSub->nExpr-1; 798 799 pExpr->iTable = p->pWin->iEphCsr; 800 + pExpr->y.pTab = p->pTab; 799 801 } 800 802 801 803 break; 802 804 } 803 805 804 806 default: /* no-op */ 805 807 break; ................................................................................ 835 837 ** appending the new one. 836 838 */ 837 839 static void selectWindowRewriteEList( 838 840 Parse *pParse, 839 841 Window *pWin, 840 842 SrcList *pSrc, 841 843 ExprList *pEList, /* Rewrite expressions in this list */ 844 + Table *pTab, 842 845 ExprList **ppSub /* IN/OUT: Sub-select expression-list */ 843 846 ){ 844 847 Walker sWalker; 845 848 WindowRewrite sRewrite; 846 849 847 850 memset(&sWalker, 0, sizeof(Walker)); 848 851 memset(&sRewrite, 0, sizeof(WindowRewrite)); 849 852 850 853 sRewrite.pSub = *ppSub; 851 854 sRewrite.pWin = pWin; 852 855 sRewrite.pSrc = pSrc; 856 + sRewrite.pTab = pTab; 853 857 854 858 sWalker.pParse = pParse; 855 859 sWalker.xExprCallback = selectWindowRewriteExprCb; 856 860 sWalker.xSelectCallback = selectWindowRewriteSelectCb; 857 861 sWalker.u.pRewrite = &sRewrite; 858 862 859 863 (void)sqlite3WalkExprList(&sWalker, pEList); ................................................................................ 905 909 ExprList *pGroupBy = p->pGroupBy; 906 910 Expr *pHaving = p->pHaving; 907 911 ExprList *pSort = 0; 908 912 909 913 ExprList *pSublist = 0; /* Expression list for sub-query */ 910 914 Window *pMWin = p->pWin; /* Master window object */ 911 915 Window *pWin; /* Window object iterator */ 916 + Table *pTab; 917 + 918 + pTab = sqlite3DbMallocZero(db, sizeof(Table)); 919 + if( pTab==0 ){ 920 + return SQLITE_NOMEM; 921 + } 912 922 913 923 p->pSrc = 0; 914 924 p->pWhere = 0; 915 925 p->pGroupBy = 0; 916 926 p->pHaving = 0; 927 + p->selFlags &= ~SF_Aggregate; 917 928 918 929 /* Create the ORDER BY clause for the sub-select. This is the concatenation 919 930 ** of the window PARTITION and ORDER BY clauses. Then, if this makes it 920 931 ** redundant, remove the ORDER BY from the parent SELECT. */ 921 932 pSort = sqlite3ExprListDup(db, pMWin->pPartition, 0); 922 933 pSort = exprListAppendList(pParse, pSort, pMWin->pOrderBy, 1); 923 934 if( pSort && p->pOrderBy ){ ................................................................................ 929 940 930 941 /* Assign a cursor number for the ephemeral table used to buffer rows. 931 942 ** The OpenEphemeral instruction is coded later, after it is known how 932 943 ** many columns the table will have. */ 933 944 pMWin->iEphCsr = pParse->nTab++; 934 945 pParse->nTab += 3; 935 946 936 - selectWindowRewriteEList(pParse, pMWin, pSrc, p->pEList, &pSublist); 937 - selectWindowRewriteEList(pParse, pMWin, pSrc, p->pOrderBy, &pSublist); 947 + selectWindowRewriteEList(pParse, pMWin, pSrc, p->pEList, pTab, &pSublist); 948 + selectWindowRewriteEList(pParse, pMWin, pSrc, p->pOrderBy, pTab, &pSublist); 938 949 pMWin->nBufferCol = (pSublist ? pSublist->nExpr : 0); 939 950 940 951 /* Append the PARTITION BY and ORDER BY expressions to the to the 941 952 ** sub-select expression list. They are required to figure out where 942 953 ** boundaries for partitions and sets of peer rows lie. */ 943 954 pSublist = exprListAppendList(pParse, pSublist, pMWin->pPartition, 0); 944 955 pSublist = exprListAppendList(pParse, pSublist, pMWin->pOrderBy, 0); ................................................................................ 972 983 } 973 984 974 985 pSub = sqlite3SelectNew( 975 986 pParse, pSublist, pSrc, pWhere, pGroupBy, pHaving, pSort, 0, 0 976 987 ); 977 988 p->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0); 978 989 if( p->pSrc ){ 990 + Table *pTab2; 979 991 p->pSrc->a[0].pSelect = pSub; 980 992 sqlite3SrcListAssignCursors(pParse, p->pSrc); 981 - if( sqlite3ExpandSubquery(pParse, &p->pSrc->a[0]) ){ 993 + pSub->selFlags |= SF_Expanded; 994 + pTab2 = sqlite3ResultSetOfSelect(pParse, pSub); 995 + if( pTab2==0 ){ 982 996 rc = SQLITE_NOMEM; 983 997 }else{ 984 - pSub->selFlags |= SF_Expanded; 985 - p->selFlags &= ~SF_Aggregate; 986 - sqlite3SelectPrep(pParse, pSub, 0); 998 + memcpy(pTab, pTab2, sizeof(Table)); 999 + pTab->tabFlags |= TF_Ephemeral; 1000 + p->pSrc->a[0].pTab = pTab; 1001 + pTab = pTab2; 987 1002 } 988 - 989 1003 sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pMWin->iEphCsr, pSublist->nExpr); 990 1004 sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+1, pMWin->iEphCsr); 991 1005 sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+2, pMWin->iEphCsr); 992 1006 sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+3, pMWin->iEphCsr); 993 1007 }else{ 994 1008 sqlite3SelectDelete(db, pSub); 995 1009 } 996 1010 if( db->mallocFailed ) rc = SQLITE_NOMEM; 1011 + sqlite3DbFree(db, pTab); 997 1012 } 998 1013 999 1014 return rc; 1000 1015 } 1001 1016 1002 1017 /* 1003 1018 ** Free the Window object passed as the second argument.
Changes to test/altertab2.test.
334 334 do_catchsql_test 8.2 { 335 335 ALTER TABLE t1 RENAME a TO aaa; 336 336 } {1 {error in trigger tr after rename: no such column: a}} 337 337 do_execsql_test 8.3 { 338 338 INSERT INTO t3 VALUES(4, 5, 6); 339 339 } 340 340 341 -do_execsql_test 8.1 { 341 +do_execsql_test 8.4 { 342 342 CREATE TABLE t4(a, b); 343 343 CREATE VIEW v4 AS SELECT * FROM t4 WHERE (a=1 AND 0) OR b=2; 344 344 } 345 -do_execsql_test 8.2 { 345 + 346 +# Do not rename branches of an expression tree that is optimized out by 347 +# the AND optimization. 348 +# 349 +do_execsql_test 8.5 { 346 350 ALTER TABLE t4 RENAME a TO c; 347 351 SELECT sql FROM sqlite_master WHERE name = 'v4' 348 -} {{CREATE VIEW v4 AS SELECT * FROM t4 WHERE (c=1 AND 0) OR b=2}} 352 +} {{CREATE VIEW v4 AS SELECT * FROM t4 WHERE (a=1 AND 0) OR b=2}} 353 +# "a" is not renamed to "c" ---^ 354 + 355 +# 2019-06-10 https://www.sqlite.org/src/info/533010b8cacebe82 356 +reset_db 357 +do_execsql_test 8.6 { 358 + CREATE TABLE t0(c0); 359 + CREATE INDEX i0 ON t0(LIKELIHOOD(1,2) AND 0); 360 + ALTER TABLE t0 RENAME TO t1; 361 + SELECT sql FROM sqlite_master WHERE name='i0'; 362 +} {{CREATE INDEX i0 ON "t1"(LIKELIHOOD(1,2) AND 0)}} 349 363 350 364 finish_test 351 - 352 -
Changes to test/altertab3.test.
75 75 76 76 do_execsql_test 3.1 { 77 77 ALTER TABLE t1 RENAME b TO bbb; 78 78 } 79 79 80 80 do_execsql_test 3.2 { 81 81 SELECT sql FROM sqlite_master WHERE name = 'v1' 82 -} {{CREATE VIEW v1 AS SELECT * FROM t1 WHERE a=1 OR (bbb IN ())}} 82 +} {{CREATE VIEW v1 AS SELECT * FROM t1 WHERE a=1 OR (b IN ())}} 83 83 84 84 #------------------------------------------------------------------------- 85 85 reset_db 86 86 do_execsql_test 4.0 { 87 87 CREATE TABLE t1(a, b); 88 88 CREATE TABLE t3(e, f); 89 89 CREATE TRIGGER tr1 AFTER INSERT ON t1 BEGIN ................................................................................ 171 171 END; 172 172 } 173 173 174 174 do_catchsql_test 7.2.2 { 175 175 ALTER TABLE t1x RENAME TO t1; 176 176 } {1 {error in trigger AFTER: no such column: d}} 177 177 178 -finish_test 178 +#------------------------------------------------------------------------- 179 +reset_db 180 +do_execsql_test 8.0 { 181 + CREATE TABLE t0(c0); 182 + CREATE INDEX i0 ON t0('1' IN ()); 183 +} 184 +do_execsql_test 8.1 { 185 + ALTER TABLE t0 RENAME TO t1; 186 + SELECT sql FROM sqlite_master; 187 +} { 188 + {CREATE TABLE "t1"(c0)} 189 + {CREATE INDEX i0 ON "t1"('1' IN ())} 190 +} 191 +do_execsql_test 8.2.1 { 192 + CREATE TABLE t2 (c0); 193 + CREATE INDEX i2 ON t2((LIKELIHOOD(c0, 100) IN ())); 194 + ALTER TABLE t2 RENAME COLUMN c0 TO c1; 195 +} 196 +do_execsql_test 8.2.2 { 197 + SELECT sql FROM sqlite_master WHERE tbl_name = 't2'; 198 +} { 199 + {CREATE TABLE t2 (c1)} 200 + {CREATE INDEX i2 ON t2((LIKELIHOOD(c0, 100) IN ()))} 201 +} 202 +do_test 8.2.3 { 203 + sqlite3 db2 test.db 204 + db2 eval { INSERT INTO t2 VALUES (1), (2), (3) } 205 + db close 206 +} {} 207 +db2 close 208 + 209 +#------------------------------------------------------------------------- 210 +reset_db 211 +do_execsql_test 9.1 { 212 + CREATE TABLE t1(a,b,c); 213 + CREATE TRIGGER AFTER INSERT ON t1 WHEN new.a NOT NULL BEGIN 214 + SELECT true WHERE (SELECT a, b FROM (t1)) IN (); 215 + END; 216 +} 217 +do_execsql_test 9.2 { 218 + ALTER TABLE t1 RENAME TO t1x; 219 +} 220 + 221 +#------------------------------------------------------------------------- 222 +reset_db 223 +do_execsql_test 10.1 { 224 + CREATE TABLE t1(a, b, c); 225 + CREATE TABLE t2(a, b, c); 226 + CREATE VIEW v1 AS SELECT * FROM t1 WHERE ( 227 + SELECT t1.a FROM t1, t2 228 + ) IN () OR t1.a=5; 229 +} 230 + 231 +do_execsql_test 10.2 { 232 + ALTER TABLE t2 RENAME TO t3; 233 + SELECT sql FROM sqlite_master WHERE name='v1'; 234 +} { 235 + {CREATE VIEW v1 AS SELECT * FROM t1 WHERE ( 236 + SELECT t1.a FROM t1, t2 237 + ) IN () OR t1.a=5} 238 +} 179 239 180 240 241 +finish_test
Changes to test/autoindex5.test.
119 119 UNION ALL 120 120 SELECT 0, 0 WHERE 0; 121 121 122 122 SELECT ( 123 123 SELECT sum(z) FROM vvv WHERE x='aaa' 124 124 ) FROM one; 125 125 } {8.0} 126 +do_execsql_test 2.2 { 127 + DROP TABLE t1; 128 + CREATE TABLE t1(aaa); 129 + INSERT INTO t1(aaa) VALUES(9); 130 + SELECT ( 131 + SELECT aaa FROM t1 GROUP BY ( 132 + SELECT bbb FROM ( 133 + SELECT ccc AS bbb FROM ( 134 + SELECT 1 ccc 135 + ) WHERE rowid IS NOT 1 136 + ) WHERE bbb = 1 137 + ) 138 + ); 139 +} {9} 126 140 127 141 # Ticket https://www.sqlite.org/src/info/787fa716be3a7f65 128 142 # Segfault due to multiple uses of the same subquery where the 129 143 # subquery is implemented via coroutine. 130 144 # 131 145 ifcapable windowfunc { 132 146 sqlite3 db :memory:
Changes to test/between.test.
115 115 } {4 2 25 27 sort t1 i1zyx} 116 116 do_test between-1.5.3 { 117 117 queryplan { 118 118 SELECT * FROM t1 WHERE 26 BETWEEN y AND +z ORDER BY +w 119 119 } 120 120 } {4 2 25 27 sort t1 *} 121 121 122 +#------------------------------------------------------------------------- 123 +reset_db 124 +do_execsql_test between-2.0 { 125 + CREATE TABLE t1(x TEXT, y TEXT COLLATE nocase); 126 + INSERT INTO t1 VALUES('0', 'abc'); 127 +} 128 + 129 +foreach {tn expr res} { 130 + 1 "x BETWEEN 1 AND '5'" 0 131 + 2 "x COLLATE binary BETWEEN 1 AND '5'" 0 132 + 3 "x COLLATE nocase BETWEEN 1 AND '5'" 0 133 + 134 + 4 "y BETWEEN 'A' AND 'B'" 1 135 + 5 "y COLLATE nocase BETWEEN 'A' AND 'B'" 1 136 + 6 "y COLLATE binary BETWEEN 'A' AND 'B'" 0 137 + 7 "(y COLLATE binary) BETWEEN 'A' AND 'B'" 0 138 +} { 139 + set sql "SELECT $expr FROM t1" 140 + do_execsql_test between-2.1.$tn $sql $res 141 +} 122 142 123 143 finish_test
Changes to test/cast.test.
179 179 do_test cast-1.51 { 180 180 execsql {SELECT CAST('123.5abc' AS numeric)} 181 181 } 123.5 182 182 do_test cast-1.53 { 183 183 execsql {SELECT CAST('123.5abc' AS integer)} 184 184 } 123 185 185 186 -do_test case-1.60 { 186 +do_test cast-1.60 { 187 187 execsql {SELECT CAST(null AS REAL)} 188 188 } {{}} 189 -do_test case-1.61 { 189 +do_test cast-1.61 { 190 190 execsql {SELECT typeof(CAST(null AS REAL))} 191 191 } {null} 192 -do_test case-1.62 { 192 +do_test cast-1.62 { 193 193 execsql {SELECT CAST(1 AS REAL)} 194 194 } {1.0} 195 -do_test case-1.63 { 195 +do_test cast-1.63 { 196 196 execsql {SELECT typeof(CAST(1 AS REAL))} 197 197 } {real} 198 -do_test case-1.64 { 198 +do_test cast-1.64 { 199 199 execsql {SELECT CAST('1' AS REAL)} 200 200 } {1.0} 201 -do_test case-1.65 { 201 +do_test cast-1.65 { 202 202 execsql {SELECT typeof(CAST('1' AS REAL))} 203 203 } {real} 204 -do_test case-1.66 { 204 +do_test cast-1.66 { 205 205 execsql {SELECT CAST('abc' AS REAL)} 206 206 } {0.0} 207 -do_test case-1.67 { 207 +do_test cast-1.67 { 208 208 execsql {SELECT typeof(CAST('abc' AS REAL))} 209 209 } {real} 210 -do_test case-1.68 { 210 +do_test cast-1.68 { 211 211 execsql {SELECT CAST(x'31' AS REAL)} 212 212 } {1.0} 213 -do_test case-1.69 { 213 +do_test cast-1.69 { 214 214 execsql {SELECT typeof(CAST(x'31' AS REAL))} 215 215 } {real} 216 216 217 217 218 218 # Ticket #1662. Ignore leading spaces in numbers when casting. 219 219 # 220 220 do_test cast-2.1 { ................................................................................ 295 295 execsql { 296 296 SELECT CAST(CAST(x'39323233333732303336383534373734383030' AS real) 297 297 AS integer) 298 298 } 299 299 } 9223372036854774784 300 300 } 301 301 } 302 -do_test case-3.31 { 302 +do_test cast-3.31 { 303 303 execsql {SELECT CAST(NULL AS numeric)} 304 304 } {{}} 305 305 306 306 # Test to see if it is possible to trick SQLite into reading past 307 307 # the end of a blob when converting it to a number. 308 308 do_test cast-3.32.1 { 309 309 set blob "1234567890" ................................................................................ 364 364 } {-9223372036854775808 -9223372036854775808 -9223372036854775808} 365 365 366 366 # EVIDENCE-OF: R-33990-33527 When casting to INTEGER, if the text looks 367 367 # like a floating point value with an exponent, the exponent will be 368 368 # ignored because it is no part of the integer prefix. 369 369 # EVIDENCE-OF: R-24225-46995 For example, "(CAST '123e+5' AS INTEGER)" 370 370 # results in 123, not in 12300000. 371 -do_execsql_test case-5.3 { 371 +do_execsql_test cast-5.3 { 372 372 SELECT CAST('123e+5' AS INTEGER); 373 373 SELECT CAST('123e+5' AS NUMERIC); 374 -} {123 12300000.0} 374 + SELECT CAST('123e+5' AS REAL); 375 +} {123 12300000 12300000.0} 375 376 376 377 377 378 # The following does not have anything to do with the CAST operator, 378 379 # but it does deal with affinity transformations. 379 380 # 380 -do_execsql_test case-6.1 { 381 +do_execsql_test cast-6.1 { 381 382 DROP TABLE IF EXISTS t1; 382 383 CREATE TABLE t1(a NUMERIC); 383 384 INSERT INTO t1 VALUES 384 385 ('9000000000000000001'), 385 386 ('9000000000000000001 '), 386 387 (' 9000000000000000001'), 387 388 (' 9000000000000000001 '); 388 389 SELECT * FROM t1; 389 390 } {9000000000000000001 9000000000000000001 9000000000000000001 9000000000000000001} 391 + 392 +# 2019-06-07 393 +# https://www.sqlite.org/src/info/4c2d7639f076aa7c 394 +do_execsql_test cast-7.1 { 395 + SELECT CAST('-' AS NUMERIC); 396 +} {0} 397 +do_execsql_test cast-7.2 { 398 + SELECT CAST('-0' AS NUMERIC); 399 +} {0} 400 +do_execsql_test cast-7.3 { 401 + SELECT CAST('+' AS NUMERIC); 402 +} {0} 403 +do_execsql_test cast-7.4 { 404 + SELECT CAST('/' AS NUMERIC); 405 +} {0} 406 + 407 +# 2019-06-07 408 +# https://www.sqlite.org/src/info/e8bedb2a184001bb 409 +do_execsql_test cast-7.10 { 410 + SELECT '' - 2851427734582196970; 411 +} {-2851427734582196970} 412 +do_execsql_test cast-7.11 { 413 + SELECT 0 - 2851427734582196970; 414 +} {-2851427734582196970} 415 +do_execsql_test cast-7.12 { 416 + SELECT '' - 1; 417 +} {-1} 418 + 419 +# 2019-06-10 420 +# https://www.sqlite.org/src/info/dd6bffbfb6e61db9 421 +# 422 +# EVIDENCE-OF: R-55084-10555 Casting a TEXT or BLOB value into NUMERIC 423 +# yields either an INTEGER or a REAL result. 424 +# 425 +do_execsql_test cast-7.20 { 426 + DROP TABLE IF EXISTS t0; 427 + CREATE TABLE t0 (c0 TEXT); 428 + INSERT INTO t0(c0) VALUES ('1.0'); 429 + SELECT CAST(c0 AS NUMERIC) FROM t0; 430 +} {1} 431 + 432 +# 2019-06-10 433 +# https://sqlite.org/src/info/27de823723a41df45af3 434 +# 435 +do_execsql_test cast-7.30 { 436 + SELECT -'.'; 437 +} 0 438 +do_execsql_test cast-7.31 { 439 + SELECT '.'+0; 440 +} 0 441 +do_execsql_test cast-7.32 { 442 + SELECT CAST('.' AS numeric); 443 +} 0 444 +do_execsql_test cast-7.33 { 445 + SELECT -CAST('.' AS numeric); 446 +} 0 447 + 448 +# 2019-06-12 449 +# https://www.sqlite.org/src/info/674385aeba91c774 450 +# 451 +do_execsql_test cast-7.40 { 452 + SELECT CAST('-0.0' AS numeric); 453 +} 0 454 +do_execsql_test cast-7.41 { 455 + SELECT CAST('0.0' AS numeric); 456 +} 0 457 +do_execsql_test cast-7.42 { 458 + SELECT CAST('+0.0' AS numeric); 459 +} 0 460 +do_execsql_test cast-7.43 { 461 + SELECT CAST('-1.0' AS numeric); 462 +} -1 463 + 464 + 390 465 391 466 finish_test
Changes to test/check.test.
113 113 execsql { 114 114 SELECT * FROM t1; 115 115 } 116 116 } {4 11.0} 117 117 118 118 do_test check-2.1 { 119 119 execsql { 120 + PRAGMA writable_schema = 1; 120 121 CREATE TABLE t2( 121 122 x INTEGER CONSTRAINT one CHECK( typeof(coalesce(x,0))=="integer" ), 122 123 y REAL CONSTRAINT two CHECK( typeof(coalesce(y,0.1))=='real' ), 123 124 z TEXT CONSTRAINT three CHECK( typeof(coalesce(z,''))=='text' ) 124 125 ); 126 + PRAGMA writable_schema = 0; 125 127 } 126 128 } {} 127 129 do_test check-2.2 { 128 130 execsql { 129 131 INSERT INTO t2 VALUES(1,2.2,'three'); 130 132 SELECT * FROM t2; 131 133 }
Added test/chunksize.test.
1 +# 2019 June 5 2 +# 3 +# The author disclaims copyright to this source code. In place of 4 +# a legal notice, here is a blessing: 5 +# 6 +# May you do good and not evil. 7 +# May you find forgiveness for yourself and forgive others. 8 +# May you share freely, never taking more than you give. 9 +# 10 +#*********************************************************************** 11 +# 12 + 13 +set testdir [file dirname $argv0] 14 +source $testdir/tester.tcl 15 +set testprefix chunksize 16 + 17 +if {$::tcl_platform(platform)!="unix"} { 18 + finish_test 19 + return 20 +} 21 + 22 +foreach {tn jrnlmode} { 23 + 1 delete 24 + 2 wal 25 +} { 26 + reset_db 27 + file_control_chunksize_test db main 32768 28 + do_execsql_test $tn.0 " PRAGMA journal_mode = $jrnlmode " $jrnlmode 29 + do_execsql_test $tn.1 { 30 + CREATE TABLE t1(a, b); 31 + INSERT INTO t1 VALUES(1, 2); 32 + } 33 + 34 + execsql { PRAGMA wal_checkpoint } 35 + 36 + do_test $tn.2 { 37 + file size test.db 38 + } 32768 39 +} 40 + 41 +finish_test
Changes to test/collate1.test.
396 396 ORDER BY 1 COLLATE nocase COLLATE nocase COLLATE nocase COLLATE binary; 397 397 } {DEF abc} 398 398 do_execsql_test 7.2 { 399 399 SELECT 'abc' UNION ALL SELECT 'DEF' 400 400 ORDER BY 1 COLLATE binary COLLATE binary COLLATE binary COLLATE nocase; 401 401 } {abc DEF} 402 402 403 +# 2019-06-14 404 +# https://sqlite.org/src/info/f1580ba1b574e9e9 405 +# 406 +do_execsql_test 8.0 { 407 + SELECT ' ' > char(20) COLLATE rtrim; 408 +} 0 409 +do_execsql_test 8.1 { 410 + SELECT '' < char(20) COLLATE rtrim; 411 +} 1 412 +do_execsql_test 8.2 { 413 + DROP TABLE IF EXISTS t0; 414 + CREATE TABLE t0(c0 COLLATE RTRIM, c1 BLOB UNIQUE, 415 + PRIMARY KEY (c0, c1)) WITHOUT ROWID; 416 + INSERT INTO t0 VALUES (123, 3), (' ', 1), (' ', 2), ('', 4); 417 + SELECT * FROM t0 WHERE c1 = 1; 418 +} {{ } 1} 403 419 404 420 finish_test
Changes to test/corruptL.test.
1003 1003 | end crash-41390d95d613b6.db 1004 1004 }]} {} 1005 1005 1006 1006 do_catchsql_test 10.1 { 1007 1007 SELECT * FROM t1 WHERE a<='2019-05-09' ORDER BY a DESC; 1008 1008 } {1 {database disk image is malformed}} 1009 1009 1010 + 1011 +#------------------------------------------------------------------------- 1012 +reset_db 1013 +do_test 11.0 { 1014 + sqlite3 db {} 1015 + db deserialize [decode_hexdb { 1016 +| size 595 pagesize 512 filename x.db 1017 +| page 1 offset 0 1018 +| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3. 1019 +| 16: 02 00 00 01 00 40 20 20 00 01 00 0c 00 00 00 07 .....@ ........ 1020 +| 32: 00 00 00 05 07 a1 1f fa 00 00 00 08 00 00 00 04 ................ 1021 +| 48: 00 00 01 00 00 49 00 00 00 00 00 05 00 00 00 00 .....I.......... 1022 +| 80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1c ................ 1023 +| 96: 00 2e 2c 50 0d 00 00 00 06 01 06 00 01 da 01 b0 ..,P............ 1024 +| 112: 01 56 01 86 01 2a 01 06 00 00 62 00 00 00 00 00 .V...*....b..... 1025 +| 128: 00 ed e2 78 74 64 33 ff 43 52 45 41 54 45 20 49 ...xtd3.CREATE I 1026 +| 144: 4e 44 45 58 20 74 33 78 20 4f 4e 20 74 33 28 38 NDEX t3x ON t3(8 1027 +| 160: 29 2e 04 06 17 15 11 01 45 69 6e 64 65 68 74 32 ).......Eindeht2 1028 +| 176: 63 64 74 31 e5 43 52 45 41 54 45 20 49 4e 44 45 cdt1.CREATE INDE 1029 +| 192: 58 20 74 32 63 c4 20 4f 4e 20 74 32 28 63 2c 64 X t2c. ON t2(c,d 1030 +| 208: 29 28 05 06 17 01 11 11 3d 74 61 6c 36 74 62 74 )(......=tal6tbt 1031 +| 224: 65 32 04 43 52 45 41 54 45 20 54 41 42 4c 45 20 e2.CREATE TABLE 1032 +| 240: 74 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 t............... 1033 +| 256: 00 00 00 00 00 00 22 07 06 17 11 11 01 30 e8 03 .............0.. 1034 +| 272: 62 6c 65 74 34 74 35 02 43 52 45 41 54 45 20 54 blet4t5.CREATE T 1035 +| 288: 41 42 4c 45 20 74 34 28 94 29 2a 06 06 17 13 11 ABLE t4(.)*..... 1036 +| 304: 01 3f 69 33 74 6e 65 78 78 74 64 33 ff 43 52 45 .?i3tnexxtd3.CRE 1037 +| 320: 41 54 45 20 49 4e 44 45 58 20 74 33 78 20 4f 4e ATE INDEX t3x ON 1038 +| 336: 20 74 31 28 38 29 2e 04 06 17 15 11 01 45 69 6e t1(8).......Ein 1039 +| 352: 64 65 68 74 32 63 64 74 31 e5 43 52 45 41 54 45 deht2cdt1.CREATE 1040 +| 368: 20 49 4e 44 45 58 20 74 32 63 c4 20 4f 4e 20 74 INDEX t2c. ON t 1041 +| 384: 32 28 63 2c 64 29 28 05 06 17 01 11 11 3d 74 61 2(c,d)(......=ta 1042 +| 400: 6c 32 74 62 74 65 32 04 43 52 45 41 54 45 20 54 l2tbte2.CREATE T 1043 +| 416: 41 42 4c 45 20 74 33 28 63 2c 78 2c 65 2c 66 29 ABLE t3(c,x,e,f) 1044 +| 432: 28 02 06 17 11 11 01 3d 74 61 9e 93 65 74 32 74 (......=ta..et2t 1045 +| 448: 32 03 43 52 45 41 54 45 20 54 41 42 4c 45 20 74 2.CREATE TABLE t 1046 +| 464: 32 28 63 2c 64 2c 65 2c 66 29 24 01 06 17 11 11 2(c,d,e,f)$..... 1047 +| 480: 01 35 55 61 62 6c 88 74 31 74 31 02 43 52 45 41 .5Uabl.t1t1.CREA 1048 +| 496: 54 45 20 54 41 42 4c 45 20 74 31 28 61 2c 62 29 TE TABLE t1(a,b) 1049 +| page 2 offset 512 1050 +| 0: 0d 00 00 00 0d 25 00 01 cf 00 01 fa 01 f3 01 de .....%.......... 1051 +| 16: 01 00 00 00 fd 00 00 0d 00 00 00 00 45 20 54 41 ............E TA 1052 +| 32: 42 4c 45 20 74 34 28 94 29 2a 06 06 17 13 11 01 BLE t4(.)*...... 1053 +| 48: 3f 69 33 74 6e 65 78 78 74 64 33 ff 43 52 45 a0 ?i3tnexxtd3.CRE. 1054 +| 64: a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 74 13 11 01 ............t... 1055 +| 80: 49 45 74 00 00 00 00 00 00 00 00 00 00 00 00 00 IEt............. 1056 +| end x.db 1057 +}]} {} 1058 + 1059 +do_catchsql_test 11.1 { 1060 + DELETE FROM t3 WHERE x IN (SELECT x FROM t4); 1061 +} {1 {database disk image is malformed}} 1010 1062 1011 1063 finish_test
Changes to test/countofview.test.
35 35 } {1} 36 36 37 37 do_execsql_test 1.3 { 38 38 select count(*) from ( 39 39 select c from t2 union all select f from t3 40 40 ) 41 41 } {3} 42 + 43 +# 2019-05-15 44 +do_execsql_test 2.0 { 45 + CREATE TABLE t1(x); 46 + INSERT INTO t1 VALUES(1),(99),('abc'); 47 + CREATE VIEW v1(x,y) AS SELECT x,1 FROM t1 UNION ALL SELECT x,2 FROM t1; 48 + SELECT count(*) FROM v1 WHERE x<>1; 49 +} {4} 50 +do_execsql_test 2.1 { 51 + SELECT count(*) FROM v1 GROUP BY y; 52 +} {3 3} 53 + 54 + 42 55 43 56 finish_test
Changes to test/dbfuzz2.c.
373 373 int nIn; 374 374 pIn = readFile(argv[i], &nIn); 375 375 if( pIn ){ 376 376 LLVMFuzzerTestOneInput((const uint8_t*)pIn, (size_t)nIn); 377 377 free(pIn); 378 378 } 379 379 } 380 +#ifdef RUSAGE_SELF 380 381 if( eVerbosity>0 ){ 381 382 struct rusage x; 382 383 printf("SQLite %s\n", sqlite3_sourceid()); 383 384 memset(&x, 0, sizeof(x)); 384 385 if( getrusage(RUSAGE_SELF, &x)==0 ){ 385 386 printf("Maximum RSS = %ld KB\n", x.ru_maxrss); 386 387 } 387 388 } 389 +#endif 388 390 return 0; 389 391 } 390 392 #endif /*STANDALONE*/
Changes to test/e_expr.test.
1640 1640 CAST(-9223372036854775809.0 AS INT) 1641 1641 } integer -9223372036854775808 1642 1642 do_expr_test e_expr-31.2.4 { 1643 1643 CAST(9223372036854775809.0 AS INT) 1644 1644 } integer 9223372036854775807 1645 1645 1646 1646 1647 -# EVIDENCE-OF: R-09295-61337 Casting a TEXT or BLOB value into NUMERIC 1648 -# first does a forced conversion into REAL but then further converts the 1649 -# result into INTEGER if and only if the conversion from REAL to INTEGER 1650 -# is lossless and reversible. 1647 +# EVIDENCE-OF: R-55084-10555 Casting a TEXT or BLOB value into NUMERIC 1648 +# yields either an INTEGER or a REAL result. 1649 +# 1650 +# EVIDENCE-OF: R-48945-04866 If the input text looks like an integer 1651 +# (there is no decimal point nor exponent) and the value is small enough 1652 +# to fit in a 64-bit signed integer, then the result will be INTEGER. 1653 +# 1654 +# EVIDENCE-OF: R-47045-23194 Input text that looks like floating point 1655 +# (there is a decimal point and/or an exponent) and the text describes a 1656 +# value that can be losslessly converted back and forth between IEEE 754 1657 +# 64-bit float and a 51-bit signed integer, then the result is INTEGER. 1651 1658 # 1652 1659 do_expr_test e_expr-32.1.1 { CAST('45' AS NUMERIC) } integer 45 1653 1660 do_expr_test e_expr-32.1.2 { CAST('45.0' AS NUMERIC) } integer 45 1654 1661 do_expr_test e_expr-32.1.3 { CAST('45.2' AS NUMERIC) } real 45.2 1655 1662 do_expr_test e_expr-32.1.4 { CAST('11abc' AS NUMERIC) } integer 11 1656 1663 do_expr_test e_expr-32.1.5 { CAST('11.1abc' AS NUMERIC) } real 11.1 1664 +do_expr_test e_expr-32.1.6 {CAST( '9.223372036e14' AS NUMERIC)} integer 922337203600000 1665 +do_expr_test e_expr-32.1.7 {CAST('-9.223372036e14' AS NUMERIC)} integer -922337203600000 1666 +do_expr_test e_expr-32.1.8 {CAST( '9.223372036e15' AS NUMERIC)} real 9223372036000000.0 1667 +do_expr_test e_expr-32.1.9 {CAST('-9.223372036e15' AS NUMERIC)} real -9223372036000000.0 1668 + 1669 + 1670 +# EVIDENCE-OF: R-50300-26941 Any text input that describes a value 1671 +# outside the range of a 64-bit signed integer yields a REAL result. 1672 +# 1673 +do_expr_test e_expr-32.1.20 { CAST('9223372036854775807' AS numeric) } \ 1674 + integer 9223372036854775807 1675 +do_expr_test e_expr-32.1.21 { CAST('9223372036854775808' AS numeric) } \ 1676 + real 9.22337203685478e+18 1677 +do_expr_test e_expr-32.1.22 { CAST('-9223372036854775808' AS numeric) } \ 1678 + integer -9223372036854775808 1679 +do_expr_test e_expr-32.1.23 { CAST('-9223372036854775809' AS numeric) } \ 1680 + real -9.22337203685478e+18 1657 1681 1658 1682 # EVIDENCE-OF: R-30347-18702 Casting a REAL or INTEGER value to NUMERIC 1659 1683 # is a no-op, even if a real value could be losslessly converted to an 1660 1684 # integer. 1661 1685 # 1662 1686 do_expr_test e_expr-32.2.1 { CAST(13.0 AS NUMERIC) } real 13.0 1663 1687 do_expr_test e_expr-32.2.2 { CAST(13.5 AS NUMERIC) } real 13.5 ................................................................................ 1697 1721 SELECT typeof(CAST(x AS NUMERIC)), CAST(x AS NUMERIC)||'' FROM t1; 1698 1722 } [list \ 1699 1723 integer 9000000000000000001 \ 1700 1724 integer 9000000000000000001 \ 1701 1725 integer 9000000000000000001 \ 1702 1726 integer 9000000000000000001 \ 1703 1727 integer 9000000000000000001 \ 1704 - integer 9000000000000000001 \ 1728 + real 9.0e+18 \ 1705 1729 integer 9223372036854775807 \ 1706 1730 integer 9223372036854775807 \ 1707 1731 integer 9223372036854775807 \ 1708 1732 real 9.22337203685478e+18 \ 1709 1733 real 9.22337203685478e+18 \ 1710 - integer 9223372036854775807 \ 1711 - integer 9223372036854775807 \ 1734 + real 9.22337203685478e+18 \ 1735 + real 9.22337203685478e+18 \ 1712 1736 integer -5 \ 1713 1737 integer -5 \ 1714 1738 ] 1715 1739 1716 1740 # EVIDENCE-OF: R-64550-29191 Note that the result from casting any 1717 1741 # non-BLOB value into a BLOB and the result from casting any BLOB value 1718 1742 # into a non-BLOB value may be different depending on whether the
Added test/expr2.test.
1 +# 2019 May 20 2 +# 3 +# The author disclaims copyright to this source code. In place of 4 +# a legal notice, here is a blessing: 5 +# 6 +# May you do good and not evil. 7 +# May you find forgiveness for yourself and forgive others. 8 +# May you share freely, never taking more than you give. 9 +# 10 +#*********************************************************************** 11 +# This file implements regression tests for SQLite library. The 12 +# focus of this file is testing expressions. 13 +# 14 + 15 +set testdir [file dirname $argv0] 16 +source $testdir/tester.tcl 17 +set testprefix expr2 18 + 19 +do_execsql_test 1.0 { 20 + CREATE TABLE t0(c0); 21 + INSERT INTO t0(c0) VALUES ('val'); 22 +} 23 + 24 +do_execsql_test 1.1 { 25 + SELECT * FROM t0 WHERE ( 26 + ( (0 IS NOT FALSE) OR NOT (0 IS FALSE OR (t0.c0 = 1)) ) IS 0 27 + ) 28 +} {val} 29 + 30 +do_execsql_test 1.2.1 { 31 + SELECT 32 + ( (0 IS NOT FALSE) OR NOT (0 IS FALSE OR (t0.c0 = 1)) ) IS 0 33 + FROM t0 34 +} {1} 35 + 36 +do_execsql_test 1.2.2 { 37 + SELECT 38 + ( (0 IS NOT FALSE) OR NOT (0 IS 0 OR (t0.c0 = 1)) ) IS 0 39 + FROM t0 40 +} {1} 41 + 42 +do_execsql_test 1.3 { 43 + SELECT ( (0 IS NOT FALSE) OR NOT (0 IS FALSE OR (t0.c0 = 1)) ) FROM t0 44 +} {0} 45 + 46 +do_execsql_test 1.4.1 { 47 + SELECT (0 IS NOT FALSE) FROM t0 48 +} {0} 49 +do_execsql_test 1.4.2 { 50 + SELECT NOT (0 IS FALSE OR (t0.c0 = 1)) FROM t0 51 +} {0} 52 + 53 + 54 +finish_test
Changes to test/fts3corrupt4.test.
1942 1942 | 4064: 69 74 79 2d 63 68 65 63 6b 09 02 02 1b 72 65 62 ity-check....reb 1943 1943 | 4080: 75 69 6c 64 0a 01 02 1d 6f 70 74 69 6d 69 7a 65 uild....optimize 1944 1944 | end crash-c666cfde112dee.db 1945 1945 }]} {} 1946 1946 1947 1947 do_catchsql_test 13.1 { 1948 1948 SELECT quote(matchinfo(t1,'pcxybs'))==0 FROM t1 WHERE b MATCH 'e*'; 1949 -} {0 {0 0}} 1949 +} {0 {}} 1950 1950 1951 1951 #------------------------------------------------------------------------- 1952 1952 reset_db 1953 1953 do_test 14.0 { 1954 1954 sqlite3 db {} 1955 1955 db deserialize [decode_hexdb { 1956 1956 | size 28672 pagesize 4096 filename crash-f7b636a855e1d2.db ................................................................................ 2822 2822 | 16: 2d 63 68 65 63 6b 09 02 02 1b 72 65 62 75 69 6c -check....rebuil 2823 2823 | 32: 64 0a 01 02 1d 6f 70 74 69 6d 69 7a 65 00 00 00 d....optimize... 2824 2824 | end crash-4ce32d0608aff1.db 2825 2825 }]} {} 2826 2826 2827 2827 do_catchsql_test 18.1 { 2828 2828 SELECT quote(matchinfo(t1,'pcxybs'))==0 FROM t1 WHERE b MATCH 'e*'; 2829 -} {0 0} 2829 +} {0 {}} 2830 2830 2831 2831 #------------------------------------------------------------------------- 2832 2832 reset_db 2833 2833 do_test 19.0 { 2834 2834 sqlite3 db {} 2835 2835 db deserialize [decode_hexdb { 2836 2836 | size 28672 pagesize 4096 filename crash-526ea445f41c02.db ................................................................................ 4396 4396 INSERT INTO t1( a ) SELECT randomblob(3000) FROM t2 ; 4397 4397 } {0 {}} 4398 4398 4399 4399 do_catchsql_test 25.6 { 4400 4400 INSERT INTO t1(t1) SELECT x FROM t2; 4401 4401 INSERT INTO t1(t1) SELECT x FROM t2; 4402 4402 } {1 {database disk image is malformed}} 4403 + 4404 +#------------------------------------------------------------------------- 4405 +reset_db 4406 +do_test 26.0 { 4407 + sqlite3 db {} 4408 + db deserialize [decode_hexdb { 4409 +.open --hexdb 4410 +| size 28672 pagesize 4096 filename crash-26682721375870.db 4411 +| page 1 offset 0 4412 +| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3. 4413 +| 16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 00 .....@ ........ 4414 +| 96: 00 00 00 00 0d 0e b1 00 06 0d a4 00 0f 8d 0f 21 ...............! 4415 +| 112: 0e b9 0d c8 0e 7e 0d a4 00 00 00 00 00 00 00 00 .....~.......... 4416 +| 3488: 00 00 00 00 22 07 06 17 11 11 01 31 74 61 62 6c ...........1tabl 4417 +| 3504: 65 74 32 74 32 07 43 52 45 41 54 45 20 54 41 42 et2t2.CREATE TAB 4418 +| 3520: 4c 45 20 74 32 28 78 29 81 33 05 07 17 1f 1f 01 LE t2(x).3...... 4419 +| 3536: 82 35 74 61 62 6c 65 74 31 5f 73 65 67 64 69 72 .5tablet1_segdir 4420 +| 3552: 74 31 5f 73 65 67 64 69 72 05 43 52 45 41 54 45 t1_segdir.CREATE 4421 +| 3568: 20 54 41 42 4c 45 20 27 74 31 5f 73 65 67 64 69 TABLE 't1_segdi 4422 +| 3584: 72 27 28 6c 65 76 65 6c 20 49 4e 54 45 47 45 51 r'(level INTEGEQ 4423 +| 3600: 2c 69 64 78 20 49 4e 54 45 47 45 52 2c 73 74 61 ,idx INTEGER,sta 4424 +| 3616: 72 74 5f 62 6c 6f 63 6b 20 49 4e 54 45 47 45 52 rt_block INTEGER 4425 +| 3632: 2c 6c 65 61 76 65 73 5f 65 6e 64 5f 62 6c 6f 63 ,leaves_end_bloc 4426 +| 3648: 6b 20 49 4e 54 45 47 45 52 2c 65 6e 64 5f 62 6c k INTEGER,end_bl 4427 +| 3664: 6f 63 6b 20 49 4e 54 45 47 45 62 2c 72 6f 6f 74 ock INTEGEb,root 4428 +| 3680: 20 42 4c 4f 42 2c 50 52 49 4d 41 52 59 20 4b 45 BLOB,PRIMARY KE 4429 +| 3696: 59 28 6c 65 76 65 6c 2c 20 69 64 78 29 29 31 06 Y(level, idx))1. 4430 +| 3712: 06 17 45 1f 01 00 69 6e 64 65 78 73 71 6c 69 74 ..E...indexsqlit 4431 +| 3728: 65 5f 61 75 74 6f 69 6e 64 65 78 5f 74 31 5f 73 e_autoindex_t1_s 4432 +| 3744: 65 67 64 69 72 5f 31 74 31 5f 73 65 67 64 69 72 egdir_1t1_segdir 4433 +| 3760: 06 0f c7 00 08 00 00 00 00 66 04 07 17 23 23 01 .........f...##. 4434 +| 3776: 81 13 74 61 62 6c 65 74 31 5f 73 65 66 6d 65 6e ..tablet1_sefmen 4435 +| 3792: 74 73 74 31 5f 73 65 67 6d 65 6e 74 73 04 43 52 tst1_segments.CR 4436 +| 3808: 45 41 54 45 20 54 41 42 4c 45 20 27 74 31 5f 73 EATE TABLE 't1_s 4437 +| 3824: 65 67 6d 65 6e 74 73 27 28 62 6c 6f 63 6b 69 64 egments'(blockid 4438 +| 3840: 20 49 4e 54 45 47 45 52 20 50 52 49 4d 41 52 59 INTEGER PRIMARY 4439 +| 3856: 20 4b 45 59 2c 20 62 6c 6f 63 6b 20 42 4c 4f 42 KEY, block BLOB 4440 +| 3872: 29 6a 03 07 17 21 21 01 81 1f 74 61 62 6c 65 74 )j...!!...tablet 4441 +| 3888: 31 5f 63 6f 6e 74 65 6e 74 74 31 5f 63 6f 6e 74 1_contentt1_cont 4442 +| 3904: 65 6e 74 03 43 52 45 41 54 45 20 54 41 42 4c 45 ent.CREATE TABLE 4443 +| 3920: 20 27 74 31 5f 63 6f 6e 74 65 6e 74 27 28 64 6f 't1_content'(do 4444 +| 3936: 63 69 64 20 49 4e 54 45 47 45 52 20 50 52 49 4d cid INTEGER PRIM 4445 +| 3952: 41 52 59 20 4b 45 59 2c 20 27 63 30 61 27 2c 20 ARY KEY, 'c0a', 4446 +| 3968: 27 63 31 62 27 2c 20 27 63 32 63 27 29 38 02 06 'c1b', 'c2c')8.. 4447 +| 3984: 17 11 11 08 5f 74 61 62 6c 65 74 31 74 31 43 52 ...._tablet1t1CR 4448 +| 4000: 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 EATE VIRTUAL TAB 4449 +| 4016: 4c 45 20 74 31 20 55 53 49 4e 47 20 66 74 73 33 LE t1 USING fts3 4450 +| 4032: 28 61 2c 62 2c 63 29 00 00 00 00 00 00 00 00 00 (a,b,c)......... 4451 +| page 3 offset 8192 4452 +| 0: 0d 00 00 00 25 0b 48 00 0f d8 0f af 0f 86 0f 74 ....%.H........t 4453 +| 16: 0f 61 0f 4e 0f 2f 0f 0f 0e ef 0e d7 0e be 0e a5 .a.N./.......... 4454 +| 32: 0e 8d 0e 74 0e 5b 0e 40 0e 24 0e 08 0d ef 00 00 ...t.[.@.$...... 4455 +| 2880: 00 00 00 00 00 00 00 00 81 3f 25 06 00 82 7f 00 .........?%..... 4456 +| 2896: 00 43 4f 4d 50 49 4c 45 52 3d 67 63 63 2d 35 2e .COMPILER=gcc-5. 4457 +| 2912: 34 23 00 20 32 2f 31 36 30 36 30 39 20 44 45 42 4#. 2/160609 DEB 4458 +| 2928: 55 47 20 45 4e 41 42 4c 45 20 44 42 53 54 41 54 UG ENABLE DBSTAT 4459 +| 2944: 20 56 54 41 42 20 45 4e 41 42 4c 45 20 46 54 53 VTAB ENABLE FTS 4460 +| 2960: 34 20 45 4e 41 42 4c 45 20 46 54 53 35 20 45 4e 4 ENABLE FTS5 EN 4461 +| 2976: 41 42 4c 45 20 47 45 4f 50 4f 4c 59 20 45 4e 41 ABLE GEOPOLY ENA 4462 +| 2992: 42 4c 45 20 4a 53 4f 4e 31 20 45 4e 41 42 4c 45 BLE JSON1 ENABLE 4463 +| 3008: 20 4d 45 4d 53 59 53 35 20 45 4e 41 42 4c 45 20 MEMSYS5 ENABLE 4464 +| 3024: 52 54 52 45 45 20 4d 41 58 20 4d 45 4d 4f 52 59 RTREE MAX MEMORY 4465 +| 3040: 3d 35 30 30 30 30 30 30 30 20 4f 4d 49 54 20 4c =50000000 OMIT L 4466 +| 3056: 4f 41 44 20 45 58 54 45 4e 53 59 4f 4e 20 54 48 OAD EXTENSYON TH 4467 +| 3072: 52 45 41 44 53 41 46 45 3d 30 18 24 05 00 25 0f READSAFE=0.$..%. 4468 +| 3088: 19 54 48 52 45 41 44 53 41 46 45 3d 30 58 42 49 .THREADSAFE=0XBI 4469 +| 3104: 4e 41 52 59 18 23 05 00 25 0f 19 54 48 52 45 41 NARY.#..%..THREA 4470 +| 3120: 44 53 41 46 45 3d 30 58 4e 4f 43 41 53 45 17 22 DSAFE=0XNOCASE.. 4471 +| 3136: 05 00 25 0f 17 54 38 52 45 41 44 53 41 46 45 3d ..%..T8READSAFE= 4472 +| 3152: 30 58 52 54 52 49 4d 1f 21 05 00 33 0f 19 4f 4d 0XRTRIM.!..3..OM 4473 +| 3168: 49 54 20 4c 4f 41 44 20 45 58 54 45 fc 53 49 4f IT LOAD EXTE.SIO 4474 +| 3184: 4e 68 42 49 4e 4a c2 59 1f 20 05 00 33 0f 19 4f NhBINJ.Y. ..3..O 4475 +| 3200: 4d 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 53 49 MIT LOAD EXTENSI 4476 +| 3216: 4f 4e 58 4e 4f 43 41 53 45 1e 1f 05 00 33 0f 17 ONXNOCASE....3.. 4477 +| 3232: 4f 4d 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 53 OMIT LOAD EXTENS 4478 +| 3248: 49 4f 4e 58 52 54 52 49 4d 1f 1e 05 00 33 0f 19 IONXRTRIM....3.. 4479 +| 3264: 4d 41 58 20 4d 45 4d 4f 52 59 3d 35 30 2f 30 30 MAX MEMORY=50/00 4480 +| 3280: 30 30 30 58 42 49 4e 41 52 59 1f 1d 05 00 33 0f 000XBINARY....3. 4481 +| 3296: 19 4d 41 58 20 4d 45 4d 4f 52 59 3d 35 30 30 30 .MAX MEMORY=5000 4482 +| 3312: 30 30 30 30 48 4e 4f 43 41 53 45 1e 1c 05 00 33 0000HNOCASE....3 4483 +| 3328: 0f 17 4d 41 58 20 4d 45 4d 4f 52 59 3d 35 30 30 ..MAX MEMORY=500 4484 +| 3344: 30 30 30 30 30 58 52 54 52 49 4d 18 1b 05 00 25 00000XRTRIM....% 4485 +| 3360: 0f 19 45 4e 41 42 4c 45 20 52 54 52 45 45 58 42 ..ENABLE RTREEXB 4486 +| 3376: 49 4e 41 52 59 18 1a 05 00 25 0f 19 45 4e 41 42 INARY....%..ENAB 4487 +| 3392: 4c 45 20 52 54 52 45 45 58 4e 4f 53 41 53 45 17 LE RTREEXNOSASE. 4488 +| 3408: 19 05 00 25 0f 17 45 4e 41 42 4c 45 20 52 54 52 ...%..ENABLE RTR 4489 +| 3424: 45 45 58 52 54 52 49 4d 1a 18 05 00 29 0f 19 45 EEXRTRIM....)..E 4490 +| 3440: 4e 41 42 4c 45 20 4d 45 4d 53 59 53 35 58 42 49 NABLE MEMSYS5XBI 4491 +| 3456: 4e 41 52 59 1a 17 05 00 29 0f 19 45 4e 41 42 4c NARY....)..ENABL 4492 +| 3472: 45 20 4d 45 4d 53 59 53 35 58 4e 4f 43 41 53 45 E MEMSYS5XNOCASE 4493 +| 3488: 19 16 05 00 29 0f 17 45 4e 41 42 4c 45 20 4d 45 ....)..ENABLE ME 4494 +| 3504: 4d 53 59 53 35 58 52 54 52 49 4d 18 15 05 00 25 MSYS5XRTRIM....% 4495 +| 3520: 0f 19 45 4e 41 42 4c 45 20 4a 53 4f 4e 31 58 42 ..ENABLE JSON1XB 4496 +| 3536: 49 4e 41 52 59 18 14 05 00 25 0f 19 45 4e 42 42 INARY....%..ENBB 4497 +| 3552: 4d 45 20 4a 53 4f 4e 31 58 4e 4f 43 41 53 45 17 ME JSON1XNOCASE. 4498 +| 3568: 13 05 00 25 0f 17 45 4e 41 42 4c 45 20 4a 53 4f ...%..ENABLE JSO 4499 +| 3584: 4e 31 58 52 54 52 49 4d 1a 12 05 00 29 0f 19 45 N1XRTRIM....)..E 4500 +| 3600: 4e 41 42 4c 45 20 47 45 4f 50 4f 4c 59 58 42 49 NABLE GEOPOLYXBI 4501 +| 3616: 4e 41 52 59 1a 11 05 00 29 0f 19 45 4e 41 1e 4c NARY....)..ENA.L 4502 +| 3632: 45 20 47 45 4f 50 4f 4c 59 58 4e 4f 43 41 53 45 E GEOPOLYXNOCASE 4503 +| 3648: 19 10 05 00 29 0f 17 45 4e 41 42 4c 45 20 47 45 ....)..ENABLE GE 4504 +| 3664: 4f 50 4f 4c 59 58 62 54 52 49 4d 17 0f 05 00 23 OPOLYXbTRIM....# 4505 +| 3680: 0f 19 45 4e 41 42 4c 45 20 46 54 53 35 58 42 49 ..ENABLE FTS5XBI 4506 +| 3696: 4e 41 52 59 17 0e 05 00 23 0f 19 45 4e 41 42 4c NARY....#..ENABL 4507 +| 3712: 45 20 46 54 fc 35 58 4e 4f 43 41 53 45 16 0d 05 E FT.5XNOCASE... 4508 +| 3728: 00 23 0f 17 45 4e 41 42 4c 45 20 46 54 53 35 58 .#..ENABLE FTS5X 4509 +| 3744: 52 54 52 49 4d 17 0c 05 00 23 0f 19 45 4e 41 42 RTRIM....#..ENAB 4510 +| 3760: 4c 45 20 46 54 53 34 58 42 49 4e 41 52 59 17 0b LE FTS4XBINARY.. 4511 +| 3776: 05 00 23 0f 19 45 4e 41 42 4c 45 20 46 54 53 35 ..#..ENABLE FTS5 4512 +| 3792: 58 4e 4f 43 40 53 45 16 0a 05 00 23 0f 17 45 4e XNOC@SE....#..EN 4513 +| 3808: 41 42 4c 45 20 56 54 53 34 58 52 54 52 49 4d 1e ABLE VTS4XRTRIM. 4514 +| 3824: 09 05 00 31 0f 19 45 4e 41 42 4c 45 20 44 42 53 ...1..ENABLE DBS 4515 +| 3840: 54 41 54 20 56 54 41 42 58 42 49 4e 41 b3 58 1e TAT VTABXBINA.X. 4516 +| 3856: 08 05 00 31 0f 19 45 4e 40 42 4c 45 20 44 42 53 ...1..EN@BLE DBS 4517 +| 3872: 54 41 54 20 56 54 41 42 58 4e 4f 43 41 53 45 1d TAT VTABXNOCASE. 4518 +| 3888: 07 05 00 31 0f 17 45 4e 41 42 4c 45 20 45 42 53 ...1..ENABLE EBS 4519 +| 3904: 54 41 54 20 56 54 41 42 58 52 54 52 49 4d 11 06 TAT VTABXRTRIM.. 4520 +| 3920: 05 00 17 0f 19 44 45 42 55 47 58 42 49 4e 41 52 .....DEBUGXBINAR 4521 +| 3936: 59 11 05 05 00 17 0f 19 44 45 42 55 47 58 4e 4f Y.......DEBUGXNO 4522 +| 3952: 43 41 53 45 10 04 05 00 17 0f 17 44 45 42 55 47 CASE.......DEBUG 4523 +| 3968: 58 52 54 52 49 4d 27 03 05 00 43 0f 19 43 4f 4d XRTRIM'...C..COM 4524 +| 3984: 50 49 4c 45 52 3d 67 63 63 2d 35 2e 34 2e 30 20 PILER=gcc-5.4.0 4525 +| 4000: 32 30 31 36 30 36 30 39 58 4b 19 4e 41 52 59 27 20160609XK.NARY' 4526 +| 4016: 02 05 00 43 0f 19 43 4f 4d 50 49 4c 45 52 3d 67 ...C..COMPILER=g 4527 +| 4032: 63 63 2d 35 2e 34 2e 30 20 32 30 31 36 30 36 30 cc-5.4.0 2016060 4528 +| page 5 offset 16384 4529 +| 0: 0d 00 00 00 02 0b a0 00 0c ad 0b a0 00 00 00 00 ................ 4530 +| 2976: 82 0a 02 08 08 09 08 08 17 84 06 30 20 32 34 33 ...........0 243 4531 +| 2992: 00 01 30 04 25 06 1b 00 00 08 32 30 31 36 30 36 ..0.%.....201606 4532 +| 3008: 30 39 03 25 07 00 00 01 34 03 25 05 00 00 01 35 09.%....4.%....5 4533 +| 3024: 03 25 04 00 01 07 30 30 30 30 30 30 30 03 25 1a .%....0000000.%. 4534 +| 3040: 00 00 08 63 6f 6d 70 69 6c 65 72 03 25 02 00 00 ...compiler.%... 4535 +| 3056: 06 64 62 73 74 51 74 03 25 0a 00 01 04 65 62 75 .dbstQt.%....ebu 4536 +| 3072: 67 03 25 08 00 00 06 65 6e 61 62 6c 65 09 25 09 g.%....enable.%. 4537 +| 3088: 05 04 04 04 04 04 00 01 08 78 74 65 6e 73 69 6f .........xtensio 4538 +| 3104: 6e 03 25 1d 00 00 04 66 74 73 34 03 25 0d 00 03 n.%....fts4.%... 4539 +| 3120: 01 35 03 25 0f 00 00 03 67 63 63 03 25 03 00 01 .5.%....gcc.%... 4540 +| 3136: 06 65 6f 70 6f 6c 79 03 25 11 00 00 05 6a 73 6f .eopoly.%....jso 4541 +| 3152: 6e 31 03 25 13 00 00 04 6c 6f 61 64 03 25 1c 00 n1.%....load.%.. 4542 +| 3168: 00 03 6d 61 78 03 25 18 00 01 05 65 6d 6f 72 79 ..max.%....emory 4543 +| 3184: 03 25 19 00 03 04 73 79 73 35 03 25 15 00 00 04 .%....sys5.%.... 4544 +| 3200: 6f 6d 69 74 03 25 1b 00 00 05 72 74 72 65 65 03 omit.%....rtree. 4545 +| 3216: 25 17 00 00 0a 74 68 72 65 61 64 73 61 66 65 03 %....threadsafe. 4546 +| 3232: 25 1e 00 00 04 76 74 61 62 03 25 0b 00 86 50 01 %....vtab.%...P. 4547 +| 3248: 08 08 08 08 08 17 8d 12 30 20 38 33 35 00 01 30 ........0 835..0 4548 +| 3264: 12 01 06 00 01 06 00 01 06 00 1e f3 00 01 03 00 ................ 4549 +| 3280: 01 03 00 00 08 32 30 31 36 30 36 30 39 09 01 07 .....20160609... 4550 +| 3296: 00 01 07 00 01 07 00 00 01 34 09 01 05 00 01 05 .........4...... 4551 +| 3312: 00 01 05 00 00 01 35 09 01 04 00 01 04 00 01 04 ......5......... 4552 +| 3328: 00 01 07 30 30 30 30 2f 30 30 09 1c 04 00 01 04 ...0000/00...... 4553 +| 3344: 00 01 04 00 00 06 62 69 6e 61 72 79 3c 03 01 02 ......binary<... 4554 +| 3360: 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02 ................ 4555 +| 3376: 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00 ................ 4556 +| 3392: 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00 03 ................ 4557 +| 3408: 01 02 02 00 03 01 02 02 00 00 08 63 6f 6d 70 69 ...........compi 4558 +| 3424: 6c 65 72 09 01 02 00 01 02 00 01 02 00 00 06 64 ler............d 4559 +| 3440: 62 73 74 61 74 09 07 03 00 01 03 00 01 03 00 01 bstat........... 4560 +| 3456: 04 65 62 75 67 09 04 02 00 01 02 00 01 02 00 00 .ebug........... 4561 +| 3472: 06 65 6e 61 62 6c 65 3f 07 02 00 01 02 00 01 02 .enable?........ 4562 +| 3488: 00 01 02 00 01 02 00 01 01 f0 01 02 00 57 02 00 .............W.. 4563 +| 3504: 01 02 00 01 02 00 01 02 00 01 02 00 01 02 10 01 ................ 4564 +| 3520: 02 00 01 02 00 01 02 00 01 02 00 01 02 00 01 02 ................ 4565 +| 3536: 00 00 02 00 01 02 00 01 08 78 74 65 6e 73 69 6f .........xtensio 4566 +| 3552: 6e 09 1f 04 00 01 04 00 01 04 00 00 04 66 74 73 n............fts 4567 +| 3568: 34 09 0a 03 00 01 03 00 01 03 00 03 01 35 09 0d 4............5.. 4568 +| 3584: 03 00 01 03 00 a9 03 00 00 03 67 63 63 09 01 03 ..........gcc... 4569 +| 3600: 00 01 03 00 01 03 00 01 06 65 6f 70 6f 6c 79 09 .........eopoly. 4570 +| 3616: 10 03 00 01 03 00 01 03 00 00 05 6a 73 6f 6e 31 ...........json1 4571 +| 3632: 09 13 03 00 01 03 00 01 03 00 00 04 6c 6f 61 64 ............load 4572 +| 3648: 09 1f 03 00 01 03 00 01 03 00 00 03 6d 61 78 09 ............max. 4573 +| 3664: 1c 02 0b 31 02 00 01 02 00 01 05 65 6d 6f 72 79 ...1.......emory 4574 +| 3680: 09 1c 03 00 01 03 00 01 03 00 03 04 73 79 73 35 ............sys5 4575 +| 3696: 09 16 03 00 01 03 00 01 03 00 00 06 6e 6f 63 61 ............noca 4576 +| 3712: 73 65 3c 02 01 02 02 00 03 01 02 02 00 03 01 02 se<............. 4577 +| 3728: 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02 ................ 4578 +| 3744: 00 03 01 02 02 00 f3 01 02 02 00 03 01 02 02 00 ................ 4579 +| 3760: 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00 00 ................ 4580 +| 3776: 04 6f 6d 69 74 09 1f 02 00 01 02 00 01 02 00 00 .omit........... 4581 +| 3792: 05 72 74 72 65 65 09 19 03 00 01 03 00 01 03 00 .rtree.......... 4582 +| 3808: 03 02 69 6d 3c 01 01 02 02 00 03 01 02 02 00 03 ..im<........... 4583 +| 3824: 01 02 02 00 03 01 02 02 00 03 01 02 02 00 03 01 ................ 4584 +| 3840: 02 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 ................ 4585 +| 3856: 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02 ................ 4586 +| 3872: 00 00 0a 74 68 72 65 61 64 63 61 66 65 09 22 02 ...threadcafe... 4587 +| 3888: 00 01 02 00 02 02 00 00 04 76 74 61 62 09 07 04 .........vtab... 4588 +| 3904: 00 01 04 00 01 04 00 00 01 78 b4 01 01 01 01 02 .........x...... 4589 +| 3920: 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00 ................ 4590 +| 3936: 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00 01 ................ 4591 +| 3952: 01 01 02 00 01 01 01 02 00 01 01 01 02 00 01 01 ................ 4592 +| 3968: 01 02 00 01 01 01 02 00 01 01 01 02 00 01 01 01 ................ 4593 +| 3984: 02 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 ................ 4594 +| 4000: 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00 ................ 4595 +| 4016: 01 01 01 02 00 01 01 01 02 00 01 00 01 02 00 01 ................ 4596 +| 4032: 01 01 02 00 01 01 00 e2 00 01 01 01 02 00 01 01 ................ 4597 +| 4048: 01 02 00 01 01 01 02 00 01 01 01 02 00 01 01 01 ................ 4598 +| 4064: 02 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 ................ 4599 +| 4080: 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00 ................ 4600 +| page 6 offset 20480 4601 +| 0: 0a 00 00 00 02 0f f5 00 0f fb 0f f5 00 00 00 00 ................ 4602 +| 4080: 00 00 00 00 00 05 04 08 09 01 02 04 04 08 08 09 ................ 4603 +| page 7 offset 24576 4604 +| 0: 0d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 4605 +| 4016: 00 00 00 00 00 00 00 00 0d 05 02 23 61 00 00 00 ...........#a... 4606 +| end crash-26682721375870.db 4607 +}]} {} 4608 + 4609 +do_execsql_test 26.1 { 4610 + SELECT count(*) FROM ( 4611 + SELECT t1, (t1) FROM t1 WHERE b MATCH 'x' 4612 + ) 4613 +} 34 4614 + 4615 +#------------------------------------------------------------------------- 4616 +reset_db 4617 +do_test 27.0 { 4618 + sqlite3 db {} 4619 + db deserialize [decode_hexdb { 4620 +.open --hexdb 4621 +| size 28672 pagesize 4096 filename crash-23ddd777a03bfd.db 4622 +| page 1 offset 0 4623 +| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3. 4624 +| 16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 00 .....@ ........ 4625 +| 96: 00 00 00 00 0d 0e b1 00 06 0d a4 00 0f 8d 0f 21 ...............! 4626 +| 112: 0e b9 0d c8 0e 7e 0d a4 00 00 00 00 00 00 00 00 .....~.......... 4627 +| 3488: 00 00 00 00 22 07 06 17 11 11 01 31 74 61 62 6c ...........1tabl 4628 +| 3504: 65 74 32 74 32 07 43 52 45 41 54 45 20 54 41 42 et2t2.CREATE TAB 4629 +| 3520: 4c 45 20 74 32 28 78 29 81 33 05 07 17 1f 1f 01 LE t2(x).3...... 4630 +| 3536: 82 35 74 61 62 6c 65 74 31 5f 73 65 67 64 69 72 .5tablet1_segdir 4631 +| 3552: 74 31 5f 73 65 67 64 69 72 05 43 52 45 41 54 45 t1_segdir.CREATE 4632 +| 3568: 20 54 41 42 4c 45 20 27 74 31 5f 73 65 67 64 69 TABLE 't1_segdi 4633 +| 3584: 72 27 28 6c 65 76 65 6c 20 49 4e 54 45 47 45 52 r'(level INTEGER 4634 +| 3600: 2c 69 64 78 20 49 4e 54 45 47 45 52 2c 73 74 61 ,idx INTEGER,sta 4635 +| 3616: 72 74 5f 62 6c 6f 63 6b 20 49 4e 54 45 47 45 52 rt_block INTEGER 4636 +| 3632: 2c 6c 65 61 76 65 73 5f 65 6e 64 5f 62 6c 6f 63 ,leaves_end_bloc 4637 +| 3648: 6b 20 49 4e 54 45 47 45 52 2c 65 6e 64 5f 62 6c k INTEGER,end_bl 4638 +| 3664: 6f 63 6b 20 49 4e 54 45 47 45 52 2c 72 6f 6f 74 ock INTEGER,root 4639 +| 3680: 20 42 4c 4f 42 2c 50 52 49 4d 41 52 59 20 4b 45 BLOB,PRIMARY KE 4640 +| 3696: 59 28 6c 65 76 65 6c 2c 20 69 64 78 29 29 31 06 Y(level, idx))1. 4641 +| 3712: 06 17 45 1f 01 00 69 6e 64 65 78 73 71 6c 69 74 ..E...indexsqlit 4642 +| 3728: 65 5f 61 75 74 6f 69 6e 64 65 78 5f 74 31 5f 73 e_autoindex_t1_s 4643 +| 3744: 65 67 64 69 72 5f 31 74 31 5f 73 65 67 64 69 72 egdir_1t1_segdir 4644 +| 3760: 06 0f c7 00 08 00 00 00 00 66 04 07 17 23 23 01 .........f...##. 4645 +| 3776: 81 13 74 61 62 6c 65 74 31 5f 73 65 67 6d 65 6e ..tablet1_segmen 4646 +| 3792: 64 73 74 31 5f 73 65 67 6d 65 6e 73 73 04 43 52 dst1_segmenss.CR 4647 +| 3808: 45 41 54 45 20 54 41 42 4c 45 20 27 74 31 5f 73 EATE TABLE 't1_s 4648 +| 3824: 65 67 6d 65 6e 74 73 27 28 62 6c 6f 63 6b 69 64 egments'(blockid 4649 +| 3840: 20 49 4e 54 45 47 45 52 20 50 52 49 4d 4e 72 59 INTEGER PRIMNrY 4650 +| 3856: 20 4b 45 59 2c 20 62 6c 6f 63 6b 20 42 4c 4f 42 KEY, block BLOB 4651 +| 3872: 29 6a 03 07 17 21 21 01 81 1f 74 61 62 6c 65 74 )j...!!...tablet 4652 +| 3888: 31 5f 63 6f 6e 74 65 6e 74 74 31 5f 63 6f 6e 74 1_contentt1_cont 4653 +| 3904: 65 6e 74 04 43 52 45 41 54 45 20 54 41 42 4c 45 ent.CREATE TABLE 4654 +| 3920: 20 27 74 31 5f 63 6f 6e 74 65 6e 74 27 28 64 6f 't1_content'(do 4655 +| 3936: 63 69 64 20 49 4e 54 45 47 45 52 20 50 52 39 4d cid INTEGER PR9M 4656 +| 3952: 41 52 59 20 4b 45 59 2c 20 27 63 30 61 27 2c 20 ARY KEY, 'c0a', 4657 +| 3968: 27 63 31 62 27 2c 20 27 63 32 63 27 29 38 02 06 'c1b', 'c2c')8.. 4658 +| 3984: 17 11 11 08 5f 74 61 62 6c 65 74 31 74 31 43 52 ...._tablet1t1CR 4659 +| 4000: 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 EATE VIRTUAL TAB 4660 +| 4016: 4c 45 20 74 31 20 55 53 49 4e 47 20 66 74 73 33 LE t1 USING fts3 4661 +| 4032: 28 61 2c 62 2c 63 29 00 00 00 00 00 00 00 00 00 (a,b,c)......... 4662 +| page 3 offset 8192 4663 +| 0: 0d 00 00 00 26 0b 48 0e 0f d8 0f af 0f 86 0f 74 ....&.H........t 4664 +| 16: 0f 61 0f 4e 0f 2f 0f 0f 0e ef 0e 00 00 00 00 00 .a.N./.......... 4665 +| 2880: 00 00 00 00 00 00 00 00 81 3f 25 06 00 72 7f 00 .........?%..r.. 4666 +| 2896: 00 43 4f 4d 50 49 4c 45 52 3d 67 63 63 2d 35 2e .COMPILER=gcc-5. 4667 +| 2912: 34 2e 30 20 32 30 31 36 30 36 30 39 20 44 55 42 4.0 20160609 DUB 4668 +| 2928: 55 47 20 45 4e 41 e4 7c 45 20 44 42 53 54 41 54 UG ENA.|E DBSTAT 4669 +| 2944: e4 46 54 41 42 20 45 4e 41 42 4c 45 20 46 54 53 .FTAB ENABLE FTS 4670 +| 2960: 34 20 45 4e 41 42 4c 45 20 46 54 53 35 20 45 4e 4 ENABLE FTS5 EN 4671 +| 2976: 41 42 4c 45 20 47 45 4f 50 4f 4c 59 20 45 4e 41 ABLE GEOPOLY ENA 4672 +| 2992: 42 4c 45 20 4a 53 4f 4e 31 20 45 4e 41 42 4c 45 BLE JSON1 ENABLE 4673 +| 3008: 20 4d 45 4d 53 59 53 35 20 45 4e 41 42 4c 45 20 MEMSYS5 ENABLE 4674 +| 3024: 42 54 52 45 45 20 4d 41 58 20 4d 45 4d 4f 52 59 BTREE MAX MEMORY 4675 +| 3040: 3d 35 30 30 30 30 30 30 30 20 4f 4c 49 54 20 4c =50000000 OLIT L 4676 +| 3056: 4f 41 43 20 45 58 54 45 4e 53 49 4f 4e 21 54 48 OAC EXTENSION!TH 4677 +| 3072: 52 45 41 44 53 41 46 45 3d 30 18 24 05 00 25 0f READSAFE=0.$..%. 4678 +| 3088: 19 54 48 52 45 41 44 53 41 46 45 3d 30 58 42 49 .THREADSAFE=0XBI 4679 +| 3104: 4e 41 52 59 18 23 05 00 25 0f 19 54 48 52 45 41 NARY.#..%..THREA 4680 +| 3120: 44 53 41 4b 75 3d 30 58 4d 4f 43 41 53 45 17 22 DSAKu=0XMOCASE.. 4681 +| 3136: 05 00 25 0f 17 54 48 52 45 41 44 53 41 46 46 3d ..%..THREADSAFF= 4682 +| 3152: 30 58 52 54 52 49 4d 1f 21 05 00 33 0f 19 4f 4d 0XRTRIM.!..3..OM 4683 +| 3168: 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 52 49 4f IT LOAD EXTENRIO 4684 +| 3184: 4e 58 42 49 4e 41 52 59 0f 20 05 00 33 0f 19 4f NXBINARY. ..3..O 4685 +| 3200: 4d 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 43 49 MIT LOAD EXTENCI 4686 +| 3216: 4f 4e 58 4e 4f 43 41 53 45 1e 1f 05 00 33 0f 17 ONXNOCASE....3.. 4687 +| 3232: 4f 4d 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 53 OMIT LOAD EXTENS 4688 +| 3248: 49 4f 4e 58 52 5d 12 49 4d 1f 1e 05 00 33 0f 19 IONXR].IM....3.. 4689 +| 3264: 4d 41 58 20 4d 45 4d 4f 52 59 3d 35 30 30 30 30 MAX MEMORY=50000 4690 +| 3280: 30 30 30 58 42 49 4e 41 52 59 1f 1d 05 00 33 0f 000XBINARY....3. 4691 +| 3296: 19 4d 41 58 20 4d 45 4d 4f 52 59 3d 35 30 30 30 .MAX MEMORY=5000 4692 +| 3312: 30 30 30 30 58 4f 4f 43 41 53 45 1e 1c 05 00 33 0000XOOCASE....3 4693 +| 3328: 0f 17 4d 41 b8 20 4d 45 4d 4f 52 59 3d 35 30 3c ..MA. MEMORY=50< 4694 +| 3344: 30 30 30 30 30 58 52 54 52 49 4d 18 1b 05 00 25 00000XRTRIM....% 4695 +| 3360: 0f 19 45 4e 41 42 4c 45 20 52 54 52 45 45 58 42 ..ENABLE RTREEXB 4696 +| 3376: 49 4e 41 52 59 18 1a 05 0d a5 0f 19 45 4e 41 42 INARY.......ENAB 4697 +| 3392: 4c 45 20 52 54 52 45 45 58 4e 4f 43 41 53 45 17 LE RTREEXNOCASE. 4698 +| 3408: 19 1c 00 25 0f 17 45 4e 41 42 4c 45 20 52 54 52 ...%..ENABLE RTR 4699 +| 3424: 45 45 58 52 54 52 49 4d 1a 18 05 00 29 0f 19 45 EEXRTRIM....)..E 4700 +| 3440: 4e 41 42 4c 45 20 4d 45 4d 53 59 53 35 58 42 49 NABLE MEMSYS5XBI 4701 +| 3456: 4e 41 53 59 1a 17 05 00 29 0f 19 45 4e 41 42 4c NASY....)..ENABL 4702 +| 3472: 45 20 4d 45 4d 53 59 53 35 58 4e 4f 43 41 53 45 E MEMSYS5XNOCASE 4703 +| 3488: 19 16 05 00 29 0f 17 45 4e 41 42 4c 45 20 4d 45 ....)..ENABLE ME 4704 +| 3504: 4d 53 59 53 35 58 52 54 52 49 4d 18 14 05 01 25 MSYS5XRTRIM....% 4705 +| 3520: 0f 19 45 4e 12 42 4c 45 20 4a 53 4f 4e 31 58 42 ..EN.BLE JSON1XB 4706 +| 3536: 49 4e 41 52 59 18 14 05 00 25 09 d9 45 4e 41 42 INARY....%..ENAB 4707 +| 3552: 4c 45 20 4a 53 4f 3e 31 58 4e 4f 43 41 53 45 17 LE JSO>1XNOCASE. 4708 +| 3568: 13 05 00 25 0f 17 45 4e 40 42 4c 45 20 4a 53 4f ...%..EN@BLE JSO 4709 +| 3584: 4e 31 58 52 54 52 49 4d 1a 12 05 82 29 0f 19 45 N1XRTRIM....)..E 4710 +| 3600: 4e 41 42 4c 45 20 47 45 4f 50 4f 4d 59 58 42 49 NABLE GEOPOMYXBI 4711 +| 3616: 4e 41 52 59 1a 11 05 c9 29 e8 19 46 4e 41 42 4c NARY....)..FNABL 4712 +| 3632: 48 c0 47 45 4f 50 4f 4c 59 58 4e 74 43 41 53 45 H.GEOPOLYXNtCASE 4713 +| 3648: 19 10 05 00 29 0f 17 45 4e 41 42 4c 45 20 47 45 ....)..ENABLE GE 4714 +| 3664: 4f 50 4f 4c 59 58 52 54 52 49 4d 17 0f 05 00 23 OPOLYXRTRIM....# 4715 +| 3680: 0f 19 45 4e 41 42 4c 45 30 46 54 53 35 58 42 49 ..ENABLE0FTS5XBI 4716 +| 3696: 4e 41 52 59 17 0e 05 00 23 0f 19 45 4e 41 42 4c NARY....#..ENABL 4717 +| 3712: 45 20 46 54 53 35 58 4e 4f 4a e1 53 45 16 0e 05 E FTS5XNOJ.SE... 4718 +| 3728: 00 23 0f 17 45 4e 41 42 4c 45 20 46 54 53 35 58 .#..ENABLE FTS5X 4719 +| 3744: 52 54 52 49 4d 17 0c 05 00 23 0f 19 45 4e 41 42 RTRIM....#..ENAB 4720 +| 3760: 4c 45 20 46 54 53 34 58 42 49 4e 41 52 59 17 0b LE FTS4XBINARY.. 4721 +| 3776: 05 00 23 0f 19 45 4e 41 42 4c 45 20 46 54 53 34 ..#..ENABLE FTS4 4722 +| 3792: 58 4e 4f 43 41 53 45 16 0a 05 00 23 0f 17 55 4e XNOCASE....#..UN 4723 +| 3808: 41 42 4c 45 20 46 54 53 34 58 52 54 52 49 4d 1e ABLE FTS4XRTRIM. 4724 +| 3824: 09 05 00 31 0f 19 45 4e 42 42 4c 45 20 44 42 53 ...1..ENBBLE DBS 4725 +| 3840: 54 41 54 20 56 54 41 42 58 42 49 4e 41 52 59 1e TAT VTABXBINARY. 4726 +| 3856: 08 05 00 31 0f 19 45 4e 41 42 4c 45 20 44 42 53 ...1..ENABLE DBS 4727 +| 3872: 54 41 54 20 56 54 41 42 58 4e 4f 43 41 53 45 1d TAT VTABXNOCASE. 4728 +| 3888: 07 05 00 31 0f 17 45 4e 41 42 4c 45 20 44 42 53 ...1..ENABLE DBS 4729 +| 3904: 54 41 54 20 56 54 41 42 58 52 54 52 4a 4d 11 06 TAT VTABXRTRJM.. 4730 +| 3920: 05 f0 17 0f 29 44 45 42 55 47 58 42 49 4e 41 52 ....)DEBUGXBINAR 4731 +| 3936: 59 11 05 05 00 17 0e 19 44 45 42 55 47 58 4e 4f Y.......DEBUGXNO 4732 +| 3952: 43 41 53 45 10 04 05 00 17 0f 16 44 45 42 55 47 CASE.......DEBUG 4733 +| 3968: 58 52 54 52 49 4d 27 03 05 00 43 0f 19 43 4f 4d XRTRIM'...C..COM 4734 +| 3984: 50 49 4c 45 52 3d 67 63 63 2d 35 2e 34 2e 30 20 PILER=gcc-5.4.0 4735 +| 4000: 32 30 31 36 30 36 30 39 58 42 49 4e 41 52 59 27 20160609XBINARY' 4736 +| 4016: 02 05 00 43 0f 19 43 4f 4d 50 49 4c 45 52 3d 67 ...C..COMPILER=g 4737 +| 4032: 63 63 2d 35 2e 34 2e 30 20 32 30 31 36 30 36 30 cc-5.4.0 2016060 4738 +| 4048: 39 58 4e 4f 43 41 53 45 26 01 06 00 43 0f 17 43 9XNOCASE&...C..C 4739 +| 4064: 4f 4d 50 49 4b 45 52 3d 67 63 63 2d 35 2e 34 2e OMPIKER=gcc-5.4. 4740 +| 4080: 30 20 32 30 31 36 30 36 40 39 58 29 54 52 49 4d 0 201606@9X)TRIM 4741 +| page 4 offset 12288 4742 +| 0: 0d 00 10 00 00 10 00 00 00 00 00 00 00 00 00 00 ................ 4743 +| 16: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 4744 +| page 5 offset 16384 4745 +| 0: 0d 00 00 00 02 0b a0 00 0c ad 0b a0 00 00 00 00 ................ 4746 +| 2976: 82 0a 02 08 08 09 08 08 17 84 06 30 20 32 35 33 ...........0 253 4747 +| 2992: 00 01 30 04 25 06 1b 00 00 08 32 30 31 36 30 36 ..0.%.....201606 4748 +| 3008: 30 39 03 25 07 00 00 01 34 03 25 05 00 00 01 35 09.%....4.%....5 4749 +| 3024: 03 25 04 00 01 07 30 30 30 30 30 30 30 03 25 1a .%....0000000.%. 4750 +| 3040: 00 00 08 63 6f 6d 70 69 6c 65 72 03 25 02 00 00 ...compiler.%... 4751 +| 3056: 06 64 62 73 74 61 74 03 25 0a 00 01 04 65 62 75 .dbstat.%....ebu 4752 +| 3072: 67 03 25 08 00 00 06 65 6e 61 62 7c 65 09 25 09 g.%....enab|e.%. 4753 +| 3088: 05 04 04 04 04 04 00 01 08 78 74 65 6e 73 69 6f .........xtensio 4754 +| 3104: 6e 03 25 1d 00 00 04 66 74 73 34 03 25 0d 00 03 n.%....fts4.%... 4755 +| 3120: 01 35 03 25 0f 00 00 03 67 63 63 03 25 03 00 01 .5.%....gcc.%... 4756 +| 3136: 06 65 6f 70 6f 6c 79 03 25 11 00 00 05 6a 73 6f .eopoly.%....jso 4757 +| 3152: 6e 31 03 25 13 00 00 04 6c 6f 61 64 03 25 1c 00 n1.%....load.%.. 4758 +| 3168: 00 03 6d 61 78 03 25 18 00 01 05 65 6e 6f 72 79 ..max.%....enory 4759 +| 3184: 03 25 19 00 03 04 ce 79 73 4d 03 25 15 00 00 04 .%.....ysM.%.... 4760 +| 3200: 6f 6d 69 74 03 25 1b 00 00 05 72 74 72 65 65 03 omit.%....rtree. 4761 +| 3216: 25 17 00 00 0a 74 68 72 65 61 64 73 61 66 65 03 %....threadsafe. 4762 +| 3232: 25 0e 00 00 04 76 74 61 62 03 25 0b 00 86 50 01 %....vtab.%...P. 4763 +| 3248: 08 08 08 08 08 17 8d 12 30 20 38 33 35 00 01 30 ........0 835..0 4764 +| 3264: 12 01 06 00 01 06 00 01 06 00 1f 03 00 01 03 00 ................ 4765 +| 3280: 01 03 00 00 08 32 30 31 36 30 36 30 39 09 01 07 .....20160609... 4766 +| 3296: 00 01 07 00 01 07 00 00 01 34 09 01 05 00 01 05 .........4...... 4767 +| 3312: 00 01 05 00 00 01 35 09 01 04 00 01 04 00 01 04 ......5......... 4768 +| 3328: 00 01 07 30 30 30 30 30 30 30 09 1c 04 00 01 04 ...0000000...... 4769 +| 3344: 00 01 04 00 00 06 62 69 6e 61 72 79 3c 03 01 02 ......binary<... 4770 +| 3360: 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02 ................ 4771 +| 3376: 00 03 01 02 02 00 02 f1 02 02 00 03 01 02 02 00 ................ 4772 +| 3392: 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00 03 ................ 4773 +| 3408: 01 01 f2 00 03 01 02 02 00 00 08 63 6f 6d 70 69 ...........compi 4774 +| 3424: 6c 65 72 09 01 02 00 01 02 00 01 02 00 00 06 67 ler............g 4775 +| 3440: d2 73 74 61 74 09 07 03 00 01 03 00 01 03 00 01 .stat........... 4776 +| 3456: 04 65 62 75 67 09 04 02 00 01 02 00 01 02 00 00 .ebug........... 4777 +| 3472: 06 65 6e 6f 82 6c 65 3f 07 02 00 01 02 00 01 02 .eno.le?........ 4778 +| 3488: b0 01 02 00 01 02 00 11 0a f0 01 02 00 01 02 00 ................ 4779 +| 3504: 01 02 00 01 02 00 01 02 00 01 a6 00 01 02 00 02 ................ 4780 +| 3520: 02 05 51 02 00 01 02 00 01 02 00 01 02 00 01 02 ..Q............. 4781 +| 3536: 00 01 02 00 01 02 00 01 08 78 74 65 6e 73 69 6f .........xtensio 4782 +| 3552: 6e 09 1f 04 00 01 04 00 00 04 00 00 04 66 74 73 n............fts 4783 +| 3568: 34 09 0a 03 00 01 03 00 01 03 00 03 01 35 09 0d 4............5.. 4784 +| 3584: 03 00 01 03 00 01 03 00 00 03 67 63 63 09 01 03 ..........gcc... 4785 +| 3600: 00 01 03 00 01 03 00 01 06 65 6f 70 73 6c 79 09 .........eopsly. 4786 +| 3616: 10 03 00 01 03 00 01 03 00 00 05 6a 73 6f 6e 31 ...........json1 4787 +| 3632: 09 13 03 00 01 03 00 01 03 00 00 04 6c 6f 61 64 ............load 4788 +| 3648: 09 1f 03 00 01 03 00 01 03 00 00 03 6d 61 78 09 ............max. 4789 +| 3664: 1c 02 00 01 02 00 01 02 00 01 05 65 6d 6f 72 79 ...........emory 4790 +| 3680: 09 1c 03 00 01 03 00 01 03 00 03 04 73 79 73 35 ............sys5 4791 +| 3696: 09 16 03 00 01 03 00 01 03 00 00 06 6e 6f 63 61 ............noca 4792 +| 3712: 73 65 3c 02 01 02 02 00 03 01 12 02 00 03 01 02 se<............. 4793 +| 3728: 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02 ................ 4794 +| 3744: 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00 ................ 4795 +| 3760: 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00 00 ................ 4796 +| 3776: 04 6f 6d 69 74 09 1f 02 00 01 02 00 01 02 00 00 .omit........... 4797 +| 3792: 05 72 74 72 65 65 09 19 03 00 01 03 00 01 03 00 .rtree.......... 4798 +| 3808: 03 02 69 6d 3c 01 01 02 02 00 03 01 02 02 00 03 ..im<........... 4799 +| 3824: 01 02 02 00 03 01 02 02 00 03 01 02 02 00 03 01 ................ 4800 +| 3840: 02 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 ................ 4801 +| 3856: 02 00 03 01 02 02 01 e3 01 02 02 00 03 01 02 02 ................ 4802 +| 3872: 00 00 0a 74 68 72 65 61 64 73 61 66 65 09 22 02 ...threadsafe... 4803 +| 3888: 00 01 02 00 01 02 00 00 04 76 74 61 62 09 07 04 .........vtab... 4804 +| 3904: 00 01 04 00 01 04 00 00 01 78 b4 01 01 01 01 02 .........x...... 4805 +| 3920: 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00 ................ 4806 +| 3936: 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00 01 ................ 4807 +| 3952: 01 01 01 f0 01 01 01 07 30 01 01 01 02 00 01 01 ........0....... 4808 +| 3968: 01 02 00 ea 01 01 02 00 01 01 01 02 00 11 01 01 ................ 4809 +| 3984: 02 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 ................ 4810 +| 4000: 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00 ................ 4811 +| 4016: 01 01 01 01 ff 01 01 01 02 00 01 01 01 02 00 01 ................ 4812 +| 4032: 01 01 02 00 01 11 01 02 00 01 01 01 02 00 01 01 ................ 4813 +| 4048: 01 02 00 01 01 01 02 00 01 01 01 02 00 01 01 01 ................ 4814 +| 4064: 02 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 ................ 4815 +| 4080: 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00 ................ 4816 +| page 6 offset 20480 4817 +| 0: 0a 00 00 00 02 0f f5 00 0f fb 0f f5 01 00 00 00 ................ 4818 +| 4080: 00 00 00 00 00 05 04 08 09 01 02 04 04 08 08 09 ................ 4819 +| page 7 offset 24576 4820 +| 0: 0d 00 00 00 05 0f b8 00 0e f4 0f e9 10 d6 0f c7 ................ 4821 +| 4016: 00 00 00 00 00 00 00 00 0f 85 02 23 61 75 74 6f ...........#auto 4822 +| 4032: 6d 65 72 67 65 3d 35 0d 04 02 23 6d 65 72 67 65 merge=5...#merge 4823 +| 4048: 3d 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =1.............. 4824 +| end crash-23ddd777a03bfd.db 4825 +}]} {} 4826 + 4827 +do_catchsql_test 27.2 { 4828 + WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x GLOB 2.16770 FROM x) 4829 + INSERT INTO t1(a) SELECT randomblob(3000) FROM t2 ; 4830 +} {0 {}} 4831 +do_catchsql_test 27.3 { 4832 + WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT 3+x FROM c WHERE x<2.653) 4833 + INSERT INTO t1(a) SELECT randomblob(-current_time) FROM c; 4834 +} {0 {}} 4835 +do_catchsql_test 27.4 { 4836 + UPDATE t1 SET b=quote((true) ) WHERE t1 MATCH 'h*h*'; 4837 +} {0 {}} 4838 +do_catchsql_test 27.5 { 4839 + WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT 3+x FROM c WHERE x<2.653) 4840 + INSERT INTO t1(a) SELECT randomblob(-current_time) FROM c; 4841 +} {0 {}} 4842 +do_catchsql_test 27.5 { 4843 + INSERT INTO t1(t1) SELECT x FROM t2; 4844 +} {0 {}} 4845 +do_catchsql_test 27.6 { 4846 + INSERT INTO t1(t1) SELECT x FROM t2; 4847 +} {0 {}} 4848 + 4849 +#------------------------------------------------------------------------- 4850 +reset_db 4851 +do_test 28.0 { 4852 + sqlite3 db {} 4853 + db deserialize [decode_hexdb { 4854 +.open --hexdb 4855 +| size 28672 pagesize 4096 filename crash-159ac1ca51ed55.db 4856 +| page 1 offset 0 4857 +| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3. 4858 +| 16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 00 .....@ ........ 4859 +| 96: 00 00 00 00 0d 0e b1 00 06 0d a4 00 0f 8d 0f 21 ...............! 4860 +| 112: 0e b9 0d c8 0e 7e 0d a4 00 00 00 00 00 00 00 00 .....~.......... 4861 +| 3488: 00 00 00 00 22 07 06 17 11 11 01 31 74 61 62 6c ...........1tabl 4862 +| 3504: 65 74 32 74 32 07 43 52 45 41 54 45 20 54 41 42 et2t2.CREATE TAB 4863 +| 3520: 4c 45 20 74 32 28 78 29 81 33 05 07 17 1f 1f 01 LE t2(x).3...... 4864 +| 3536: 82 35 74 61 62 6c 65 74 31 5f 73 65 67 64 69 72 .5tablet1_segdir 4865 +| 3552: 74 31 5f 73 65 67 64 69 72 05 43 52 45 41 54 45 t1_segdir.CREATE 4866 +| 3568: 20 54 41 42 4c 45 20 27 74 31 5f 73 65 67 64 69 TABLE 't1_segdi 4867 +| 3584: 72 27 28 6c 65 76 65 6c 20 49 4e 54 45 47 45 52 r'(level INTEGER 4868 +| 3600: 2c 69 64 78 20 49 4e 54 45 47 45 52 2c 73 74 61 ,idx INTEGER,sta 4869 +| 3616: 72 74 5f 62 6c 6f 63 6b 20 49 4e 54 45 47 45 52 rt_block INTEGER 4870 +| 3632: 2c 6c 65 61 76 65 73 5f 65 6e 64 5f 62 6c 6f 63 ,leaves_end_bloc 4871 +| 3648: 6b 20 49 4e 54 45 47 45 52 2c 65 6e 64 5f 62 6c k INTEGER,end_bl 4872 +| 3664: 6f 63 6b 20 49 4e 54 45 47 45 52 2c 72 6f 6f 74 ock INTEGER,root 4873 +| 3680: 20 42 4c 4f 42 2c 50 52 49 4d 41 52 59 20 4b 45 BLOB,PRIMARY KE 4874 +| 3696: 59 28 6c 65 76 65 6c 2c 20 69 64 78 29 29 31 06 Y(level, idx))1. 4875 +| 3712: 06 17 45 1f 01 00 69 6e 64 65 78 73 71 6c 69 74 ..E...indexsqlit 4876 +| 3728: 65 5f 61 75 74 6f 69 6e 64 65 78 5f 74 31 5f 73 e_autoindex_t1_s 4877 +| 3744: 65 67 64 69 72 5f 31 74 31 5f 73 65 67 64 69 72 egdir_1t1_segdir 4878 +| 3760: 06 0f c7 00 08 00 10 00 00 66 04 07 17 23 23 01 .........f...##. 4879 +| 3776: 81 13 74 61 62 6c 65 74 31 5f 73 65 67 6d 65 6e ..tablet1_segmen 4880 +| 3792: 64 73 74 31 5f 73 65 67 6d 65 6e 74 73 04 43 52 dst1_segments.CR 4881 +| 3808: 45 41 54 45 20 54 41 42 4c 45 20 27 74 31 5f 73 EATE TABLE 't1_s 4882 +| 3824: 65 67 6d 65 6e 74 73 27 28 62 6c 6f 63 6b 69 64 egments'(blockid 4883 +| 3840: 20 49 4e 54 45 47 45 52 20 50 52 49 4d 41 52 59 INTEGER PRIMARY 4884 +| 3856: 20 4b 45 59 2c 20 62 6c 6f 63 6b 20 42 4c 4f 42 KEY, block BLOB 4885 +| 3872: 29 6a 03 07 17 21 21 01 81 1f 74 61 62 6c 65 74 )j...!!...tablet 4886 +| 3888: 31 4f 63 6f 6e 74 65 6e 74 74 31 5f 63 6f 6e 74 1Ocontentt1_cont 4887 +| 3904: 65 6e 74 03 43 52 45 41 54 45 20 54 41 42 4c 45 ent.CREATE TABLE 4888 +| 3920: 20 27 74 31 5f 63 6f 6e 74 65 6e 74 27 28 64 6f 't1_content'(do 4889 +| 3936: 63 69 64 20 49 4e 54 45 43 a5 52 20 50 52 39 4d cid INTEC.R PR9M 4890 +| 3952: 41 52 59 20 4b 45 59 2c 20 27 63 30 61 27 2c 20 ARY KEY, 'c0a', 4891 +| 3968: 27 63 31 62 27 2c 20 27 63 32 63 27 29 38 02 06 'c1b', 'c2c')8.. 4892 +| 3984: 17 11 11 08 5f 74 61 62 6c 65 74 31 74 31 43 52 ...._tablet1t1CR 4893 +| 4000: 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 EATE VIRTUAL TAB 4894 +| 4016: 4c 45 20 74 31 20 55 53 49 4e 47 20 66 74 73 33 LE t1 USING fts3 4895 +| 4032: 28 61 2c 62 2c 63 29 00 00 00 00 00 00 00 00 00 (a,b,c)......... 4896 +| page 3 offset 8192 4897 +| 0: 0d 00 00 00 26 0b 48 00 00 00 00 00 00 00 00 00 ....&.H......... 4898 +| 2880: 00 00 00 00 00 00 00 00 81 3f 25 06 00 72 7f 00 .........?%..r.. 4899 +| 2896: 00 43 4f 4d 50 49 4c 45 52 3d 67 63 63 2d 35 2e .COMPILER=gcc-5. 4900 +| 2912: 34 2e 30 20 32 30 31 36 30 36 30 39 20 44 55 42 4.0 20160609 DUB 4901 +| 2928: 55 47 20 45 4e 41 e4 7c 45 20 44 42 53 54 41 54 UG ENA.|E DBSTAT 4902 +| 2944: e4 46 54 41 42 20 45 4e 41 42 4c 45 20 46 54 53 .FTAB ENABLE FTS 4903 +| 2960: 34 20 45 4e 41 42 4c 45 20 46 54 53 35 20 45 4e 4 ENABLE FTS5 EN 4904 +| 2976: 41 42 1f 45 20 47 45 4f 50 4f 4c 59 20 45 4e 41 AB.E GEOPOLY ENA 4905 +| 2992: 42 4c 45 20 4a 53 4f 4e 31 20 45 4e 41 42 4c 45 BLE JSON1 ENABLE 4906 +| 3008: 20 4d 45 4d 53 59 53 35 20 45 4e 41 42 4c 45 20 MEMSYS5 ENABLE 4907 +| 3024: 42 54 52 45 45 20 4d 41 58 20 4d 45 4d 4f 52 59 BTREE MAX MEMORY 4908 +| 3040: 3d 35 30 30 30 30 30 30 30 20 4f 4c 49 54 20 4c =50000000 OLIT L 4909 +| 3056: 4f 41 43 20 45 58 54 45 4e 53 49 4f 4e 21 54 48 OAC EXTENSION!TH 4910 +| 3072: 52 45 41 44 53 41 46 45 3d 2f 18 24 05 00 25 0f READSAFE=/.$..%. 4911 +| 3088: 19 54 48 52 45 41 44 53 41 46 45 3d 30 58 42 49 .THREADSAFE=0XBI 4912 +| 3104: 4e 41 52 59 18 23 05 00 25 0f 19 54 48 52 45 41 NARY.#..%..THREA 4913 +| 3120: 44 53 41 4b 75 3d 30 58 4d 4f 43 41 53 45 17 22 DSAKu=0XMOCASE.. 4914 +| 3136: 05 00 25 0f 17 54 48 52 45 41 44 53 41 46 46 3d ..%..THREADSAFF= 4915 +| 3152: 30 58 52 54 52 49 4d 1f 21 05 00 33 0f 19 4f 4d 0XRTRIM.!..3..OM 4916 +| 3168: 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 52 49 4f IT LOAD EXTENRIO 4917 +| 3184: 4e 58 42 49 4e 41 52 59 1f 20 05 00 33 0f 19 4f NXBINARY. ..3..O 4918 +| 3200: 4d 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 53 49 MIT LOAD EXTENSI 4919 +| 3216: 4f 4e 58 4e 4f 43 41 53 45 1e 1f 05 00 33 0f 17 ONXNOCASE....3.. 4920 +| 3232: 4f 4d 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 53 OMIT LOAD EXTENS 4921 +| 3248: 49 4f 4e 58 52 54 52 49 4d 1f 1e 05 00 33 0f 19 IONXRTRIM....3.. 4922 +| 3264: 4d 41 58 20 4d 45 4d 4f 52 59 3d 35 30 30 30 30 MAX MEMORY=50000 4923 +| 3280: 30 30 30 58 42 49 4e 41 52 59 1f 1d 05 00 33 0f 000XBINARY....3. 4924 +| 3296: 19 4d 41 58 20 4d 45 4d 4f 52 59 3d 35 30 30 30 .MAX MEMORY=5000 4925 +| 3312: 30 30 30 30 58 4e 4f 43 41 53 45 1e 1c 05 00 33 0000XNOCASE....3 4926 +| 3328: 0f 17 4d 42 b8 20 4d 45 4d 4f 52 59 3d 35 30 30 ..MB. MEMORY=500 4927 +| 3344: 30 30 30 30 30 58 52 54 52 4a 4d 18 1b 05 00 25 00000XRTRJM....% 4928 +| 3360: 0f 19 45 4e 41 42 4c 45 20 52 54 52 45 45 58 42 ..ENABLE RTREEXB 4929 +| 3376: 49 4e 41 52 59 18 1a 05 0d a5 0f 19 45 4e 41 42 INARY.......ENAB 4930 +| 3392: 4c 45 20 52 54 52 45 45 58 4e 4f 43 41 53 45 17 LE RTREEXNOCASE. 4931 +| 3408: 19 1c 00 25 0f 17 45 4e 41 42 4c 45 20 52 54 52 ...%..ENABLE RTR 4932 +| 3424: 45 45 58 52 54 52 49 4d 1a 18 05 00 29 0f 19 45 EEXRTRIM....)..E 4933 +| 3440: 4e 41 42 4c 45 20 4d 45 4d 53 59 53 35 58 42 49 NABLE MEMSYS5XBI 4934 +| 3456: 4e 41 52 59 1a 17 05 00 29 0f 19 45 4e 41 42 4c NARY....)..ENABL 4935 +| 3472: 45 20 4d 45 4d 53 59 53 35 58 4e 4f 43 41 53 45 E MEMSYS5XNOCASE 4936 +| 3488: 19 16 05 00 29 0f 17 45 4e 41 42 4c 45 20 4d 45 ....)..ENABLE ME 4937 +| 3504: 4d 53 59 53 35 58 52 54 52 49 4d 18 14 05 01 25 MSYS5XRTRIM....% 4938 +| 3520: 0f 19 45 4e 12 42 4c 45 20 4a 53 4f 4e 31 58 42 ..EN.BLE JSON1XB 4939 +| 3536: 49 4e 41 52 59 18 14 05 00 25 09 d9 45 4e 41 42 INARY....%..ENAB 4940 +| 3552: 4c 45 20 4a 53 4f 3e 31 58 4e 4f 43 41 53 45 17 LE JSO>1XNOCASE. 4941 +| 3568: 13 05 00 25 0f 17 44 4e 40 42 4c 45 20 4a 53 4f ...%..DN@BLE JSO 4942 +| 3584: 4e 31 58 52 54 52 49 4d 1a 12 05 82 29 0f 19 45 N1XRTRIM....)..E 4943 +| 3600: 4e 41 42 4c 45 20 47 45 4f 50 4f 4c 59 58 42 49 NABLE GEOPOLYXBI 4944 +| 3616: 4e 41 52 59 1a 11 05 c9 29 e8 19 46 4e 41 42 4c NARY....)..FNABL 4945 +| 3632: 48 c0 47 45 4f 50 4f 4c 59 58 4e 74 43 41 53 45 H.GEOPOLYXNtCASE 4946 +| 3648: 19 10 05 00 29 0f 17 45 4e 41 42 4c 45 20 47 45 ....)..ENABLE GE 4947 +| 3664: 4f 50 4f 4c 59 58 52 54 52 49 4d 17 0f 05 00 23 OPOLYXRTRIM....# 4948 +| 3680: 0f 19 45 4e 41 42 4c 45 30 46 54 53 35 58 42 49 ..ENABLE0FTS5XBI 4949 +| 3696: 4e 41 52 59 17 0e 05 00 23 0f 19 45 4e 41 42 4c NARY....#..ENABL 4950 +| 3712: 45 20 46 54 53 35 58 4e 4f 43 41 53 45 16 0e 05 E FTS5XNOCASE... 4951 +| 3728: 00 23 0f 17 45 4e 41 42 4c 45 20 46 54 53 35 58 .#..ENABLE FTS5X 4952 +| 3744: 52 54 52 49 4d 17 0c 05 00 23 0f 19 45 4e 41 42 RTRIM....#..ENAB 4953 +| 3760: 4c 45 20 46 54 53 34 58 42 49 4e 41 52 59 17 0b LE FTS4XBINARY.. 4954 +| 3776: 04 ff 23 0f 19 45 4e 41 42 4c 45 20 46 54 53 34 ..#..ENABLE FTS4 4955 +| 3792: 58 4e 4f 43 41 53 45 16 0a 05 00 23 0f 17 45 4e XNOCASE....#..EN 4956 +| 3808: 41 42 4c 45 20 46 54 53 34 58 52 54 52 49 4d 1e ABLE FTS4XRTRIM. 4957 +| 3824: 09 05 00 31 0f 19 45 4e 42 42 4c 45 20 44 42 53 ...1..ENBBLE DBS 4958 +| 3840: 54 41 54 20 56 54 41 42 58 42 49 4e 41 52 59 1e TAT VTABXBINARY. 4959 +| 3856: 08 05 00 31 0f 19 45 4e 41 42 4c 45 20 44 42 53 ...1..ENABLE DBS 4960 +| 3872: 54 41 54 20 56 54 41 42 58 4e 4f 43 41 53 45 1d TAT VTABXNOCASE. 4961 +| 3888: 07 05 00 31 0f 17 45 4e 41 42 4c 45 20 44 42 53 ...1..ENABLE DBS 4962 +| 3904: 54 41 54 20 56 54 41 42 58 52 54 52 4a 4d 11 06 TAT VTABXRTRJM.. 4963 +| 3920: 05 f0 17 0f 19 44 45 42 55 47 58 42 49 4e 41 52 .....DEBUGXBINAR 4964 +| 3936: 59 11 05 09 b0 17 0e 19 44 45 42 55 47 58 4e 4f Y.......DEBUGXNO 4965 +| 3952: 43 41 53 45 10 04 05 00 17 0f 16 44 45 42 55 47 CASE.......DEBUG 4966 +| 3968: 58 52 54 52 49 4d 27 03 05 00 43 0f 19 43 4f 4d XRTRIM'...C..COM 4967 +| 3984: 50 49 4c 45 52 3d 67 63 63 2d 35 2e 34 2e 30 20 PILER=gcc-5.4.0 4968 +| 4000: 32 30 31 36 30 36 30 39 58 42 49 4e 41 52 59 27 20160609XBINARY' 4969 +| 4016: 02 05 00 43 0f 19 43 4f 4d 50 49 4c 45 52 4d 67 ...C..COMPILERMg 4970 +| 4032: 63 63 2d 35 2e 34 2e 30 20 32 30 31 36 30 36 30 cc-5.4.0 2016060 4971 +| 4048: 39 58 4e 4f 43 41 53 45 26 01 06 00 43 0f 17 43 9XNOCASE&...C..C 4972 +| 4064: 4f 4d 50 49 4b 45 52 3d 67 63 63 2d 35 2e 34 2e OMPIKER=gcc-5.4. 4973 +| 4080: 30 20 32 30 31 36 30 36 40 39 58 29 54 52 49 4d 0 201606@9X)TRIM 4974 +| page 4 offset 12288 4975 +| 0: 0d 00 10 00 00 10 00 00 00 00 00 00 00 00 00 00 ................ 4976 +| page 5 offset 16384 4977 +| 0: 0d 00 00 00 02 0b a0 00 00 00 00 00 00 00 00 00 ................ 4978 +| 2976: 82 0a 02 08 08 09 08 08 17 84 06 30 20 32 35 33 ...........0 253 4979 +| 2992: 00 01 30 04 25 06 1b 00 00 08 32 30 31 36 30 36 ..0.%.....201606 4980 +| 3008: 30 39 03 25 07 00 00 01 34 03 25 05 00 00 01 35 09.%....4.%....5 4981 +| 3024: 03 25 04 00 4d 07 30 30 30 30 30 30 30 03 25 1a .%..M.0000000.%. 4982 +| 3040: 00 00 08 63 6f 6d 70 69 6c 65 72 03 25 02 00 00 ...compiler.%... 4983 +| 3056: 06 64 62 73 74 61 74 03 25 0a 00 01 04 65 62 75 .dbstat.%....ebu 4984 +| 3072: 67 03 25 08 00 00 06 65 6e 61 62 6c 65 09 25 09 g.%....enable.%. 4985 +| 3088: 05 04 04 04 04 04 00 01 08 78 74 65 6e 73 69 6f .........xtensio 4986 +| 3104: 6e 03 25 1d 00 00 04 66 74 73 34 03 25 0d 00 03 n.%....fts4.%... 4987 +| 3120: 01 35 03 25 0f 00 00 03 67 63 63 03 25 03 00 01 .5.%....gcc.%... 4988 +| 3136: 06 65 6f 70 6f 6c 79 03 25 10 ff ff f5 6a 73 6f .eopoly.%....jso 4989 +| 3152: 6e 31 03 25 13 00 00 04 6c 6f 61 64 03 25 1c 00 n1.%....load.%.. 4990 +| 3168: 00 03 6d 71 78 03 25 18 00 01 05 65 6e 6f 72 79 ..mqx.%....enory 4991 +| 3184: 03 25 19 00 03 04 ce 79 73 4d 03 25 15 00 00 04 .%.....ysM.%.... 4992 +| 3200: 6f 6d 69 74 03 25 1b 00 00 05 72 74 72 65 65 03 omit.%....rtree. 4993 +| 3216: 25 17 00 00 0a 7f 08 72 65 61 64 73 61 66 65 03 %......readsafe. 4994 +| 3232: 25 0e 00 00 04 76 75 61 62 03 25 0b 00 86 50 01 %....vuab.%...P. 4995 +| 3248: 08 08 08 08 08 17 8d 12 30 20 38 33 35 00 01 30 ........0 835..0 4996 +| 3264: 12 01 06 00 01 06 00 01 06 00 1f 03 00 01 03 09 ................ 4997 +| 3280: 51 03 00 00 09 32 30 31 36 30 36 30 39 09 01 07 Q....20160609... 4998 +| 3296: 00 01 07 00 01 07 00 00 01 34 09 01 05 00 01 05 .........4...... 4999 +| 3312: 00 01 05 00 00 01 35 09 01 04 00 01 03 ff 01 04 ......5......... 5000 +| 3328: 00 01 07 30 30 30 30 30 30 30 09 1c 04 00 01 04 ...0000000...... 5001 +| 3344: 00 01 04 00 00 06 62 69 6e 61 72 79 3c 03 01 02 ......binary<... 5002 +| 3360: 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02 ................ 5003 +| 3376: 00 03 01 02 02 00 02 f1 02 02 00 03 01 02 02 00 ................ 5004 +| 3392: 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00 03 ................ 5005 +| 3408: 01 02 02 00 03 01 02 02 00 00 08 63 6f 6d 70 69 ...........compi 5006 +| 3424: 6c 65 72 09 01 02 00 01 02 00 01 02 00 00 06 67 ler............g 5007 +| 3440: d2 73 74 61 74 09 07 03 00 01 03 00 01 03 00 01 .stat........... 5008 +| 3456: 04 65 62 75 67 09 04 02 00 01 02 00 01 02 00 00 .ebug........... 5009 +| 3472: 06 65 6e 6f 82 6c 65 3f 07 02 00 01 02 00 01 02 .eno.le?........ 5010 +| 3488: b0 01 02 00 00 f2 00 11 02 00 01 02 00 01 02 00 ................ 5011 +| 3504: 01 02 00 01 02 00 01 02 00 01 a6 00 01 02 00 01 ................ 5012 +| 3520: 02 05 51 02 00 01 02 00 01 02 00 01 02 00 01 02 ..Q............. 5013 +| 3536: 00 01 02 00 01 02 00 01 08 78 74 65 6e 73 69 6f .........xtensio 5014 +| 3552: 6e 09 1f 04 00 01 04 00 00 04 00 00 04 66 74 73 n............fts 5015 +| 3568: 34 09 0a 03 00 01 03 00 01 03 00 03 01 35 09 0d 4............5.. 5016 +| 3584: 03 00 01 03 00 01 03 00 00 03 67 63 63 09 01 03 ..........gcc... 5017 +| 3600: 00 01 03 00 01 03 00 01 06 65 6f 70 73 6c 79 09 .........eopsly. 5018 +| 3616: 10 03 00 01 03 00 01 03 00 00 05 6a 73 6f 6e 31 ...........json1 5019 +| 3632: 09 13 03 00 01 03 00 01 03 00 00 04 6c 6f 61 64 ............load 5020 +| 3648: 09 1f 03 00 01 03 00 01 03 00 00 03 6d 61 78 09 ............max. 5021 +| 3664: 1c 02 00 01 02 00 01 02 00 01 05 65 6d 6f 72 79 ...........emory 5022 +| 3680: 09 1c 03 00 01 03 00 01 03 00 03 04 73 79 73 35 ............sys5 5023 +| 3696: 09 16 03 00 01 03 00 01 03 00 00 06 6e 6f 63 61 ............noca 5024 +| 3712: 73 65 3c 02 01 02 02 00 03 01 12 02 00 03 01 02 se<............. 5025 +| 3728: 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02 ................ 5026 +| 3744: 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00 ................ 5027 +| 3760: 0f 71 02 02 00 03 01 02 02 00 03 6f 02 02 00 00 .q.........o.... 5028 +| 3776: 04 6f 6d 69 74 09 1f 02 00 01 02 00 01 02 00 00 .omit........... 5029 +| 3792: 05 72 74 72 65 65 09 19 03 00 01 03 00 01 03 00 .rtree.......... 5030 +| 3808: 03 02 69 6d 3c 01 01 02 02 00 03 01 02 02 00 03 ..im<........... 5031 +| 3824: 01 02 02 00 03 01 02 02 00 03 01 02 02 00 03 01 ................ 5032 +| 3840: 02 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 ................ 5033 +| 3856: 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02 ................ 5034 +| 3872: 00 00 0a 74 68 72 65 61 64 73 61 66 65 09 22 02 ...threadsafe... 5035 +| 3888: 00 01 02 00 01 02 00 00 04 76 74 61 62 09 07 04 .........vtab... 5036 +| 3904: 00 01 04 00 01 04 00 00 01 78 b4 01 01 01 01 02 .........x...... 5037 +| 3920: 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00 ................ 5038 +| 3936: 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00 01 ................ 5039 +| 3952: 01 01 02 00 01 01 01 07 30 01 01 01 02 00 01 01 ........0....... 5040 +| 3968: 01 02 00 11 01 01 02 00 01 01 01 02 00 11 01 01 ................ 5041 +| 3984: 02 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 ................ 5042 +| 4000: 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00 ................ 5043 +| 4016: 01 01 01 01 ff 01 01 01 02 00 01 01 01 02 00 01 ................ 5044 +| 4032: 01 01 02 00 01 01 01 02 00 01 01 01 02 00 01 01 ................ 5045 +| 4048: 01 02 00 01 01 01 02 00 01 01 01 02 00 01 01 01 ................ 5046 +| 4064: 02 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 ................ 5047 +| 4080: 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00 ................ 5048 +| page 6 offset 20480 5049 +| 0: 0a 00 00 00 02 0f f5 00 00 00 00 00 00 00 00 00 ................ 5050 +| 4080: 00 00 00 00 00 05 04 08 09 01 02 04 04 08 08 09 ................ 5051 +| page 7 offset 24576 5052 +| 0: 0d 00 00 00 05 0f b8 00 0e f4 0f e9 10 d6 0f c7 ................ 5053 +| 4016: 00 00 00 00 00 00 00 00 0d 05 02 23 61 75 74 6f ...........#auto 5054 +| 4032: 6d 65 72 67 65 3d 35 0d 04 02 23 6d 65 72 67 65 merge=5...#merge 5055 +| 4048: 3d 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =1.............. 5056 +| end crash-159ac1ca51ed55.db 5057 +}]} {} 5058 + 5059 +do_catchsql_test 28.1 { 5060 + WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT 3+x FROM c WHERE x<72) 5061 + INSERT INTO t1(a) SELECT randomblob(2829) FROM c; 5062 +} {0 {}} 5063 + 5064 +do_catchsql_test 28.1 { 5065 + UPDATE t1 SET b=quote((true) ) WHERE t1 MATCH 'h'; 5066 +} {0 {}} 5067 + 5068 +do_catchsql_test 28.1 { 5069 + WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT 3+x FROM c WHERE x<72) 5070 + INSERT INTO t1(a) SELECT randomblob(2829) FROM c; 5071 +} {0 {}} 5072 + 5073 +do_catchsql_test 28.1 { 5074 + WITH c(x) AS (VALUES(1) UNION ALL SELECT 3<<x FROM c WHERE x<72) 5075 + INSERT INTO t1(a) SELECT randomblob(2829) FROM c; 5076 +} {0 {}} 5077 + 5078 +do_catchsql_test 28.1 { 5079 + WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT 3+x FROM c WHERE x<72) 5080 + INSERT INTO t1(a) SELECT randomblob(2829) FROM c; 5081 +} {0 {}} 5082 + 5083 +do_catchsql_test 28.1 { 5084 + WITH c(x) AS (VALUES(1) UNION ALL SELECT 3<<x FROM c WHERE x<72) 5085 + INSERT INTO t1(a) SELECT randomblob(2829) FROM c; 5086 +} {0 {}} 5087 + 5088 +do_catchsql_test 28.1 { 5089 + WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+3 FROM c WHERE x<72) 5090 + INSERT INTO t1(a) SELECT randomblob(2829) FROM c; 5091 +} {0 {}} 5092 + 5093 +do_catchsql_test 28.1 { 5094 + INSERT INTO t1(t1) SELECT x FROM t2; 5095 +} {0 {}} 4403 5096 4404 5097 finish_test 4405 5098
Added test/fts3corrupt5.test.
1 +# 2019 May 22 2 +# 3 +# The author disclaims copyright to this source code. In place of 4 +# a legal notice, here is a blessing: 5 +# 6 +# May you do good and not evil. 7 +# May you find forgiveness for yourself and forgive others. 8 +# May you share freely, never taking more than you give. 9 +# 10 +#************************************************************************* 11 +# 12 +# 13 + 14 +set testdir [file dirname $argv0] 15 +source $testdir/tester.tcl 16 +source $testdir/fts3_common.tcl 17 +set testprefix fts3corrupt5 18 + 19 +# If SQLITE_ENABLE_FTS3 is defined, omit this file. 20 +ifcapable !fts3 { 21 + finish_test 22 + return 23 +} 24 + 25 +sqlite3_fts3_may_be_corrupt 1 26 + 27 +do_execsql_test 1.0 { 28 + BEGIN; 29 + CREATE VIRTUAL TABLE ft USING fts3(a, b, c); 30 + INSERT INTO ft VALUES('one', 'one', 'one'); 31 + COMMIT; 32 +} 33 + 34 +do_execsql_test 1.1 { 35 + SELECT * FROM ft WHERE ft MATCH 'b:one' 36 +} {one one one} 37 + 38 +do_execsql_test 1.2 { 39 + SELECT quote(root) FROM ft_segdir; 40 +} {X'00036F6E6509010201010201020200'} 41 + 42 +breakpoint 43 +foreach {tn val q bCorrupt} { 44 + 1 X'00036F6E650901' 'b:one' 1 45 + 2 X'00036F6E6509010201010201FFFFFF' 'c:one' 1 46 + 3 X'00036F6E6501' 'b:one' 1 47 + 4 X'00036F6E650101' 'b:one' 1 48 + 5 X'00036F6E650100' 'b:one' 0 49 +} { 50 + do_execsql_test 1.3.$tn.1 "UPDATE ft_segdir SET root = $val" 51 + 52 + set res {0 {}} 53 + if {$bCorrupt} { set res {1 {database disk image is malformed}}} 54 + do_catchsql_test 1.3.$tn.2 { 55 + SELECT * FROM ft WHERE ft MATCH $q 56 + } $res 57 +} 58 + 59 +finish_test 60 +
Changes to test/func3.test.
148 148 # EVIDENCE-OF: R-22887-63324 The unlikely(X) function is a no-op that 149 149 # the code generator optimizes away so that it consumes no CPU cycles at 150 150 # run-time (that is, during calls to sqlite3_step()). 151 151 # 152 152 do_test func3-5.39 { 153 153 db eval {EXPLAIN SELECT unlikely(min(1.0+'2.0',4*11))} 154 154 } [db eval {EXPLAIN SELECT min(1.0+'2.0',4*11)}] 155 + 156 +# Unlikely() does not preserve the affinity of X. 157 +# ticket https://www.sqlite.org/src/tktview/0c620df60b 158 +# 159 +do_execsql_test func3-5.40 { 160 + SELECT likely(CAST(1 AS INT))=='1'; 161 +} 0 162 +do_execsql_test func3-5.41 { 163 + SELECT unlikely(CAST(1 AS INT))=='1'; 164 +} 0 165 +do_execsql_test func3-5.41 { 166 + SELECT likelihood(CAST(1 AS INT),0.5)=='1'; 167 +} 0 155 168 156 169 157 170 # EVIDENCE-OF: R-23735-03107 The likely(X) function returns the argument 158 171 # X unchanged. 159 172 # 160 173 do_execsql_test func3-5.50 { 161 174 SELECT likely(9223372036854775807);
Changes to test/fuzzdata7.db.
cannot compute difference between binary files
Changes to test/fuzzdata8.db.
cannot compute difference between binary files
Changes to test/in.test.
730 730 731 731 do_execsql_test in-16.2 { 732 732 SELECT * FROM x1 733 733 WHERE a IN (SELECT a FROM x1 WHERE (a%7)==0) 734 734 ORDER BY a DESC, b; 735 735 } {} 736 736 737 - 737 +# 2019-06-11 738 +# https://www.sqlite.org/src/info/57353f8243c637c0 739 +# 740 +do_execsql_test in-17.1 { 741 + SELECT 1 IN ('1'); 742 +} 0 743 +do_execsql_test in-17.2 { 744 + SELECT 1 IN ('1' COLLATE nocase); 745 +} 0 746 +do_execsql_test in-17.3 { 747 + SELECT 1 IN (CAST('1' AS text)); 748 +} 0 749 +do_execsql_test in-17.4 { 750 + SELECT 1 IN (CAST('1' AS text) COLLATE nocase); 751 +} 0 738 752 739 753 finish_test
Changes to test/index7.test.
322 322 do_eqp_test index7-6.4 { 323 323 SELECT * FROM v4 WHERE d='xyz' AND c='def' 324 324 } {SEARCH TABLE t4 USING INDEX i4 (c=?)} 325 325 326 326 do_catchsql_test index7-6.5 { 327 327 CREATE INDEX t5a ON t5(a) WHERE a=#1; 328 328 } {1 {near "#1": syntax error}} 329 + 330 +do_execsql_test index7-7.0 { 331 + CREATE TABLE t6(x, y); 332 + INSERT INTO t6 VALUES(1, 1); 333 + INSERT INTO t6 VALUES(0, 0); 334 + SELECT * FROM t6 WHERE y IS TRUE ORDER BY x; 335 +} {1 1} 336 + 337 +do_execsql_test index7-7.1 { 338 + CREATE INDEX i6 ON t6(x) WHERE y IS NOT TRUE; 339 + SELECT * FROM t6 WHERE y IS TRUE ORDER BY x; 340 +} {1 1} 329 341 330 342 331 343 finish_test
Changes to test/indexexpr2.test.
273 273 do_execsql_test 6.2.2 { 274 274 CREATE INDEX x1i2 ON x1( CAST(b AS TEXT) ); 275 275 SELECT a, b FROM x1 WHERE CAST(b AS TEXT) = 123; 276 276 } {1 123 2 123} 277 277 do_eqp_test 6.2.3 { 278 278 SELECT a, b FROM x1 WHERE CAST(b AS TEXT) = 123; 279 279 } {SEARCH TABLE x1 USING INDEX x1i2 (<expr>=?)} 280 + 281 +do_execsql_test 7.0 { 282 + CREATE TABLE IF NOT EXISTS t0(c0); 283 + INSERT INTO t0(c0) VALUES (-9223372036854775808); 284 + BEGIN; 285 +} 286 +do_catchsql_test 7.1 { 287 + CREATE INDEX i0 ON t0(ABS(c0)); 288 +} {1 {integer overflow}} 289 +do_execsql_test 7.2 { 290 + COMMIT; 291 + SELECT sql FROM sqlite_master WHERE tbl_name = 't0'; 292 + CREATE INDEX i0 ON t0(c0); 293 +} {{CREATE TABLE t0(c0)}} 294 +do_execsql_test 7.3 { 295 + REINDEX; 296 +} {} 297 + 280 298 281 299 282 300 finish_test
Changes to test/intreal.test.
42 42 max(1,intreal(2),intreal(3),4); 43 43 } {4.0 4} 44 44 do_execsql_test 180 { 45 45 SELECT max(1.0,intreal(5),intreal(3),4.0), 46 46 max(1,intreal(5),intreal(3),4); 47 47 } {5.0 5.0} 48 48 49 +#------------------------------------------------------------------------- 50 +do_execsql_test 2.1 { 51 + CREATE TABLE t2(a REAL); 52 + INSERT INTO t2 VALUES( 836627109860825358 ); 53 + SELECT substr(a,1,4) FROM t2 WHERE a = CAST(836627109860825358 AS REAL); 54 +} {8.36} 55 + 56 +do_execsql_test 2.2 { 57 + CREATE INDEX i2 ON t2(a); 58 + SELECT substr(a,1,4) FROM t2 WHERE a = CAST(836627109860825358 AS REAL); 59 +} {8.36} 60 + 61 +do_execsql_test 2.3 { 62 + CREATE TABLE t0 (c0); 63 + CREATE TABLE t1 (c1 REAL); 64 + INSERT INTO t1(c1) VALUES (8366271098608253588); 65 + INSERT INTO t0(c0) VALUES ('a'); 66 +} 67 +set D [db one {SELECT c1 FROM t1}] 68 + 69 +do_execsql_test 2.4 { 70 + SELECT * FROM t1 WHERE (t1.c1 = CAST(8366271098608253588 AS REAL)); 71 +} $D 72 + 73 +do_execsql_test 2.5 { 74 + SELECT * FROM t0, t1 WHERE (t1.c1 = CAST(8366271098608253588 AS REAL)); 75 +} [list a $D] 49 76 77 +do_execsql_test 2.6 { 78 + SELECT * FROM t0, t1 79 + WHERE ( 80 + t1.c1 >= CAST(8366271098608253588 AS REAL) 81 + AND t1.c1 <= CAST(8366271098608253588 AS REAL) 82 + ); 83 +} [list a $D] 50 84 51 85 52 86 finish_test
Changes to test/istrue.test.
153 153 INSERT INTO t7(a,b,c) VALUES(2,true,false); 154 154 ALTER TABLE t7 ADD COLUMN d BOOLEAN DEFAULT false; 155 155 ALTER TABLE t7 ADD COLUMN e BOOLEAN DEFAULT true; 156 156 INSERT INTO t7(a,b,c) VALUES(3,true,false); 157 157 INSERT INTO t7 VALUES(4,false,true,true,false); 158 158 SELECT *,'x' FROM t7 ORDER BY a; 159 159 } {1 0 1 0 1 x 2 1 0 0 1 x 3 1 0 0 1 x 4 0 1 1 0 x} 160 + 161 +do_execsql_test istrue-710 { 162 + SELECT 0.5 IS TRUE COLLATE NOCASE; 163 + SELECT 0.5 IS TRUE COLLATE RTRIM; 164 + SELECT 0.5 IS TRUE COLLATE BINARY; 165 + 166 + SELECT 0.5 IS TRUE; 167 + SELECT 0.5 COLLATE NOCASE IS TRUE; 168 + SELECT 0.0 IS FALSE; 169 + 170 + SELECT 0.0 IS FALSE COLLATE NOCASE; 171 + SELECT 0.0 IS FALSE COLLATE RTRIM; 172 + SELECT 0.0 IS FALSE COLLATE BINARY; 173 +} {1 1 1 1 1 1 1 1 1} 160 174 161 175 finish_test
Changes to test/join5.test.
301 301 do_eqp_test 7.4 { 302 302 SELECT * FROM t3 LEFT JOIN t4 ON (t4.x = t3.x) WHERE (t4.y = ? OR t4.z = ?); 303 303 } { 304 304 QUERY PLAN 305 305 |--SCAN TABLE t3 306 306 `--SEARCH TABLE t4 USING INDEX t4xz (x=?) 307 307 } 308 + 309 +reset_db 310 +do_execsql_test 8.0 { 311 + CREATE TABLE t0 (c0, c1, PRIMARY KEY (c0, c1)); 312 + CREATE TABLE t1 (c0); 313 + 314 + INSERT INTO t1 VALUES (2); 315 + 316 + INSERT INTO t0 VALUES(0, 10); 317 + INSERT INTO t0 VALUES(1, 10); 318 + INSERT INTO t0 VALUES(2, 10); 319 + INSERT INTO t0 VALUES(3, 10); 320 +} 321 + 322 +do_execsql_test 8.1 { 323 + SELECT * FROM t0, t1 324 + WHERE (t0.c1 >= 1 OR t0.c1 < 1) AND t0.c0 IN (1, t1.c0) ORDER BY 1; 325 +} { 326 + 1 10 2 327 + 2 10 2 328 +} 308 329 309 330 finish_test
Changes to test/jrnlmode.test.
61 61 do_test jrnlmode-1.2 { 62 62 execsql { 63 63 PRAGMA journal_mode; 64 64 PRAGMA main.journal_mode; 65 65 PRAGMA temp.journal_mode; 66 66 } 67 67 } [list persist persist [temp_journal_mode persist]] 68 -do_test jrnlmode-1.4 { 68 +do_test jrnlmode-1.4a { 69 + # When defensive is on, unable to set journal_mode to OFF 70 + sqlite3_db_config db DEFENSIVE 1 71 + execsql { 72 + PRAGMA journal_mode = off; 73 + } 74 +} {persist} 75 +do_test jrnlmode-1.4b { 76 + # When defensive is on, unable to set journal_mode to OFF 77 + sqlite3_db_config db DEFENSIVE 0 69 78 execsql { 70 79 PRAGMA journal_mode = off; 71 80 } 72 81 } {off} 73 82 do_test jrnlmode-1.5 { 74 83 execsql { 75 84 PRAGMA journal_mode;
Changes to test/json104.test.
9 9 # 10 10 #*********************************************************************** 11 11 # This file implements tests for json_patch(A,B) SQL function. 12 12 # 13 13 14 14 set testdir [file dirname $argv0] 15 15 source $testdir/tester.tcl 16 +set testprefix json104 16 17 17 18 ifcapable !json1 { 18 19 finish_test 19 20 return 20 21 } 21 22 22 23 # This is the example from pages 2 and 3 of RFC-7396 ................................................................................ 121 122 do_execsql_test json104-313 { 122 123 SELECT json_patch('[1,2]','{"a":"b","c":null}'); 123 124 } {{{"a":"b"}}} 124 125 do_execsql_test json104-314 { 125 126 SELECT json_patch('{}','{"a":{"bb":{"ccc":null}}}'); 126 127 } {{{"a":{"bb":{}}}}} 127 128 129 +#------------------------------------------------------------------------- 130 + 131 +do_execsql_test 401 { 132 + CREATE TABLE obj(x); 133 + INSERT INTO obj VALUES('{"a":1,"b":2}'); 134 + SELECT * FROM obj; 135 +} {{{"a":1,"b":2}}} 136 +do_execsql_test 402 { 137 + UPDATE obj SET x = json_insert(x, '$.c', 3); 138 + SELECT * FROM obj; 139 +} {{{"a":1,"b":2,"c":3}}} 140 +do_execsql_test 403 { 141 + SELECT json_extract(x, '$.b') FROM obj; 142 + SELECT json_extract(x, '$."b"') FROM obj; 143 +} {2 2} 144 +do_execsql_test 404 { 145 + UPDATE obj SET x = json_set(x, '$."b"', 555); 146 + SELECT json_extract(x, '$.b') FROM obj; 147 + SELECT json_extract(x, '$."b"') FROM obj; 148 +} {555 555} 149 +do_execsql_test 405 { 150 + UPDATE obj SET x = json_set(x, '$."d"', 4); 151 + SELECT json_extract(x, '$."d"') FROM obj; 152 +} {4} 128 153 129 154 130 155 finish_test 156 + 157 +
Changes to test/like.test.
13 13 # in particular the optimizations that occur to help those operators 14 14 # run faster. 15 15 # 16 16 # $Id: like.test,v 1.13 2009/06/07 23:45:11 drh Exp $ 17 17 18 18 set testdir [file dirname $argv0] 19 19 source $testdir/tester.tcl 20 +set testprefix like 20 21 21 22 # Create some sample data to work with. 22 23 # 23 24 do_test like-1.0 { 24 25 execsql { 25 26 CREATE TABLE t1(x TEXT); 26 27 } ................................................................................ 1090 1091 SELECT y FROM t15 WHERE x LIKE '/%bc%' ESCAPE '/'; 1091 1092 } {22} 1092 1093 do_execsql_test like-15.121 { 1093 1094 EXPLAIN QUERY PLAN 1094 1095 SELECT y FROM t15 WHERE x LIKE '/%bc%' ESCAPE '/'; 1095 1096 } {/SEARCH/} 1096 1097 } 1098 + 1099 +#------------------------------------------------------------------------- 1100 +# Tests for ticket [b1d8c79314]. 1101 +# 1102 +reset_db 1103 +do_execsql_test 16.0 { 1104 + CREATE TABLE t1(a INTEGER COLLATE NOCASE); 1105 + CREATE INDEX i1 ON t1(a); 1106 + INSERT INTO t1 VALUES(' 1x'); 1107 + INSERT INTO t1 VALUES(' 1-'); 1108 +} 1109 +do_execsql_test 16.1 { 1110 + SELECT * FROM t1 WHERE a LIKE ' 1%'; 1111 +} {{ 1x} { 1-}} 1112 +do_execsql_test 16.2 { 1113 + SELECT * FROM t1 WHERE a LIKE ' 1-'; 1114 +} {{ 1-}} 1097 1115 1098 1116 finish_test 1117 +
Changes to test/like3.test.
193 193 # 194 194 do_execsql_test like3-5.400 { 195 195 DROP TABLE IF EXISTS t0; 196 196 CREATE TABLE t0(c0 INT UNIQUE COLLATE NOCASE); 197 197 INSERT INTO t0(c0) VALUES ('./'); 198 198 SELECT * FROM t0 WHERE t0.c0 LIKE './'; 199 199 } {./} 200 + 201 +# 2019-06-14 202 +# Ticket https://www.sqlite.org/src/info/ce8717f0885af975 203 +do_execsql_test like3-5.410 { 204 + DROP TABLE IF EXISTS t0; 205 + CREATE TABLE t0(c0 INT UNIQUE COLLATE NOCASE); 206 + INSERT INTO t0(c0) VALUES ('.1%'); 207 + SELECT * FROM t0 WHERE t0.c0 LIKE '.1%'; 208 +} {.1%} 200 209 201 210 202 211 # 2019-02-27 203 212 # Verify that the LIKE optimization works with an ESCAPE clause when 204 213 # using PRAGMA case_sensitive_like=ON. 205 214 # 206 215 ifcapable !icu {
Changes to test/permutations.test.
962 962 } -shutdown { 963 963 unregister_jt_vfs 964 964 } -files [test_set $::allquicktests -exclude { 965 965 wal* incrvacuum.test ioerr.test corrupt4.test io.test crash8.test 966 966 async4.test bigfile.test backcompat.test e_wal* fstat.test mmap2.test 967 967 pager1.test syscall.test tkt3457.test *malloc* mmap* multiplex* nolock* 968 968 pager2.test *fault* rowal* snapshot* superlock* symlink.test 969 - delete_db.test shmlock.test 969 + delete_db.test shmlock.test chunksize.test 970 970 }] 971 971 972 972 if {[info commands register_demovfs] != ""} { 973 973 test_suite "demovfs" -description { 974 974 Check that the demovfs (code in test_demovfs.c) more or less works. 975 975 } -initialize { 976 976 register_demovfs
Changes to test/pragma4.test.
246 246 do_test 4.6.3 { 247 247 execsql { DROP TABLE c2 } db2 248 248 } {} 249 249 do_execsql_test 4.6.4 { pragma foreign_key_check('c1') } {c1 1 t1 0} 250 250 do_catchsql_test 4.6.5 { 251 251 pragma foreign_key_check('c2') 252 252 } {1 {no such table: c2}} 253 + 254 +do_execsql_test 5.0 { 255 + CREATE TABLE t4(a DEFAULT 'abc' /* comment */, b DEFAULT -1 -- comment 256 + , c DEFAULT +4.0 /* another comment */ 257 + ); 258 + PRAGMA table_info = t4; 259 +} { 260 + 0 a {} 0 'abc' 0 1 b {} 0 -1 0 2 c {} 0 +4.0 0 261 +} 262 + 253 263 254 264 finish_test
Changes to test/quote.test.
12 12 # focus of this file is the ability to specify table and column names 13 13 # as quoted strings. 14 14 # 15 15 # $Id: quote.test,v 1.7 2007/04/25 11:32:30 drh Exp $ 16 16 17 17 set testdir [file dirname $argv0] 18 18 source $testdir/tester.tcl 19 +set testprefix quote 19 20 20 21 # Create a table with a strange name and with strange column names. 21 22 # 22 23 do_test quote-1.0 { 23 24 catchsql {CREATE TABLE '@abc' ( '#xyz' int, '!pqr' text );} 24 25 } {0 {}} 25 26 ................................................................................ 80 81 # 81 82 do_test quote-1.6 { 82 83 set r [catch { 83 84 execsql {DROP TABLE '@abc'} 84 85 } msg ] 85 86 lappend r $msg 86 87 } {0 {}} 88 + 89 +#------------------------------------------------------------------------- 90 +# Check that it is not possible to use double-quotes for a string 91 +# constant in a CHECK constraint or CREATE INDEX statement. However, 92 +# SQLite can load such a schema from disk. 93 +# 94 +reset_db 95 +sqlite3_db_config db SQLITE_DBCONFIG_DQS_DDL 0 96 +sqlite3_db_config db SQLITE_DBCONFIG_DQS_DML 1 97 +do_execsql_test 2.0 { 98 + CREATE TABLE t1(x, y, z); 99 +} 100 +foreach {tn sql errname} { 101 + 1 { CREATE TABLE xyz(a, b, c CHECK (c!="null") ) } null 102 + 2 { CREATE INDEX i2 ON t1(x, y, z||"abc") } abc 103 + 3 { CREATE INDEX i3 ON t1("w") } w 104 + 4 { CREATE INDEX i4 ON t1(x) WHERE z="w" } w 105 +} { 106 + do_catchsql_test 2.1.$tn $sql [list 1 "no such column: $errname"] 107 +} 108 + 109 +do_execsql_test 2.2 { 110 + PRAGMA writable_schema = 1; 111 + CREATE TABLE xyz(a, b, c CHECK (c!="null") ); 112 + CREATE INDEX i2 ON t1(x, y, z||"abc"); 113 + CREATE INDEX i3 ON t1("w"); 114 + CREATE INDEX i4 ON t1(x) WHERE z="w"; 115 +} 116 + 117 +db close 118 +sqlite3 db test.db 119 + 120 +do_execsql_test 2.3.1 { 121 + INSERT INTO xyz VALUES(1, 2, 3); 122 +} 123 +do_catchsql_test 2.3.2 { 124 + INSERT INTO xyz VALUES(1, 2, 'null'); 125 +} {1 {CHECK constraint failed: xyz}} 126 + 127 +do_execsql_test 2.4 { 128 + INSERT INTO t1 VALUES(1, 2, 3); 129 + INSERT INTO t1 VALUES(4, 5, 'w'); 130 + SELECT * FROM t1 WHERE z='w'; 131 +} {4 5 w} 132 +do_execsql_test 2.5 { 133 + SELECT sql FROM sqlite_master; 134 +} { 135 + {CREATE TABLE t1(x, y, z)} 136 + {CREATE TABLE xyz(a, b, c CHECK (c!="null") )} 137 + {CREATE INDEX i2 ON t1(x, y, z||"abc")} 138 + {CREATE INDEX i3 ON t1("w")} 139 + {CREATE INDEX i4 ON t1(x) WHERE z="w"} 140 +} 141 + 87 142 88 143 89 144 finish_test
Changes to test/releasetest.tcl.
277 277 "Debug-One" "mptest test" 278 278 "Have-Not" test 279 279 "Secure-Delete" test 280 280 "Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test" 281 281 "User-Auth" tcltest 282 282 "Update-Delete-Limit" test 283 283 "Extra-Robustness" test 284 - "Device-Two" test 284 + "Device-Two" "threadtest test" 285 285 "No-lookaside" test 286 286 "Devkit" test 287 287 "Apple" test 288 288 "Sanitize" {QUICKTEST_OMIT=func4.test,nan.test test} 289 289 "Device-One" fulltest 290 290 "Default" "threadtest fulltest" 291 291 "Valgrind" valgrindtest
Changes to test/releasetest_data.tcl.
242 242 "Debug-One" "mptest test" 243 243 "Have-Not" test 244 244 "Secure-Delete" test 245 245 "Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test" 246 246 "User-Auth" tcltest 247 247 "Update-Delete-Limit" test 248 248 "Extra-Robustness" test 249 - "Device-Two" test 249 + "Device-Two" "threadtest test" 250 250 "No-lookaside" test 251 251 "Devkit" test 252 252 "Apple" test 253 253 "Sanitize" {QUICKTEST_OMIT=func4.test,nan.test test} 254 254 "Device-One" fulltest 255 255 "Default" "threadtest fulltest" 256 256 "Valgrind" valgrindtest
Added test/round1.test.
1 +# 2019-05-24 2 +# 3 +# The author disclaims copyright to this source code. In place of 4 +# a legal notice, here is a blessing: 5 +# 6 +# May you do good and not evil. 7 +# May you find forgiveness for yourself and forgive others. 8 +# May you share freely, never taking more than you give. 9 +# 10 +#*********************************************************************** 11 +# Test cases for rounding behavior of floating point values. 12 +# 13 + 14 +set testdir [file dirname $argv0] 15 +source $testdir/tester.tcl 16 +set testprefix round1 17 + 18 +expr srand(0) 19 +unset -nocomplain iTest 20 +for {set iTest 1} {$iTest<=50000} {incr iTest} { 21 + set x1 [expr int(rand()*100000)] 22 + set x2 [expr int(rand()*100000)+1000*int(rand()*10000)] 23 + set n [expr int(rand()*8)+1] 24 + set x3 [string range [format %09d $x2] [expr {9-$n}] end] 25 + set r $x1.$x3 26 + set ans [string trimright $r 0] 27 + if {[string match *. $ans]} {set ans ${ans}0} 28 + do_test $iTest/$n/${r}4=>$ans { 29 + set x [db one "SELECT round(${r}4,$n)"] 30 + } $ans 31 + set x4 [string range [format %09d [expr {$x2+1}]] [expr {9-$n}] end] 32 + if {[string trim $x3 9]==""} {incr x1} 33 + set r2 $x1.$x4 34 + set ans [string trimright $r2 0] 35 + if {[string match *. $ans]} {set ans ${ans}0} 36 + do_test $iTest/$n/${r}5=>$ans { 37 + set x [db one "SELECT round(${r}5,$n)"] 38 + } $ans 39 +} 40 + 41 +finish_test
Changes to test/rowid.test.
760 760 do_execsql_test rowid-14.3 { 761 761 DELETE FROM t14; 762 762 SELECT * FROM t14 WHERE x < 'a' ORDER BY rowid ASC; 763 763 } {} 764 764 do_execsql_test rowid-14.4 { 765 765 SELECT * FROM t14 WHERE x < 'a' ORDER BY rowid DESC; 766 766 } {} 767 + 768 +reset_db 769 +do_execsql_test rowid-15.0 { 770 + PRAGMA reverse_unordered_selects=true; 771 + CREATE TABLE t1 (c0, c1); 772 + CREATE TABLE t2 (c0 INT UNIQUE); 773 + INSERT INTO t1(c0, c1) VALUES (0, 0), (0, NULL); 774 + INSERT INTO t2(c0) VALUES (1); 775 +} 776 + 777 +do_execsql_test rowid-15.1 { 778 + SELECT t2.c0, t1.c1 FROM t1, t2 779 + WHERE (t2.rowid <= 'a') OR (t1.c0 <= t2.c0) LIMIT 100 780 +} {1 {} 1 0} 781 + 782 +do_execsql_test rowid-15.2 { 783 + SELECT 1, NULL INTERSECT SELECT * FROM ( 784 + SELECT t2.c0, t1.c1 FROM t1, t2 785 + WHERE ((t2.rowid <= 'a')) OR (t1.c0 <= t2.c0) ORDER BY 'a' DESC LIMIT 100 786 + ); 787 +} {1 {}} 788 + 767 789 768 790 finish_test
Changes to test/select6.test.
8 8 # May you share freely, never taking more than you give. 9 9 # 10 10 #*********************************************************************** 11 11 # This file implements regression tests for SQLite library. The 12 12 # focus of this file is testing SELECT statements that contain 13 13 # subqueries in their FROM clause. 14 14 # 15 -# $Id: select6.test,v 1.29 2009/01/09 01:12:28 drh Exp $ 16 15 17 16 set testdir [file dirname $argv0] 18 17 source $testdir/tester.tcl 19 18 20 19 # Omit this whole file if the library is build without subquery support. 21 20 ifcapable !subquery { 22 21 finish_test ................................................................................ 609 608 DROP TABLE t2; 610 609 CREATE TABLE t1(x); 611 610 CREATE TABLE t2(y, z); 612 611 SELECT ( SELECT y FROM t2 WHERE z = cnt ) 613 612 FROM ( SELECT count(*) AS cnt FROM t1 ); 614 613 } {{}} 615 614 615 +# 2019-05-29 ticket https://www.sqlite.org/src/info/c41afac34f15781f 616 +# A LIMIT clause in a subquery is incorrectly applied to a subquery. 617 +# 618 +do_execsql_test 12.100 { 619 + DROP TABLE t1; 620 + DROP TABLE t2; 621 + CREATE TABLE t1(a); 622 + INSERT INTO t1 VALUES(1); 623 + INSERT INTO t1 VALUES(2); 624 + CREATE TABLE t2(b); 625 + INSERT INTO t2 VALUES(3); 626 + SELECT * FROM ( 627 + SELECT * FROM (SELECT * FROM t1 LIMIT 1) 628 + UNION ALL 629 + SELECT * from t2); 630 +} {1 3} 616 631 617 632 finish_test
Changes to test/speedtest1.c.
1187 1187 speedtest1_random_ascii_fp(zFP1); 1188 1188 speedtest1_random_ascii_fp(zFP2); 1189 1189 sqlite3_bind_text(g.pStmt, 1, zFP1, -1, SQLITE_STATIC); 1190 1190 sqlite3_bind_text(g.pStmt, 2, zFP2, -1, SQLITE_STATIC); 1191 1191 speedtest1_run(); 1192 1192 } 1193 1193 speedtest1_end_test(); 1194 + 1195 + n = g.szTest*5000; 1196 + speedtest1_begin_test(140, "%d calls to round()", n); 1197 + speedtest1_exec("SELECT sum(round(a,2)+round(b,4)) FROM t1;"); 1198 + speedtest1_end_test(); 1199 + 1200 + 1201 + speedtest1_begin_test(150, "%d printf() calls", n*4); 1202 + speedtest1_exec( 1203 + "WITH c(fmt) AS (VALUES('%%g'),('%%e'),('%%!g'),('%%.20f'))" 1204 + "SELECT sum(printf(fmt,a)) FROM t1, c" 1205 + ); 1206 + speedtest1_end_test(); 1194 1207 } 1195 1208 1196 1209 #ifdef SQLITE_ENABLE_RTREE 1197 1210 /* Generate two numbers between 1 and mx. The first number is less than 1198 1211 ** the second. Usually the numbers are near each other but can sometimes 1199 1212 ** be far apart. 1200 1213 */
Changes to test/subquery2.test.
193 193 } 194 194 } { 195 195 do_catchsql_test 4.$tn $sql [list {*}{ 196 196 1 {ORDER BY clause should come after UNION ALL not before} 197 197 }] 198 198 } 199 199 200 +#------------------------------------------------------------------------- 201 +# Test that ticket [9cdc5c46] is fixed. 202 +# 203 +reset_db 204 +do_execsql_test 5.0 { 205 + CREATE TABLE t1(x); 206 + INSERT INTO t1 VALUES('ALFKI'); 207 + INSERT INTO t1 VALUES('ANATR'); 208 + 209 + CREATE TABLE t2(y, z); 210 + CREATE INDEX t2y ON t2 (y); 211 + INSERT INTO t2 VALUES('ANATR', '1997-08-08 00:00:00'); 212 + INSERT INTO t2 VALUES('ALFKI', '1997-08-25 00:00:00'); 213 +} 214 +do_execsql_test 5.1 { 215 + SELECT ( SELECT y FROM t2 WHERE x = y ORDER BY y, z) FROM t1; 216 +} {ALFKI ANATR} 200 217 201 218 finish_test
Changes to test/tkt-78e04e52ea.test.
37 37 } {0 {} {} 0 {} 0 1 x CHAR(100) 0 {} 0} 38 38 do_test tkt-78e04-1.3 { 39 39 execsql { 40 40 CREATE INDEX i1 ON ""("" COLLATE nocase); 41 41 } 42 42 } {} 43 43 do_test tkt-78e04-1.4 { 44 - db eval {EXPLAIN QUERY PLAN SELECT "" FROM "" WHERE "" LIKE '1abc%';} 44 + db eval {EXPLAIN QUERY PLAN SELECT "" FROM "" WHERE "" LIKE '1e5%';} 45 45 } {/*SCAN TABLE USING COVERING INDEX i1*/} 46 46 do_test tkt-78e04-1.5 { 47 47 execsql { 48 48 DROP TABLE ""; 49 49 SELECT name FROM sqlite_master; 50 50 } 51 51 } {t2}
Changes to test/tkt-a8a0d2996a.test.
80 80 SELECT '100x'+'-2y'; 81 81 } {98} 82 82 do_execsql_test 4.3 { 83 83 SELECT '100x'+'4.5y'; 84 84 } {104.5} 85 85 do_execsql_test 4.4 { 86 86 SELECT '-9223372036854775807x'-'1x'; 87 -} {-9.22337203685478e+18} 87 +} {-9223372036854775808} 88 88 do_execsql_test 4.5 { 89 89 SELECT '9223372036854775806x'+'1x'; 90 -} {9.22337203685478e+18} 90 +} {9223372036854775807} 91 91 do_execsql_test 4.6 { 92 - SELECT '1234x'/'10y'; 93 -} {123.4} 92 + SELECT '1234x'/'10y', '1234x'/'10.y', '1234x'/'1e1y'; 93 +} {123 123.4 123.4} 94 94 95 95 finish_test
Changes to test/view.test.
707 707 INSERT INTO t16 VALUES(1, 1, 1); 708 708 INSERT INTO t16 VALUES(2, 2, 2); 709 709 INSERT INTO t16 VALUES(3, 3, 3); 710 710 CREATE VIEW v16 AS SELECT max(a) AS mx, min(b) AS mn FROM t16 GROUP BY c; 711 711 712 712 SELECT * FROM v16 AS one, v16 AS two WHERE one.mx=1; 713 713 } { 714 + 1 1 1 1 715 + 1 1 2 2 716 + 1 1 3 3 717 +} 718 +do_execsql_test view-26.1 { 719 + WITH v17(x,y) AS (SELECT max(a), min(b) FROM t16 GROUP BY c) 720 + SELECT * FROM v17 AS one, v17 AS two WHERE one.x=1; 721 +} { 714 722 1 1 1 1 715 723 1 1 2 2 716 724 1 1 3 3 717 725 } 718 726 719 727 finish_test
Changes to test/vtab1.test.
1307 1307 1.1 "SELECT a FROM e6 WHERE b>'8James'" {4 2 6 1 5} 1308 1308 {xFilter {SELECT rowid, a, b FROM 't6' WHERE b > ?} 8James} 1309 1309 1310 1310 1.2 "SELECT a FROM e6 WHERE b>='8' AND b<'9'" {3 4} 1311 1311 {xFilter {SELECT rowid, a, b FROM 't6' WHERE b >= ? AND b < ?} 8 9} 1312 1312 1313 1313 1.3 "SELECT a FROM e6 WHERE b LIKE '8J%'" {3 4} 1314 - {xFilter {SELECT rowid, a, b FROM 't6' WHERE b like ?} 8J%} 1314 + {xFilter {SELECT rowid, a, b FROM 't6' WHERE b >= ? AND b < ? AND b like ?} 8J 8k 8J%} 1315 1315 1316 1316 1.4 "SELECT a FROM e6 WHERE b LIKE '8j%'" {3 4} 1317 - {xFilter {SELECT rowid, a, b FROM 't6' WHERE b like ?} 8j%} 1317 + {xFilter {SELECT rowid, a, b FROM 't6' WHERE b >= ? AND b < ? AND b like ?} 8J 8k 8j%} 1318 + 1319 + 1.5 "SELECT a FROM e6 WHERE b LIKE '8%'" {3 4} 1320 + {xFilter {SELECT rowid, a, b FROM 't6' WHERE b like ?} 8%} 1318 1321 } { 1319 1322 set echo_module {} 1320 1323 do_execsql_test 18.$tn.1 $sql $res 1321 1324 do_test 18.$tn.2 { lrange $::echo_module 2 end } $filter 1322 1325 } 1323 1326 1324 1327 do_execsql_test 18.2.0 { PRAGMA case_sensitive_like = ON } 1325 1328 foreach {tn sql res filter} { 1326 - 2.1 "SELECT a FROM e6 WHERE b LIKE '8J%'" {3 4} 1327 - {xFilter {SELECT rowid, a, b FROM 't6' WHERE b like ?} 8J%} 1329 + 2.1 "SELECT a FROM e6 WHERE b LIKE '8%'" {3 4} 1330 + {xFilter {SELECT rowid, a, b FROM 't6' WHERE b like ?} 8%} 1328 1331 1329 1332 2.2 "SELECT a FROM e6 WHERE b LIKE '8j%'" {} 1330 - {xFilter {SELECT rowid, a, b FROM 't6' WHERE b like ?} 8j%} 1333 + {xFilter {SELECT rowid, a, b FROM 't6' WHERE b >= ? AND b < ? AND b like ?} 8j 8k 8j%} 1334 + 1335 + 2.3 "SELECT a FROM e6 WHERE b LIKE '8J%'" {3 4} 1336 + {xFilter {SELECT rowid, a, b FROM 't6' WHERE b >= ? AND b < ? AND b like ?} 8J 8K 8J%} 1331 1337 } { 1332 1338 set echo_module {} 1333 1339 do_execsql_test 18.$tn.1 $sql $res 1334 1340 do_test 18.$tn.2 { lrange $::echo_module 2 end } $filter 1335 1341 } 1336 1342 do_execsql_test 18.2.x { PRAGMA case_sensitive_like = OFF } 1337 1343
Changes to test/vtabH.test.
28 28 CREATE TABLE t6(a, b TEXT); 29 29 CREATE INDEX i6 ON t6(b, a); 30 30 CREATE VIRTUAL TABLE e6 USING echo(t6); 31 31 } 32 32 33 33 foreach {tn sql expect} { 34 34 1 "SELECT * FROM e6 WHERE b LIKE '8abc'" { 35 - xBestIndex {SELECT rowid, a, b FROM 't6' WHERE b like ?} 36 - xFilter {SELECT rowid, a, b FROM 't6' WHERE b like ?} 8abc 35 + xBestIndex 36 + {SELECT rowid, a, b FROM 't6' WHERE b >= ? AND b < ? AND b like ?} 37 + xFilter 38 + {SELECT rowid, a, b FR