Fossil SCM

Sync with trunk.

florian 2022-09-25 07:23 UTC timeline-keyboard-navigation merge
Commit 3c929719962bd82dc75a87aae3aa5ada17da7c7cb1b2e796d5ea0cecfec58345
D .dockerignore
-23
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,23 +0,0 @@
1
-_FOSSIL_
2
-.fslckout
3
-ajax
4
-art
5
-autosetup
6
-bld
7
-compat
8
-debian
9
-fossil
10
-fossil.exe
11
-msvcbld
12
-setup
13
-src
14
-test
15
-tools
16
-win
17
-wbld
18
-win
19
-www
20
-*.a
21
-*.lib
22
-*.log
23
-*.mani
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,23 +0,0 @@
1 _FOSSIL_
2 .fslckout
3 ajax
4 art
5 autosetup
6 bld
7 compat
8 debian
9 fossil
10 fossil.exe
11 msvcbld
12 setup
13 src
14 test
15 tools
16 win
17 wbld
18 win
19 www
20 *.a
21 *.lib
22 *.log
23 *.mani
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,23 +0,0 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
+91 -24
--- Dockerfile
+++ Dockerfile
@@ -1,40 +1,107 @@
1
-# STAGE 1: Build a static Fossil binary atop Alpine Linux
2
-
3
-# Avoid the temptation to swap the wget call below out for an ADD URL
4
-# directive. The URL is fixed for a given release tag, which triggers
5
-# Docker's caching behavior, causing it to reuse that version as long
6
-# as it remains in the cache. We prefer to rely on the caching of the
7
-# server instance on fossil-scm.org, which will keep these trunk
8
-# tarballs around until the next trunk commit.
1
+# See www/containers.md for documentation on how to use this file.
2
+
3
+## ---------------------------------------------------------------------
4
+## STAGE 1: Build static Fossil & BusyBox binaries atop Alpine Linux
5
+## ---------------------------------------------------------------------
96
107
FROM alpine:latest AS builder
118
WORKDIR /tmp
12
-RUN apk update \
13
- && apk upgrade --no-cache \
14
- && apk add --no-cache \
15
- busybox-static gcc make \
16
- musl-dev \
9
+
10
+### Bake the basic Alpine Linux into a base layer so we never have to
11
+### repeat that step unless we change the package set. Although we're
12
+### going to throw this layer away below, we still pass --no-cache
13
+### because that cache is of no use in an immutable layer. Note that
14
+### we allow the UPX step to fail: it isn't in the ARM distros. We'll
15
+### check whether this optional piece exists before using it below.
16
+RUN set -x \
17
+ && apk update \
18
+ && apk upgrade --no-cache \
19
+ && apk add --no-cache \
20
+ gcc make moreutils \
21
+ linux-headers musl-dev \
1722
openssl-dev openssl-libs-static \
1823
zlib-dev zlib-static \
19
- && wget -O - https://fossil-scm.org/home/tarball/src | tar -xz \
20
- && src/configure --static CFLAGS='-Os -s' \
21
- && make -j
24
+ ; apk add --no-cache upx
25
+
26
+### Bake the custom BusyBox into another layer. The intent is that this
27
+### changes only when we change BBXVER. That will force an update of
28
+### the layers below, but this is a rare occurrence.
29
+ARG BBXVER="1_35_0"
30
+ENV BBXURL "https://github.com/mirror/busybox/tarball/${BBXVER}"
31
+COPY containers/busybox-config /tmp/bbx/.config
32
+ADD $BBXURL /tmp/bbx/src.tar.gz
33
+RUN set -x \
34
+ && tar --strip-components=1 -C bbx -xzf bbx/src.tar.gz \
35
+ && ( cd bbx && yes "" | make oldconfig && make -j11 ) \
36
+ && if [ -x /usr/bin/upx ] ; then upx -9q bbx/busybox ; fi
37
+
38
+### The changeable Fossil layer is the only one in the first stage that
39
+### changes often, so add it last, to make it independent of the others.
40
+###
41
+### $FSLSTB can be either a file or a directory due to a ADD's bizarre
42
+### behavior: it unpacks tarballs when added from a local file but not
43
+### from a URL! It matters because we default to a URL in case you're
44
+### building outside a Fossil checkout, but when building via the
45
+### container-image target, we can avoid a costly hit on the Fossil
46
+### project's home site by pulling the data from the local repo via the
47
+### "tarball" command. This is a DVCS, after all!
48
+ARG FSLVER="trunk"
49
+ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}"
50
+ENV FSLSTB=/tmp/fsl/src.tar.gz
51
+ADD $FSLURL $FSLSTB
52
+RUN set -x \
53
+ && if [ -d $FSLSTB ] ; then mv $FSLSTB/src fsl ; \
54
+ else tar -C fsl -xzf fsl/src.tar.gz ; fi \
55
+ && m=fsl/src/src/main.mk \
56
+ && grep -v '/skins/[a-ce-z]' $m | sponge $m \
57
+ && fsl/src/configure --static CFLAGS='-Os -s' && make -j11 \
58
+ && if [ -x /usr/bin/upx ] ; then upx -9q fossil ; fi
59
+
2260
23
-# STAGE 2: Pare that back to the bare essentials.
61
+## ---------------------------------------------------------------------
62
+## STAGE 2: Pare that back to the bare essentials.
63
+## ---------------------------------------------------------------------
2464
2565
FROM scratch
2666
WORKDIR /jail
27
-COPY --from=builder /tmp/fossil /jail/bin/
28
-COPY --from=builder /bin/busybox.static /bin/busybox
67
+ARG UID=499
68
+ENV PATH "/bin:/jail/bin"
69
+
70
+### Lay BusyBox down as the first base layer. Coupled with the host's
71
+### kernel, this is the "OS."
72
+COPY --from=builder /tmp/bbx/busybox /bin/
2973
RUN [ "/bin/busybox", "--install", "/bin" ]
30
-RUN mkdir -m 700 dev museum \
31
- && mknod -m 600 dev/null c 1 3 \
32
- && mknod -m 600 dev/urandom c 1 9
74
+
75
+### Set up that base OS for our specific use without tying it to
76
+### anything likely to change often. So long as the user leaves
77
+### UID alone, this layer will be durable.
78
+RUN set -x \
79
+ && echo 'root:x:0:0:SysAdmin:/:/bin/nologin' > /etc/passwd \
80
+ && echo 'root:x:0:root' > /etc/group \
81
+ && addgroup -S -g ${UID} fossil \
82
+ && adduser -S -h `pwd` -g 'Fossil User' -G fossil -u ${UID} fossil \
83
+ && install -d -m 700 -o fossil -g fossil log museum \
84
+ && install -d -m 755 -o fossil -g fossil dev \
85
+ && mknod -m 666 dev/null c 1 3 \
86
+ && mknod -m 444 dev/urandom c 1 9
87
+
88
+### Do Fossil-specific things atop those base layers; this will change
89
+### as often as the Fossil build-from-source layer above.
90
+COPY --from=builder /tmp/fossil bin/
91
+RUN set -x \
92
+ && ln -s /jail/bin/fossil /bin/f \
93
+ && echo -e '#!/bin/sh\nfossil sha1sum "$@"' > /bin/sha1sum \
94
+ && echo -e '#!/bin/sh\nfossil sha3sum "$@"' > /bin/sha3sum \
95
+ && echo -e '#!/bin/sh\nfossil sqlite3 --no-repository "$@"' > \
96
+ /bin/sqlite3 \
97
+ && chmod +x /bin/sha?sum /bin/sqlite3
98
+
3399
34
-# Now we can run the stripped-down environment in a chroot jail, while
35
-# leaving open the option to debug it live via the Busybox shell.
100
+## ---------------------------------------------------------------------
101
+## STAGE 3: Run!
102
+## ---------------------------------------------------------------------
36103
37104
EXPOSE 8080/tcp
38105
CMD [ \
39106
"bin/fossil", "server", \
40107
"--chroot", "/jail", \
41108
--- Dockerfile
+++ Dockerfile
@@ -1,40 +1,107 @@
1 # STAGE 1: Build a static Fossil binary atop Alpine Linux
2
3 # Avoid the temptation to swap the wget call below out for an ADD URL
4 # directive. The URL is fixed for a given release tag, which triggers
5 # Docker's caching behavior, causing it to reuse that version as long
6 # as it remains in the cache. We prefer to rely on the caching of the
7 # server instance on fossil-scm.org, which will keep these trunk
8 # tarballs around until the next trunk commit.
9
10 FROM alpine:latest AS builder
11 WORKDIR /tmp
12 RUN apk update \
13 && apk upgrade --no-cache \
14 && apk add --no-cache \
15 busybox-static gcc make \
16 musl-dev \
 
 
 
 
 
 
 
 
17 openssl-dev openssl-libs-static \
18 zlib-dev zlib-static \
19 && wget -O - https://fossil-scm.org/home/tarball/src | tar -xz \
20 && src/configure --static CFLAGS='-Os -s' \
21 && make -j
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
23 # STAGE 2: Pare that back to the bare essentials.
 
 
24
25 FROM scratch
26 WORKDIR /jail
27 COPY --from=builder /tmp/fossil /jail/bin/
28 COPY --from=builder /bin/busybox.static /bin/busybox
 
 
 
 
29 RUN [ "/bin/busybox", "--install", "/bin" ]
30 RUN mkdir -m 700 dev museum \
31 && mknod -m 600 dev/null c 1 3 \
32 && mknod -m 600 dev/urandom c 1 9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
34 # Now we can run the stripped-down environment in a chroot jail, while
35 # leaving open the option to debug it live via the Busybox shell.
 
36
37 EXPOSE 8080/tcp
38 CMD [ \
39 "bin/fossil", "server", \
40 "--chroot", "/jail", \
41
--- Dockerfile
+++ Dockerfile
@@ -1,40 +1,107 @@
1 # See www/containers.md for documentation on how to use this file.
2
3 ## ---------------------------------------------------------------------
4 ## STAGE 1: Build static Fossil & BusyBox binaries atop Alpine Linux
5 ## ---------------------------------------------------------------------
 
 
 
6
7 FROM alpine:latest AS builder
8 WORKDIR /tmp
9
10 ### Bake the basic Alpine Linux into a base layer so we never have to
11 ### repeat that step unless we change the package set. Although we're
12 ### going to throw this layer away below, we still pass --no-cache
13 ### because that cache is of no use in an immutable layer. Note that
14 ### we allow the UPX step to fail: it isn't in the ARM distros. We'll
15 ### check whether this optional piece exists before using it below.
16 RUN set -x \
17 && apk update \
18 && apk upgrade --no-cache \
19 && apk add --no-cache \
20 gcc make moreutils \
21 linux-headers musl-dev \
22 openssl-dev openssl-libs-static \
23 zlib-dev zlib-static \
24 ; apk add --no-cache upx
25
26 ### Bake the custom BusyBox into another layer. The intent is that this
27 ### changes only when we change BBXVER. That will force an update of
28 ### the layers below, but this is a rare occurrence.
29 ARG BBXVER="1_35_0"
30 ENV BBXURL "https://github.com/mirror/busybox/tarball/${BBXVER}"
31 COPY containers/busybox-config /tmp/bbx/.config
32 ADD $BBXURL /tmp/bbx/src.tar.gz
33 RUN set -x \
34 && tar --strip-components=1 -C bbx -xzf bbx/src.tar.gz \
35 && ( cd bbx && yes "" | make oldconfig && make -j11 ) \
36 && if [ -x /usr/bin/upx ] ; then upx -9q bbx/busybox ; fi
37
38 ### The changeable Fossil layer is the only one in the first stage that
39 ### changes often, so add it last, to make it independent of the others.
40 ###
41 ### $FSLSTB can be either a file or a directory due to a ADD's bizarre
42 ### behavior: it unpacks tarballs when added from a local file but not
43 ### from a URL! It matters because we default to a URL in case you're
44 ### building outside a Fossil checkout, but when building via the
45 ### container-image target, we can avoid a costly hit on the Fossil
46 ### project's home site by pulling the data from the local repo via the
47 ### "tarball" command. This is a DVCS, after all!
48 ARG FSLVER="trunk"
49 ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}"
50 ENV FSLSTB=/tmp/fsl/src.tar.gz
51 ADD $FSLURL $FSLSTB
52 RUN set -x \
53 && if [ -d $FSLSTB ] ; then mv $FSLSTB/src fsl ; \
54 else tar -C fsl -xzf fsl/src.tar.gz ; fi \
55 && m=fsl/src/src/main.mk \
56 && grep -v '/skins/[a-ce-z]' $m | sponge $m \
57 && fsl/src/configure --static CFLAGS='-Os -s' && make -j11 \
58 && if [ -x /usr/bin/upx ] ; then upx -9q fossil ; fi
59
60
61 ## ---------------------------------------------------------------------
62 ## STAGE 2: Pare that back to the bare essentials.
63 ## ---------------------------------------------------------------------
64
65 FROM scratch
66 WORKDIR /jail
67 ARG UID=499
68 ENV PATH "/bin:/jail/bin"
69
70 ### Lay BusyBox down as the first base layer. Coupled with the host's
71 ### kernel, this is the "OS."
72 COPY --from=builder /tmp/bbx/busybox /bin/
73 RUN [ "/bin/busybox", "--install", "/bin" ]
74
75 ### Set up that base OS for our specific use without tying it to
76 ### anything likely to change often. So long as the user leaves
77 ### UID alone, this layer will be durable.
78 RUN set -x \
79 && echo 'root:x:0:0:SysAdmin:/:/bin/nologin' > /etc/passwd \
80 && echo 'root:x:0:root' > /etc/group \
81 && addgroup -S -g ${UID} fossil \
82 && adduser -S -h `pwd` -g 'Fossil User' -G fossil -u ${UID} fossil \
83 && install -d -m 700 -o fossil -g fossil log museum \
84 && install -d -m 755 -o fossil -g fossil dev \
85 && mknod -m 666 dev/null c 1 3 \
86 && mknod -m 444 dev/urandom c 1 9
87
88 ### Do Fossil-specific things atop those base layers; this will change
89 ### as often as the Fossil build-from-source layer above.
90 COPY --from=builder /tmp/fossil bin/
91 RUN set -x \
92 && ln -s /jail/bin/fossil /bin/f \
93 && echo -e '#!/bin/sh\nfossil sha1sum "$@"' > /bin/sha1sum \
94 && echo -e '#!/bin/sh\nfossil sha3sum "$@"' > /bin/sha3sum \
95 && echo -e '#!/bin/sh\nfossil sqlite3 --no-repository "$@"' > \
96 /bin/sqlite3 \
97 && chmod +x /bin/sha?sum /bin/sqlite3
98
99
100 ## ---------------------------------------------------------------------
101 ## STAGE 3: Run!
102 ## ---------------------------------------------------------------------
103
104 EXPOSE 8080/tcp
105 CMD [ \
106 "bin/fossil", "server", \
107 "--chroot", "/jail", \
108
+26
--- Makefile.in
+++ Makefile.in
@@ -116,5 +116,31 @@
116116
# of delegating to it with "$(MAKE) reconfig": having children running
117117
# around interfering makes this failure mode even worse.
118118
Makefile: @srcdir@/Makefile.in $(SRCDIR)/main.mk @AUTODEPS@
119119
@AUTOREMAKE@
120120
touch @builddir@/Makefile
121
+
122
+# Container stuff
123
+SRCTB := src-@[email protected]
124
+container-image:
125
+ $(APPNAME) tarball --name src @FOSSIL_CI_PFX@ $(SRCTB)
126
+ docker build \
127
+ --tag fossil:@FOSSIL_CI_PFX@ \
128
+ --build-arg FSLURL=$(SRCTB) \
129
+ $(DBFLAGS) @srcdir@
130
+ rm -f $(SRCTB)
131
+
132
+container-run: container-image
133
+ docker run \
134
+ --name fossil-@FOSSIL_CI_PFX@ \
135
+ --cap-drop AUDIT_WRITE \
136
+ --cap-drop CHOWN \
137
+ --cap-drop FSETID \
138
+ --cap-drop KILL \
139
+ --cap-drop MKNOD \
140
+ --cap-drop NET_BIND_SERVICE \
141
+ --cap-drop NET_RAW \
142
+ --cap-drop SETFCAP \
143
+ --cap-drop SETPCAP \
144
+ --detach --publish 8080:8080 \
145
+ $(DRFLAGS) fossil:@FOSSIL_CI_PFX@
146
+ docker container logs fossil-@FOSSIL_CI_PFX@
121147
--- Makefile.in
+++ Makefile.in
@@ -116,5 +116,31 @@
116 # of delegating to it with "$(MAKE) reconfig": having children running
117 # around interfering makes this failure mode even worse.
118 Makefile: @srcdir@/Makefile.in $(SRCDIR)/main.mk @AUTODEPS@
119 @AUTOREMAKE@
120 touch @builddir@/Makefile
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
--- Makefile.in
+++ Makefile.in
@@ -116,5 +116,31 @@
116 # of delegating to it with "$(MAKE) reconfig": having children running
117 # around interfering makes this failure mode even worse.
118 Makefile: @srcdir@/Makefile.in $(SRCDIR)/main.mk @AUTODEPS@
119 @AUTOREMAKE@
120 touch @builddir@/Makefile
121
122 # Container stuff
123 SRCTB := src-@[email protected]
124 container-image:
125 $(APPNAME) tarball --name src @FOSSIL_CI_PFX@ $(SRCTB)
126 docker build \
127 --tag fossil:@FOSSIL_CI_PFX@ \
128 --build-arg FSLURL=$(SRCTB) \
129 $(DBFLAGS) @srcdir@
130 rm -f $(SRCTB)
131
132 container-run: container-image
133 docker run \
134 --name fossil-@FOSSIL_CI_PFX@ \
135 --cap-drop AUDIT_WRITE \
136 --cap-drop CHOWN \
137 --cap-drop FSETID \
138 --cap-drop KILL \
139 --cap-drop MKNOD \
140 --cap-drop NET_BIND_SERVICE \
141 --cap-drop NET_RAW \
142 --cap-drop SETFCAP \
143 --cap-drop SETPCAP \
144 --detach --publish 8080:8080 \
145 $(DRFLAGS) fossil:@FOSSIL_CI_PFX@
146 docker container logs fossil-@FOSSIL_CI_PFX@
147
+9
--- auto.def
+++ auto.def
@@ -764,8 +764,17 @@
764764
catch {exec chmod u+x tools/emcc.sh}
765765
} else {
766766
define EMCC_WRAPPER ""
767767
catch {exec rm -f tools/emcc.sh}
768768
}
769
+
770
+# Tag container builds with a prefix of the checkin ID of the version
771
+# of Fossil each one contains. This not only allows multiple images
772
+# to coexist and multiple containers to be created unamgiguosly from
773
+# them, it also changes the URL we fetch the source tarball from, so
774
+# repeated builds of a given version generate and fetch the source
775
+# tarball once only, keeping it in the local Docker/Podman cache.
776
+set ci [readfile "$::autosetup(srcdir)/manifest.uuid"]
777
+define FOSSIL_CI_PFX [string range $ci 0 11]
769778
770779
make-template Makefile.in
771780
make-config-header autoconfig.h -auto {USE_* FOSSIL_*}
772781
773782
ADDED containers/Dockerfile-nojail.patch
774783
ADDED containers/busybox-config
--- auto.def
+++ auto.def
@@ -764,8 +764,17 @@
764 catch {exec chmod u+x tools/emcc.sh}
765 } else {
766 define EMCC_WRAPPER ""
767 catch {exec rm -f tools/emcc.sh}
768 }
 
 
 
 
 
 
 
 
 
769
770 make-template Makefile.in
771 make-config-header autoconfig.h -auto {USE_* FOSSIL_*}
772
773 DDED containers/Dockerfile-nojail.patch
774 DDED containers/busybox-config
--- auto.def
+++ auto.def
@@ -764,8 +764,17 @@
764 catch {exec chmod u+x tools/emcc.sh}
765 } else {
766 define EMCC_WRAPPER ""
767 catch {exec rm -f tools/emcc.sh}
768 }
769
770 # Tag container builds with a prefix of the checkin ID of the version
771 # of Fossil each one contains. This not only allows multiple images
772 # to coexist and multiple containers to be created unamgiguosly from
773 # them, it also changes the URL we fetch the source tarball from, so
774 # repeated builds of a given version generate and fetch the source
775 # tarball once only, keeping it in the local Docker/Podman cache.
776 set ci [readfile "$::autosetup(srcdir)/manifest.uuid"]
777 define FOSSIL_CI_PFX [string range $ci 0 11]
778
779 make-template Makefile.in
780 make-config-header autoconfig.h -auto {USE_* FOSSIL_*}
781
782 DDED containers/Dockerfile-nojail.patch
783 DDED containers/busybox-config
--- a/containers/Dockerfile-nojail.patch
+++ b/containers/Dockerfile-nojail.patch
@@ -0,0 +1,11 @@
1
+Index: Doc62,13 +62: DocIndebbx/busybox /bin/
2
+ etc/os-release /etc/
3
+@@ -84,19 +84,17 @@
4
+ 61,13 +61fossil", "server",101,13 +101,13 @@
5
+ 18,10 +118,9 @@
6
+ ## x:0:0:SysAdmin:/:/bin/nologin' > /etc/passwd9@GO,U:\
7
+ && echo 'root:x:0:root'M@N0,C:> /etc/groupA@Hc,b:\
8
+ && addgroup -S -g ${UID} fossilj@N0,1v:adduser -S -h `pwd` -g 'Fossil User' -G fossil -u ${UID} fossil \
9
+- && install -d -m 700 -o fossil -g fossil log museumG@NG,o:\
10
+- && install -d -m 755 -o fossil -g fossil devN@N0,3:\
11
+-19@AQ,1:-b@B_,t:+ && install -d -m 700 -o fossil -g fossil log museum26@C9,1: a@EG,1f@FW,_@HE,L@Hj,B:bin/fossil a@HD,f@LC,R:ha1sum "$@"' > /bin/sha1sum9@GO,b@LG,F:ha3sum "$@"' > H@K~,1P@LC,w@Me,O@NW,f:bin/sha?sum
--- a/containers/Dockerfile-nojail.patch
+++ b/containers/Dockerfile-nojail.patch
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
--- a/containers/Dockerfile-nojail.patch
+++ b/containers/Dockerfile-nojail.patch
@@ -0,0 +1,11 @@
1 Index: Doc62,13 +62: DocIndebbx/busybox /bin/
2 etc/os-release /etc/
3 @@ -84,19 +84,17 @@
4 61,13 +61fossil", "server",101,13 +101,13 @@
5 18,10 +118,9 @@
6 ## x:0:0:SysAdmin:/:/bin/nologin' > /etc/passwd9@GO,U:\
7 && echo 'root:x:0:root'M@N0,C:> /etc/groupA@Hc,b:\
8 && addgroup -S -g ${UID} fossilj@N0,1v:adduser -S -h `pwd` -g 'Fossil User' -G fossil -u ${UID} fossil \
9 - && install -d -m 700 -o fossil -g fossil log museumG@NG,o:\
10 - && install -d -m 755 -o fossil -g fossil devN@N0,3:\
11 -19@AQ,1:-b@B_,t:+ && install -d -m 700 -o fossil -g fossil log museum26@C9,1: a@EG,1f@FW,_@HE,L@Hj,B:bin/fossil a@HD,f@LC,R:ha1sum "$@"' > /bin/sha1sum9@GO,b@LG,F:ha3sum "$@"' > H@K~,1P@LC,w@Me,O@NW,f:bin/sha?sum
--- a/containers/busybox-config
+++ b/containers/busybox-config
@@ -0,0 +1,1200 @@
1
+#
2
+# Automatically generated make config: don't edit
3
+# Busybox version: 1.35.0
4
+# Tue Aug 16 02:15:21 2022
5
+#
6
+CONFIG_HAVE_DOT_CONFIG=y
7
+
8
+#
9
+# Settings
10
+#
11
+CONFIG_DESKTOP=y
12
+# CONFIG_EXTRA_COMPAT is not set
13
+# CONFIG_FEDORA_COMPAT is not set
14
+CONFIG_INCLUDE_SUSv2=y
15
+CONFIG_LONG_OPTS=y
16
+CONFIG_SHOW_USAGE=y
17
+CONFIG_FEATURE_VERBOSE_USAGE=y
18
+CONFIG_FEATURE_COMPRESS_USAGE=y
19
+CONFIG_LFS=y
20
+# CONFIG_PAM is not set
21
+CONFIG_FEATURE_DEVPTS=y
22
+CONFIG_FEATURE_UTMP=y
23
+CONFIG_FEATURE_WTMP=y
24
+CONFIG_FEATURE_PIDFILE=y
25
+CONFIG_PID_FILE_PATH="/var/run"
26
+CONFIG_BUSYBOX=y
27
+CONFIG_FEATURE_SHOW_SCRIPT=y
28
+CONFIG_FEATURE_INSTALLER=y
29
+# CONFIG_INSTALL_NO_USR is not set
30
+CONFIG_FEATURE_SUID=y
31
+CONFIG_FEATURE_SUID_CONFIG=y
32
+CONFIG_FEATURE_SUID_CONFIG_QUIET=y
33
+# CONFIG_FEATURE_PREFER_APPLETS is not set
34
+CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
35
+# CONFIG_SELINUX is not set
36
+# CONFIG_FEATURE_CLEAN_UP is not set
37
+CONFIG_FEATURE_SYSLOG_INFO=y
38
+CONFIG_FEATURE_SYSLOG=y
39
+
40
+#
41
+# Build Options
42
+#
43
+CONFIG_STATIC=y
44
+# CONFIG_PIE is not set
45
+# CONFIG_NOMMU is not set
46
+# CONFIG_BUILD_LIBBUSYBOX is not set
47
+# CONFIG_FEATURE_LIBBUSYBOX_STATIC is not set
48
+# CONFIG_FEATURE_INDIVIDUAL is not set
49
+# CONFIG_FEATURE_SHARED_BUSYBOX is not set
50
+CONFIG_CROSS_COMPILER_PREFIX=""
51
+CONFIG_SYSROOT=""
52
+CONFIG_EXTRA_CFLAGS=""
53
+CONFIG_EXTRA_LDFLAGS=""
54
+CONFIG_EXTRA_LDLIBS=""
55
+# CONFIG_USE_PORTABLE_CODE is not set
56
+CONFIG_STACK_OPTIMIZATION_386=y
57
+CONFIG_STATIC_LIBGCC=y
58
+
59
+#
60
+# Installation Options ("make install" behavior)
61
+#
62
+CONFIG_INSTALL_APPLET_SYMLINKS=y
63
+# CONFIG_INSTALL_APPLET_HARDLINKS is not set
64
+# CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set
65
+# CONFIG_INSTALL_APPLET_DONT is not set
66
+# CONFIG_INSTALL_SH_APPLET_SYMLINK is not set
67
+# CONFIG_INSTALL_SH_APPLET_HARDLINK is not set
68
+# CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set
69
+CONFIG_PREFIX="./_install"
70
+
71
+#
72
+# Debugging Options
73
+#
74
+# CONFIG_DEBUG is not set
75
+# CONFIG_DEBUG_PESSIMIZE is not set
76
+# CONFIG_DEBUG_SANITIZE is not set
77
+# CONFIG_UNIT_TEST is not set
78
+# CONFIG_WERROR is not set
79
+# CONFIG_WARN_SIMPLE_MSG is not set
80
+CONFIG_NO_DEBUG_LIB=y
81
+# CONFIG_DMALLOC is not set
82
+# CONFIG_EFENCE is not set
83
+
84
+#
85
+# Library Tuning
86
+#
87
+# CONFIG_FEATURE_USE_BSS_TAIL is not set
88
+CONFIG_FLOAT_DURATION=y
89
+CONFIG_FEATURE_RTMINMAX=y
90
+CONFIG_FEATURE_RTMINMAX_USE_LIBC_DEFINITIONS=y
91
+CONFIG_FEATURE_BUFFERS_USE_MALLOC=y
92
+# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set
93
+# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
94
+CONFIG_PASSWORD_MINLEN=6
95
+CONFIG_MD5_SMALL=1
96
+CONFIG_SHA3_SMALL=1
97
+CONFIG_FEATURE_NON_POSIX_CP=y
98
+# CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set
99
+CONFIG_FEATURE_USE_SENDFILE=y
100
+CONFIG_FEATURE_COPYBUF_KB=4
101
+CONFIG_MONOTONIC_SYSCALL=y
102
+CONFIG_IOCTL_HEX2STR_ERROR=y
103
+CONFIG_FEATURE_EDITING=y
104
+CONFIG_FEATURE_EDITING_MAX_LEN=1024
105
+# CONFIG_FEATURE_EDITING_VI is not set
106
+CONFIG_FEATURE_EDITING_HISTORY=255
107
+CONFIG_FEATURE_EDITING_SAVEHISTORY=y
108
+# CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is not set
109
+CONFIG_FEATURE_REVERSE_SEARCH=y
110
+CONFIG_FEATURE_TAB_COMPLETION=y
111
+CONFIG_FEATURE_USERNAME_COMPLETION=y
112
+CONFIG_FEATURE_EDITING_FANCY_PROMPT=y
113
+CONFIG_FEATURE_EDITING_WINCH=y
114
+# CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set
115
+# CONFIG_LOCALE_SUPPORT is not set
116
+CONFIG_UNICODE_SUPPORT=y
117
+# CONFIG_UNICODE_USING_LOCALE is not set
118
+# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set
119
+CONFIG_SUBST_WCHAR=63
120
+CONFIG_LAST_SUPPORTED_WCHAR=767
121
+# CONFIG_UNICODE_COMBINING_WCHARS is not set
122
+# CONFIG_UNICODE_WIDE_WCHARS is not set
123
+# CONFIG_UNICODE_BIDI_SUPPORT is not set
124
+# CONFIG_UNICODE_NEUTRAL_TABLE is not set
125
+# CONFIG_UNICODE_PRESERVE_BROKEN is not set
126
+
127
+#
128
+# Applets
129
+#
130
+
131
+#
132
+# Archival Utilities
133
+#
134
+# CONFIG_FEATURE_SEAMLESS_XZ is not set
135
+# CONFIG_FEATURE_SEAMLESS_LZMA is not set
136
+# CONFIG_FEATURE_SEAMLESS_BZ2 is not set
137
+CONFIG_FEATURE_SEAMLESS_GZ=y
138
+# CONFIG_FEATURE_SEAMLESS_Z is not set
139
+# CONFIG_AR is not set
140
+# CONFIG_FEATURE_AR_LONG_FILENAMES is not set
141
+# CONFIG_FEATURE_AR_CREATE is not set
142
+# CONFIG_UNCOMPRESS is not set
143
+CONFIG_GUNZIP=y
144
+CONFIG_ZCAT=y
145
+CONFIG_FEATURE_GUNZIP_LONG_OPTIONS=y
146
+# CONFIG_BUNZIP2 is not set
147
+# CONFIG_BZCAT is not set
148
+# CONFIG_UNLZMA is not set
149
+# CONFIG_LZCAT is not set
150
+# CONFIG_LZMA is not set
151
+# CONFIG_UNXZ is not set
152
+# CONFIG_XZCAT is not set
153
+# CONFIG_XZ is not set
154
+# CONFIG_BZIP2 is not set
155
+CONFIG_BZIP2_SMALL=0
156
+# CONFIG_FEATURE_BZIP2_DECOMPRESS is not set
157
+# CONFIG_CPIO is not set
158
+# CONFIG_FEATURE_CPIO_O is not set
159
+# CONFIG_FEATURE_CPIO_P is not set
160
+# CONFIG_FEATURE_CPIO_IGNORE_DEVNO is not set
161
+# CONFIG_FEATURE_CPIO_RENUMBER_INODES is not set
162
+# CONFIG_DPKG is not set
163
+# CONFIG_DPKG_DEB is not set
164
+CONFIG_GZIP=y
165
+CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
166
+CONFIG_GZIP_FAST=0
167
+# CONFIG_FEATURE_GZIP_LEVELS is not set
168
+CONFIG_FEATURE_GZIP_DECOMPRESS=y
169
+# CONFIG_LZOP is not set
170
+# CONFIG_UNLZOP is not set
171
+# CONFIG_LZOPCAT is not set
172
+# CONFIG_LZOP_COMPR_HIGH is not set
173
+# CONFIG_RPM is not set
174
+# CONFIG_RPM2CPIO is not set
175
+CONFIG_TAR=y
176
+CONFIG_FEATURE_TAR_LONG_OPTIONS=y
177
+CONFIG_FEATURE_TAR_CREATE=y
178
+CONFIG_FEATURE_TAR_AUTODETECT=y
179
+CONFIG_FEATURE_TAR_FROM=y
180
+# CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY is not set
181
+# CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set
182
+CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
183
+# CONFIG_FEATURE_TAR_TO_COMMAND is not set
184
+CONFIG_FEATURE_TAR_UNAME_GNAME=y
185
+CONFIG_FEATURE_TAR_NOPRESERVE_TIME=y
186
+# CONFIG_FEATURE_TAR_SELINUX is not set
187
+CONFIG_UNZIP=y
188
+CONFIG_FEATURE_UNZIP_CDF=y
189
+CONFIG_FEATURE_UNZIP_BZIP2=y
190
+CONFIG_FEATURE_UNZIP_LZMA=y
191
+CONFIG_FEATURE_UNZIP_XZ=y
192
+# CONFIG_FEATURE_LZMA_FAST is not set
193
+
194
+#
195
+# Coreutils
196
+#
197
+CONFIG_FEATURE_VERBOSE=y
198
+
199
+#
200
+# Common options for date and touch
201
+#
202
+CONFIG_FEATURE_TIMEZONE=y
203
+
204
+#
205
+# Common options for cp and mv
206
+#
207
+CONFIG_FEATURE_PRESERVE_HARDLINKS=y
208
+
209
+#
210
+# Common options for df, du, ls
211
+#
212
+CONFIG_FEATURE_HUMAN_READABLE=y
213
+CONFIG_BASENAME=y
214
+CONFIG_CAT=y
215
+CONFIG_FEATURE_CATN=y
216
+CONFIG_FEATURE_CATV=y
217
+CONFIG_CHGRP=y
218
+CONFIG_CHMOD=y
219
+CONFIG_CHOWN=y
220
+CONFIG_FEATURE_CHOWN_LONG_OPTIONS=y
221
+CONFIG_CHROOT=y
222
+# CONFIG_CKSUM is not set
223
+# CONFIG_CRC32 is not set
224
+CONFIG_COMM=y
225
+CONFIG_CP=y
226
+CONFIG_FEATURE_CP_LONG_OPTIONS=y
227
+CONFIG_FEATURE_CP_REFLINK=y
228
+CONFIG_CUT=y
229
+CONFIG_FEATURE_CUT_REGEX=y
230
+CONFIG_DATE=y
231
+CONFIG_FEATURE_DATE_ISOFMT=y
232
+# CONFIG_FEATURE_DATE_NANO is not set
233
+CONFIG_FEATURE_DATE_COMPAT=y
234
+CONFIG_DD=y
235
+CONFIG_FEATURE_DD_SIGNAL_HANDLING=y
236
+CONFIG_FEATURE_DD_THIRD_STATUS_LINE=y
237
+CONFIG_FEATURE_DD_IBS_OBS=y
238
+CONFIG_FEATURE_DD_STATUS=y
239
+CONFIG_DF=y
240
+CONFIG_FEATURE_DF_FANCY=y
241
+CONFIG_FEATURE_SKIP_ROOTFS=y
242
+CONFIG_DIRNAME=y
243
+CONFIG_DOS2UNIX=y
244
+CONFIG_UNIX2DOS=y
245
+CONFIG_DU=y
246
+CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y
247
+# CONFIG_ECHO is not set
248
+CONFIG_FEATURE_FANCY_ECHO=y
249
+CONFIG_ENV=y
250
+CONFIG_EXPAND=y
251
+CONFIG_UNEXPAND=y
252
+CONFIG_EXPR=y
253
+CONFIG_EXPR_MATH_SUPPORT_64=y
254
+# CONFIG_FACTOR is not set
255
+CONFIG_FALSE=y
256
+CONFIG_FOLD=y
257
+CONFIG_HEAD=y
258
+CONFIG_FEATURE_FANCY_HEAD=y
259
+CONFIG_HOSTID=y
260
+CONFIG_ID=y
261
+CONFIG_GROUPS=y
262
+CONFIG_INSTALL=y
263
+CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y
264
+CONFIG_LINK=y
265
+CONFIG_LN=y
266
+# CONFIG_LOGNAME is not set
267
+CONFIG_LS=y
268
+CONFIG_FEATURE_LS_FILETYPES=y
269
+CONFIG_FEATURE_LS_FOLLOWLINKS=y
270
+CONFIG_FEATURE_LS_RECURSIVE=y
271
+CONFIG_FEATURE_LS_WIDTH=y
272
+CONFIG_FEATURE_LS_SORTFILES=y
273
+CONFIG_FEATURE_LS_TIMESTAMPS=y
274
+CONFIG_FEATURE_LS_USERNAME=y
275
+CONFIG_FEATURE_LS_COLOR=y
276
+CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y
277
+# CONFIG_MD5SUM is not set
278
+# CONFIG_SHA1SUM is not set
279
+# CONFIG_SHA256SUM is not set
280
+# CONFIG_SHA512SUM is not set
281
+# CONFIG_SHA3SUM is not set
282
+# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set
283
+CONFIG_MKDIR=y
284
+CONFIG_MKFIFO=y
285
+CONFIG_MKNOD=y
286
+CONFIG_MKTEMP=y
287
+CONFIG_MV=y
288
+CONFIG_NICE=y
289
+CONFIG_NL=y
290
+CONFIG_NOHUP=y
291
+CONFIG_NPROC=y
292
+CONFIG_OD=y
293
+CONFIG_PASTE=y
294
+# CONFIG_PRINTENV is not set
295
+# CONFIG_PRINTF is not set
296
+CONFIG_PWD=y
297
+CONFIG_READLINK=y
298
+CONFIG_FEATURE_READLINK_FOLLOW=y
299
+CONFIG_REALPATH=y
300
+CONFIG_RM=y
301
+CONFIG_RMDIR=y
302
+CONFIG_SEQ=y
303
+CONFIG_SHRED=y
304
+CONFIG_SHUF=y
305
+CONFIG_SLEEP=y
306
+CONFIG_FEATURE_FANCY_SLEEP=y
307
+CONFIG_SORT=y
308
+# CONFIG_FEATURE_SORT_BIG is not set
309
+# CONFIG_FEATURE_SORT_OPTIMIZE_MEMORY is not set
310
+CONFIG_SPLIT=y
311
+CONFIG_FEATURE_SPLIT_FANCY=y
312
+CONFIG_STAT=y
313
+CONFIG_FEATURE_STAT_FORMAT=y
314
+CONFIG_FEATURE_STAT_FILESYSTEM=y
315
+CONFIG_STTY=y
316
+# CONFIG_SUM is not set
317
+CONFIG_SYNC=y
318
+CONFIG_FEATURE_SYNC_FANCY=y
319
+CONFIG_FSYNC=y
320
+CONFIG_TAC=y
321
+CONFIG_TAIL=y
322
+CONFIG_FEATURE_FANCY_TAIL=y
323
+CONFIG_TEE=y
324
+CONFIG_FEATURE_TEE_USE_BLOCK_IO=y
325
+# CONFIG_TEST is not set
326
+# CONFIG_TEST1 is not set
327
+# CONFIG_TEST2 is not set
328
+# CONFIG_FEATURE_TEST_64 is not set
329
+CONFIG_TIMEOUT=y
330
+CONFIG_TOUCH=y
331
+CONFIG_FEATURE_TOUCH_SUSV3=y
332
+CONFIG_TR=y
333
+CONFIG_FEATURE_TR_CLASSES=y
334
+CONFIG_FEATURE_TR_EQUIV=y
335
+CONFIG_TRUE=y
336
+CONFIG_TRUNCATE=y
337
+CONFIG_TTY=y
338
+CONFIG_UNAME=y
339
+CONFIG_UNAME_OSNAME="GNU/Linux"
340
+CONFIG_BB_ARCH=y
341
+CONFIG_UNIQ=y
342
+CONFIG_UNLINK=y
343
+CONFIG_USLEEP=y
344
+CONFIG_UUDECODE=y
345
+CONFIG_BASE32=y
346
+CONFIG_BASE64=y
347
+CONFIG_UUENCODE=y
348
+CONFIG_WC=y
349
+CONFIG_FEATURE_WC_LARGE=y
350
+CONFIG_WHO=y
351
+CONFIG_W=y
352
+CONFIG_USERS=y
353
+CONFIG_WHOAMI=y
354
+CONFIG_YES=y
355
+
356
+#
357
+# Console Utilities
358
+#
359
+# CONFIG_CHVT is not set
360
+CONFIG_CLEAR=y
361
+# CONFIG_DEALLOCVT is not set
362
+# CONFIG_DUMPKMAP is not set
363
+# CONFIG_FGCONSOLE is not set
364
+# CONFIG_KBD_MODE is not set
365
+# CONFIG_LOADFONT is not set
366
+# CONFIG_SETFONT is not set
367
+# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set
368
+CONFIG_DEFAULT_SETFONT_DIR=""
369
+# CONFIG_FEATURE_LOADFONT_PSF2 is not set
370
+# CONFIG_FEATURE_LOADFONT_RAW is not set
371
+# CONFIG_LOADKMAP is not set
372
+# CONFIG_OPENVT is not set
373
+# CONFIG_RESET is not set
374
+# CONFIG_RESIZE is not set
375
+# CONFIG_FEATURE_RESIZE_PRINT is not set
376
+# CONFIG_SETCONSOLE is not set
377
+# CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set
378
+# CONFIG_SETKEYCODES is not set
379
+# CONFIG_SETLOGCONS is not set
380
+# CONFIG_SHOWKEY is not set
381
+
382
+#
383
+# Debian Utilities
384
+#
385
+# CONFIG_PIPE_PROGRESS is not set
386
+# CONFIG_RUN_PARTS is not set
387
+# CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS is not set
388
+# CONFIG_FEATURE_RUN_PARTS_FANCY is not set
389
+# CONFIG_START_STOP_DAEMON is not set
390
+# CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set
391
+# CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set
392
+CONFIG_WHICH=y
393
+
394
+#
395
+# klibc-utils
396
+#
397
+# CONFIG_MINIPS is not set
398
+# CONFIG_NUKE is not set
399
+# CONFIG_RESUME is not set
400
+# CONFIG_RUN_INIT is not set
401
+
402
+#
403
+# Editors
404
+#
405
+# CONFIG_AWK is not set
406
+# CONFIG_FEATURE_AWK_LIBM is not set
407
+# CONFIG_FEATURE_AWK_GNU_EXTENSIONS is not set
408
+# CONFIG_CMP is not set
409
+CONFIG_DIFF=y
410
+CONFIG_FEATURE_DIFF_LONG_OPTIONS=y
411
+CONFIG_FEATURE_DIFF_DIR=y
412
+# CONFIG_ED is not set
413
+CONFIG_PATCH=y
414
+CONFIG_SED=y
415
+CONFIG_VI=y
416
+CONFIG_FEATURE_VI_MAX_LEN=4096
417
+# CONFIG_FEATURE_VI_8BIT is not set
418
+CONFIG_FEATURE_VI_COLON=y
419
+CONFIG_FEATURE_VI_COLON_EXPAND=y
420
+CONFIG_FEATURE_VI_YANKMARK=y
421
+CONFIG_FEATURE_VI_SEARCH=y
422
+# CONFIG_FEATURE_VI_REGEX_SEARCH is not set
423
+CONFIG_FEATURE_VI_USE_SIGNALS=y
424
+CONFIG_FEATURE_VI_DOT_CMD=y
425
+CONFIG_FEATURE_VI_READONLY=y
426
+CONFIG_FEATURE_VI_SETOPTS=y
427
+CONFIG_FEATURE_VI_SET=y
428
+CONFIG_FEATURE_VI_WIN_RESIZE=y
429
+CONFIG_FEATURE_VI_ASK_TERMINAL=y
430
+CONFIG_FEATURE_VI_UNDO=y
431
+CONFIG_FEATURE_VI_UNDO_QUEUE=y
432
+CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=256
433
+CONFIG_FEATURE_VI_VERBOSE_STATUS=y
434
+CONFIG_FEATURE_ALLOW_EXEC=y
435
+
436
+#
437
+# Finding Utilities
438
+#
439
+CONFIG_FIND=y
440
+CONFIG_FEATURE_FIND_PRINT0=y
441
+CONFIG_FEATURE_FIND_MTIME=y
442
+CONFIG_FEATURE_FIND_ATIME=y
443
+CONFIG_FEATURE_FIND_CTIME=y
444
+CONFIG_FEATURE_FIND_MMIN=y
445
+CONFIG_FEATURE_FIND_AMIN=y
446
+CONFIG_FEATURE_FIND_CMIN=y
447
+CONFIG_FEATURE_FIND_PERM=y
448
+CONFIG_FEATURE_FIND_TYPE=y
449
+CONFIG_FEATURE_FIND_EXECUTABLE=y
450
+CONFIG_FEATURE_FIND_XDEV=y
451
+CONFIG_FEATURE_FIND_MAXDEPTH=y
452
+CONFIG_FEATURE_FIND_NEWER=y
453
+CONFIG_FEATURE_FIND_INUM=y
454
+CONFIG_FEATURE_FIND_SAMEFILE=y
455
+CONFIG_FEATURE_FIND_EXEC=y
456
+CONFIG_FEATURE_FIND_EXEC_PLUS=y
457
+CONFIG_FEATURE_FIND_USER=y
458
+CONFIG_FEATURE_FIND_GROUP=y
459
+CONFIG_FEATURE_FIND_NOT=y
460
+CONFIG_FEATURE_FIND_DEPTH=y
461
+CONFIG_FEATURE_FIND_PAREN=y
462
+CONFIG_FEATURE_FIND_SIZE=y
463
+CONFIG_FEATURE_FIND_PRUNE=y
464
+CONFIG_FEATURE_FIND_QUIT=y
465
+CONFIG_FEATURE_FIND_DELETE=y
466
+CONFIG_FEATURE_FIND_EMPTY=y
467
+CONFIG_FEATURE_FIND_PATH=y
468
+CONFIG_FEATURE_FIND_REGEX=y
469
+# CONFIG_FEATURE_FIND_CONTEXT is not set
470
+CONFIG_FEATURE_FIND_LINKS=y
471
+CONFIG_GREP=y
472
+# CONFIG_EGREP is not set
473
+# CONFIG_FGREP is not set
474
+CONFIG_FEATURE_GREP_CONTEXT=y
475
+CONFIG_XARGS=y
476
+CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION=y
477
+CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y
478
+CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y
479
+CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
480
+CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR=y
481
+CONFIG_FEATURE_XARGS_SUPPORT_PARALLEL=y
482
+CONFIG_FEATURE_XARGS_SUPPORT_ARGS_FILE=y
483
+
484
+#
485
+# Init Utilities
486
+#
487
+# CONFIG_BOOTCHARTD is not set
488
+# CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set
489
+# CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set
490
+# CONFIG_HALT is not set
491
+# CONFIG_POWEROFF is not set
492
+# CONFIG_REBOOT is not set
493
+# CONFIG_FEATURE_WAIT_FOR_INIT is not set
494
+# CONFIG_FEATURE_CALL_TELINIT is not set
495
+CONFIG_TELINIT_PATH=""
496
+# CONFIG_INIT is not set
497
+# CONFIG_LINUXRC is not set
498
+# CONFIG_FEATURE_USE_INITTAB is not set
499
+# CONFIG_FEATURE_KILL_REMOVED is not set
500
+CONFIG_FEATURE_KILL_DELAY=0
501
+# CONFIG_FEATURE_INIT_SCTTY is not set
502
+# CONFIG_FEATURE_INIT_SYSLOG is not set
503
+# CONFIG_FEATURE_INIT_QUIET is not set
504
+# CONFIG_FEATURE_INIT_COREDUMPS is not set
505
+CONFIG_INIT_TERMINAL_TYPE=""
506
+# CONFIG_FEATURE_INIT_MODIFY_CMDLINE is not set
507
+
508
+#
509
+# Login/Password Management Utilities
510
+#
511
+# CONFIG_FEATURE_SHADOWPASSWDS is not set
512
+CONFIG_USE_BB_PWD_GRP=y
513
+# CONFIG_USE_BB_SHADOW is not set
514
+CONFIG_USE_BB_CRYPT=y
515
+CONFIG_USE_BB_CRYPT_SHA=y
516
+# CONFIG_ADD_SHELL is not set
517
+# CONFIG_REMOVE_SHELL is not set
518
+CONFIG_ADDGROUP=y
519
+# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set
520
+CONFIG_ADDUSER=y
521
+# CONFIG_FEATURE_CHECK_NAMES is not set
522
+CONFIG_LAST_ID=60000
523
+CONFIG_FIRST_SYSTEM_ID=100
524
+CONFIG_LAST_SYSTEM_ID=999
525
+# CONFIG_CHPASSWD is not set
526
+CONFIG_FEATURE_DEFAULT_PASSWD_ALGO=""
527
+# CONFIG_CRYPTPW is not set
528
+# CONFIG_MKPASSWD is not set
529
+# CONFIG_DELUSER is not set
530
+# CONFIG_DELGROUP is not set
531
+# CONFIG_FEATURE_DEL_USER_FROM_GROUP is not set
532
+# CONFIG_GETTY is not set
533
+# CONFIG_LOGIN is not set
534
+# CONFIG_LOGIN_SESSION_AS_CHILD is not set
535
+# CONFIG_LOGIN_SCRIPTS is not set
536
+# CONFIG_FEATURE_NOLOGIN is not set
537
+# CONFIG_FEATURE_SECURETTY is not set
538
+# CONFIG_PASSWD is not set
539
+# CONFIG_FEATURE_PASSWD_WEAK_CHECK is not set
540
+# CONFIG_SU is not set
541
+# CONFIG_FEATURE_SU_SYSLOG is not set
542
+# CONFIG_FEATURE_SU_CHECKS_SHELLS is not set
543
+# CONFIG_FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY is not set
544
+# CONFIG_SULOGIN is not set
545
+# CONFIG_VLOCK is not set
546
+
547
+#
548
+# Linux Ext2 FS Progs
549
+#
550
+# CONFIG_CHATTR is not set
551
+# CONFIG_FSCK is not set
552
+# CONFIG_LSATTR is not set
553
+# CONFIG_TUNE2FS is not set
554
+
555
+#
556
+# Linux Module Utilities
557
+#
558
+# CONFIG_MODPROBE_SMALL is not set
559
+# CONFIG_DEPMOD is not set
560
+# CONFIG_INSMOD is not set
561
+# CONFIG_LSMOD is not set
562
+# CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set
563
+# CONFIG_MODINFO is not set
564
+# CONFIG_MODPROBE is not set
565
+# CONFIG_FEATURE_MODPROBE_BLACKLIST is not set
566
+# CONFIG_RMMOD is not set
567
+
568
+#
569
+# Options common to multiple modutils
570
+#
571
+# CONFIG_FEATURE_CMDLINE_MODULE_OPTIONS is not set
572
+# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set
573
+# CONFIG_FEATURE_2_4_MODULES is not set
574
+# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set
575
+# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set
576
+# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set
577
+# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set
578
+# CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set
579
+# CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set
580
+# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set
581
+# CONFIG_FEATURE_MODUTILS_ALIAS is not set
582
+# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set
583
+CONFIG_DEFAULT_MODULES_DIR=""
584
+CONFIG_DEFAULT_DEPMOD_FILE=""
585
+
586
+#
587
+# Linux System Utilities
588
+#
589
+# CONFIG_ACPID is not set
590
+# CONFIG_FEATURE_ACPID_COMPAT is not set
591
+# CONFIG_BLKDISCARD is not set
592
+# CONFIG_BLKID is not set
593
+# CONFIG_FEATURE_BLKID_TYPE is not set
594
+# CONFIG_BLOCKDEV is not set
595
+# CONFIG_CAL is not set
596
+# CONFIG_CHRT is not set
597
+# CONFIG_DMESG is not set
598
+# CONFIG_FEATURE_DMESG_PRETTY is not set
599
+# CONFIG_EJECT is not set
600
+# CONFIG_FEATURE_EJECT_SCSI is not set
601
+# CONFIG_FALLOCATE is not set
602
+# CONFIG_FATATTR is not set
603
+# CONFIG_FBSET is not set
604
+# CONFIG_FEATURE_FBSET_FANCY is not set
605
+# CONFIG_FEATURE_FBSET_READMODE is not set
606
+# CONFIG_FDFORMAT is not set
607
+# CONFIG_FDISK is not set
608
+# CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set
609
+# CONFIG_FEATURE_FDISK_WRITABLE is not set
610
+# CONFIG_FEATURE_AIX_LABEL is not set
611
+# CONFIG_FEATURE_SGI_LABEL is not set
612
+# CONFIG_FEATURE_SUN_LABEL is not set
613
+# CONFIG_FEATURE_OSF_LABEL is not set
614
+# CONFIG_FEATURE_GPT_LABEL is not set
615
+# CONFIG_FEATURE_FDISK_ADVANCED is not set
616
+# CONFIG_FINDFS is not set
617
+# CONFIG_FLOCK is not set
618
+# CONFIG_FDFLUSH is not set
619
+# CONFIG_FREERAMDISK is not set
620
+# CONFIG_FSCK_MINIX is not set
621
+# CONFIG_FSFREEZE is not set
622
+# CONFIG_FSTRIM is not set
623
+# CONFIG_GETOPT is not set
624
+# CONFIG_FEATURE_GETOPT_LONG is not set
625
+CONFIG_HEXDUMP=y
626
+CONFIG_HD=y
627
+CONFIG_XXD=y
628
+# CONFIG_HWCLOCK is not set
629
+# CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set
630
+# CONFIG_IONICE is not set
631
+# CONFIG_IPCRM is not set
632
+# CONFIG_IPCS is not set
633
+# CONFIG_LAST is not set
634
+# CONFIG_FEATURE_LAST_FANCY is not set
635
+# CONFIG_LOSETUP is not set
636
+# CONFIG_LSPCI is not set
637
+# CONFIG_LSUSB is not set
638
+# CONFIG_MDEV is not set
639
+# CONFIG_FEATURE_MDEV_CONF is not set
640
+# CONFIG_FEATURE_MDEV_RENAME is not set
641
+# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set
642
+# CONFIG_FEATURE_MDEV_EXEC is not set
643
+# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set
644
+# CONFIG_FEATURE_MDEV_DAEMON is not set
645
+# CONFIG_MESG is not set
646
+# CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set
647
+# CONFIG_MKE2FS is not set
648
+# CONFIG_MKFS_EXT2 is not set
649
+# CONFIG_MKFS_MINIX is not set
650
+# CONFIG_FEATURE_MINIX2 is not set
651
+# CONFIG_MKFS_REISER is not set
652
+# CONFIG_MKDOSFS is not set
653
+# CONFIG_MKFS_VFAT is not set
654
+# CONFIG_MKSWAP is not set
655
+# CONFIG_FEATURE_MKSWAP_UUID is not set
656
+CONFIG_MORE=y
657
+CONFIG_MOUNT=y
658
+CONFIG_FEATURE_MOUNT_FAKE=y
659
+CONFIG_FEATURE_MOUNT_VERBOSE=y
660
+# CONFIG_FEATURE_MOUNT_HELPERS is not set
661
+# CONFIG_FEATURE_MOUNT_LABEL is not set
662
+# CONFIG_FEATURE_MOUNT_NFS is not set
663
+# CONFIG_FEATURE_MOUNT_CIFS is not set
664
+CONFIG_FEATURE_MOUNT_FLAGS=y
665
+CONFIG_FEATURE_MOUNT_FSTAB=y
666
+CONFIG_FEATURE_MOUNT_OTHERTAB=y
667
+# CONFIG_MOUNTPOINT is not set
668
+CONFIG_NOLOGIN=y
669
+# CONFIG_NOLOGIN_DEPENDENCIES is not set
670
+# CONFIG_NSENTER is not set
671
+# CONFIG_PIVOT_ROOT is not set
672
+# CONFIG_RDATE is not set
673
+# CONFIG_RDEV is not set
674
+# CONFIG_READPROFILE is not set
675
+CONFIG_RENICE=y
676
+CONFIG_REV=y
677
+# CONFIG_RTCWAKE is not set
678
+# CONFIG_SCRIPT is not set
679
+# CONFIG_SCRIPTREPLAY is not set
680
+# CONFIG_SETARCH is not set
681
+# CONFIG_LINUX32 is not set
682
+# CONFIG_LINUX64 is not set
683
+# CONFIG_SETPRIV is not set
684
+# CONFIG_FEATURE_SETPRIV_DUMP is not set
685
+# CONFIG_FEATURE_SETPRIV_CAPABILITIES is not set
686
+# CONFIG_FEATURE_SETPRIV_CAPABILITY_NAMES is not set
687
+# CONFIG_SETSID is not set
688
+# CONFIG_SWAPON is not set
689
+# CONFIG_FEATURE_SWAPON_DISCARD is not set
690
+# CONFIG_FEATURE_SWAPON_PRI is not set
691
+# CONFIG_SWAPOFF is not set
692
+# CONFIG_FEATURE_SWAPONOFF_LABEL is not set
693
+# CONFIG_SWITCH_ROOT is not set
694
+# CONFIG_TASKSET is not set
695
+# CONFIG_FEATURE_TASKSET_FANCY is not set
696
+# CONFIG_FEATURE_TASKSET_CPULIST is not set
697
+# CONFIG_UEVENT is not set
698
+CONFIG_UMOUNT=y
699
+CONFIG_FEATURE_UMOUNT_ALL=y
700
+# CONFIG_UNSHARE is not set
701
+# CONFIG_WALL is not set
702
+
703
+#
704
+# Common options for mount/umount
705
+#
706
+# CONFIG_FEATURE_MOUNT_LOOP is not set
707
+# CONFIG_FEATURE_MOUNT_LOOP_CREATE is not set
708
+# CONFIG_FEATURE_MTAB_SUPPORT is not set
709
+# CONFIG_VOLUMEID is not set
710
+# CONFIG_FEATURE_VOLUMEID_BCACHE is not set
711
+# CONFIG_FEATURE_VOLUMEID_BTRFS is not set
712
+# CONFIG_FEATURE_VOLUMEID_CRAMFS is not set
713
+# CONFIG_FEATURE_VOLUMEID_EROFS is not set
714
+# CONFIG_FEATURE_VOLUMEID_EXFAT is not set
715
+# CONFIG_FEATURE_VOLUMEID_EXT is not set
716
+# CONFIG_FEATURE_VOLUMEID_F2FS is not set
717
+# CONFIG_FEATURE_VOLUMEID_FAT is not set
718
+# CONFIG_FEATURE_VOLUMEID_HFS is not set
719
+# CONFIG_FEATURE_VOLUMEID_ISO9660 is not set
720
+# CONFIG_FEATURE_VOLUMEID_JFS is not set
721
+# CONFIG_FEATURE_VOLUMEID_LFS is not set
722
+# CONFIG_FEATURE_VOLUMEID_LINUXRAID is not set
723
+# CONFIG_FEATURE_VOLUMEID_LINUXSWAP is not set
724
+# CONFIG_FEATURE_VOLUMEID_LUKS is not set
725
+# CONFIG_FEATURE_VOLUMEID_MINIX is not set
726
+# CONFIG_FEATURE_VOLUMEID_NILFS is not set
727
+# CONFIG_FEATURE_VOLUMEID_NTFS is not set
728
+# CONFIG_FEATURE_VOLUMEID_OCFS2 is not set
729
+# CONFIG_FEATURE_VOLUMEID_REISERFS is not set
730
+# CONFIG_FEATURE_VOLUMEID_ROMFS is not set
731
+# CONFIG_FEATURE_VOLUMEID_SQUASHFS is not set
732
+# CONFIG_FEATURE_VOLUMEID_SYSV is not set
733
+# CONFIG_FEATURE_VOLUMEID_UBIFS is not set
734
+# CONFIG_FEATURE_VOLUMEID_UDF is not set
735
+# CONFIG_FEATURE_VOLUMEID_XFS is not set
736
+
737
+#
738
+# Miscellaneous Utilities
739
+#
740
+# CONFIG_ADJTIMEX is not set
741
+# CONFIG_ASCII is not set
742
+# CONFIG_BBCONFIG is not set
743
+# CONFIG_FEATURE_COMPRESS_BBCONFIG is not set
744
+CONFIG_BC=y
745
+# CONFIG_DC is not set
746
+CONFIG_FEATURE_DC_BIG=y
747
+# CONFIG_FEATURE_DC_LIBM is not set
748
+# CONFIG_FEATURE_BC_INTERACTIVE is not set
749
+# CONFIG_FEATURE_BC_LONG_OPTIONS is not set
750
+# CONFIG_BEEP is not set
751
+CONFIG_FEATURE_BEEP_FREQ=0
752
+CONFIG_FEATURE_BEEP_LENGTH_MS=0
753
+# CONFIG_CHAT is not set
754
+# CONFIG_FEATURE_CHAT_NOFAIL is not set
755
+# CONFIG_FEATURE_CHAT_TTY_HIFI is not set
756
+# CONFIG_FEATURE_CHAT_IMPLICIT_CR is not set
757
+# CONFIG_FEATURE_CHAT_SWALLOW_OPTS is not set
758
+# CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set
759
+# CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set
760
+# CONFIG_FEATURE_CHAT_CLR_ABORT is not set
761
+# CONFIG_CONSPY is not set
762
+CONFIG_CROND=y
763
+CONFIG_FEATURE_CROND_D=y
764
+CONFIG_FEATURE_CROND_CALL_SENDMAIL=y
765
+CONFIG_FEATURE_CROND_SPECIAL_TIMES=y
766
+CONFIG_FEATURE_CROND_DIR="/var/spool/cron"
767
+CONFIG_CRONTAB=y
768
+# CONFIG_DEVFSD is not set
769
+# CONFIG_DEVFSD_MODLOAD is not set
770
+# CONFIG_DEVFSD_FG_NP is not set
771
+# CONFIG_DEVFSD_VERBOSE is not set
772
+# CONFIG_FEATURE_DEVFS is not set
773
+# CONFIG_DEVMEM is not set
774
+# CONFIG_FBSPLASH is not set
775
+# CONFIG_FLASH_ERASEALL is not set
776
+# CONFIG_FLASH_LOCK is not set
777
+# CONFIG_FLASH_UNLOCK is not set
778
+# CONFIG_FLASHCP is not set
779
+# CONFIG_HDPARM is not set
780
+# CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set
781
+# CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set
782
+# CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF is not set
783
+# CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set
784
+# CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set
785
+# CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set
786
+CONFIG_HEXEDIT=y
787
+# CONFIG_I2CGET is not set
788
+# CONFIG_I2CSET is not set
789
+# CONFIG_I2CDUMP is not set
790
+# CONFIG_I2CDETECT is not set
791
+# CONFIG_I2CTRANSFER is not set
792
+# CONFIG_INOTIFYD is not set
793
+CONFIG_LESS=y
794
+CONFIG_FEATURE_LESS_MAXLINES=9999999
795
+CONFIG_FEATURE_LESS_BRACKETS=y
796
+CONFIG_FEATURE_LESS_FLAGS=y
797
+CONFIG_FEATURE_LESS_TRUNCATE=y
798
+CONFIG_FEATURE_LESS_MARKS=y
799
+CONFIG_FEATURE_LESS_REGEXP=y
800
+CONFIG_FEATURE_LESS_WINCH=y
801
+CONFIG_FEATURE_LESS_ASK_TERMINAL=y
802
+CONFIG_FEATURE_LESS_DASHCMD=y
803
+CONFIG_FEATURE_LESS_LINENUMS=y
804
+CONFIG_FEATURE_LESS_RAW=y
805
+CONFIG_FEATURE_LESS_ENV=y
806
+# CONFIG_LSSCSI is not set
807
+# CONFIG_MAKEDEVS is not set
808
+# CONFIG_FEATURE_MAKEDEVS_LEAF is not set
809
+# CONFIG_FEATURE_MAKEDEVS_TABLE is not set
810
+# CONFIG_MAN is not set
811
+# CONFIG_MICROCOM is not set
812
+# CONFIG_MIM is not set
813
+# CONFIG_MT is not set
814
+# CONFIG_NANDWRITE is not set
815
+# CONFIG_NANDDUMP is not set
816
+# CONFIG_PARTPROBE is not set
817
+# CONFIG_RAIDAUTORUN is not set
818
+# CONFIG_READAHEAD is not set
819
+# CONFIG_RFKILL is not set
820
+# CONFIG_RUNLEVEL is not set
821
+# CONFIG_RX is not set
822
+# CONFIG_SETFATTR is not set
823
+# CONFIG_SETSERIAL is not set
824
+CONFIG_STRINGS=y
825
+CONFIG_TIME=y
826
+# CONFIG_TS is not set
827
+# CONFIG_TTYSIZE is not set
828
+# CONFIG_UBIATTACH is not set
829
+# CONFIG_UBIDETACH is not set
830
+# CONFIG_UBIMKVOL is not set
831
+# CONFIG_UBIRMVOL is not set
832
+# CONFIG_UBIRSVOL is not set
833
+# CONFIG_UBIUPDATEVOL is not set
834
+# CONFIG_UBIRENAME is not set
835
+# CONFIG_VOLNAME is not set
836
+# CONFIG_WATCHDOG is not set
837
+# CONFIG_FEATURE_WATCHDOG_OPEN_TWICE is not set
838
+
839
+#
840
+# Networking Utilities
841
+#
842
+CONFIG_FEATURE_IPV6=y
843
+# CONFIG_FEATURE_UNIX_LOCAL is not set
844
+CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y
845
+# CONFIG_VERBOSE_RESOLUTION_ERRORS is not set
846
+# CONFIG_FEATURE_ETC_NETWORKS is not set
847
+# CONFIG_FEATURE_ETC_SERVICES is not set
848
+# CONFIG_FEATURE_HWIB is not set
849
+# CONFIG_FEATURE_TLS_SHA1 is not set
850
+# CONFIG_ARP is not set
851
+# CONFIG_ARPING is not set
852
+# CONFIG_BRCTL is not set
853
+# CONFIG_FEATURE_BRCTL_FANCY is not set
854
+# CONFIG_FEATURE_BRCTL_SHOW is not set
855
+# CONFIG_DNSD is not set
856
+# CONFIG_ETHER_WAKE is not set
857
+# CONFIG_FTPD is not set
858
+# CONFIG_FEATURE_FTPD_WRITE is not set
859
+# CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set
860
+# CONFIG_FEATURE_FTPD_AUTHENTICATION is not set
861
+# CONFIG_FTPGET is not set
862
+# CONFIG_FTPPUT is not set
863
+# CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set
864
+# CONFIG_HOSTNAME is not set
865
+# CONFIG_DNSDOMAINNAME is not set
866
+# CONFIG_HTTPD is not set
867
+CONFIG_FEATURE_HTTPD_PORT_DEFAULT=0
868
+# CONFIG_FEATURE_HTTPD_RANGES is not set
869
+# CONFIG_FEATURE_HTTPD_SETUID is not set
870
+# CONFIG_FEATURE_HTTPD_BASIC_AUTH is not set
871
+# CONFIG_FEATURE_HTTPD_AUTH_MD5 is not set
872
+# CONFIG_FEATURE_HTTPD_CGI is not set
873
+# CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR is not set
874
+# CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV is not set
875
+# CONFIG_FEATURE_HTTPD_ENCODE_URL_STR is not set
876
+# CONFIG_FEATURE_HTTPD_ERROR_PAGES is not set
877
+# CONFIG_FEATURE_HTTPD_PROXY is not set
878
+# CONFIG_FEATURE_HTTPD_GZIP is not set
879
+# CONFIG_FEATURE_HTTPD_ETAG is not set
880
+# CONFIG_FEATURE_HTTPD_LAST_MODIFIED is not set
881
+# CONFIG_FEATURE_HTTPD_DATE is not set
882
+# CONFIG_FEATURE_HTTPD_ACL_IP is not set
883
+CONFIG_IFCONFIG=y
884
+CONFIG_FEATURE_IFCONFIG_STATUS=y
885
+# CONFIG_FEATURE_IFCONFIG_SLIP is not set
886
+CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y
887
+CONFIG_FEATURE_IFCONFIG_HW=y
888
+CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y
889
+# CONFIG_IFENSLAVE is not set
890
+# CONFIG_IFPLUGD is not set
891
+# CONFIG_IFUP is not set
892
+# CONFIG_IFDOWN is not set
893
+CONFIG_IFUPDOWN_IFSTATE_PATH=""
894
+# CONFIG_FEATURE_IFUPDOWN_IP is not set
895
+# CONFIG_FEATURE_IFUPDOWN_IPV4 is not set
896
+# CONFIG_FEATURE_IFUPDOWN_IPV6 is not set
897
+# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set
898
+# CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set
899
+CONFIG_INETD=y
900
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set
901
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set
902
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set
903
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set
904
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set
905
+# CONFIG_FEATURE_INETD_RPC is not set
906
+CONFIG_IP=y
907
+# CONFIG_IPADDR is not set
908
+# CONFIG_IPLINK is not set
909
+# CONFIG_IPROUTE is not set
910
+# CONFIG_IPTUNNEL is not set
911
+# CONFIG_IPRULE is not set
912
+# CONFIG_IPNEIGH is not set
913
+CONFIG_FEATURE_IP_ADDRESS=y
914
+CONFIG_FEATURE_IP_LINK=y
915
+CONFIG_FEATURE_IP_ROUTE=y
916
+CONFIG_FEATURE_IP_ROUTE_DIR="/etc/iproute2"
917
+# CONFIG_FEATURE_IP_TUNNEL is not set
918
+# CONFIG_FEATURE_IP_RULE is not set
919
+CONFIG_FEATURE_IP_NEIGH=y
920
+# CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set
921
+CONFIG_IPCALC=y
922
+CONFIG_FEATURE_IPCALC_LONG_OPTIONS=y
923
+CONFIG_FEATURE_IPCALC_FANCY=y
924
+# CONFIG_FAKEIDENTD is not set
925
+# CONFIG_NAMEIF is not set
926
+# CONFIG_FEATURE_NAMEIF_EXTENDED is not set
927
+# CONFIG_NBDCLIENT is not set
928
+CONFIG_NC=y
929
+# CONFIG_NETCAT is not set
930
+CONFIG_NC_SERVER=y
931
+CONFIG_NC_EXTRA=y
932
+CONFIG_NC_110_COMPAT=y
933
+# CONFIG_NETSTAT is not set
934
+# CONFIG_FEATURE_NETSTAT_WIDE is not set
935
+# CONFIG_FEATURE_NETSTAT_PRG is not set
936
+# CONFIG_NSLOOKUP is not set
937
+# CONFIG_FEATURE_NSLOOKUP_BIG is not set
938
+# CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS is not set
939
+# CONFIG_NTPD is not set
940
+# CONFIG_FEATURE_NTPD_SERVER is not set
941
+# CONFIG_FEATURE_NTPD_CONF is not set
942
+# CONFIG_FEATURE_NTP_AUTH is not set
943
+# CONFIG_PING is not set
944
+# CONFIG_PING6 is not set
945
+# CONFIG_FEATURE_FANCY_PING is not set
946
+# CONFIG_PSCAN is not set
947
+CONFIG_ROUTE=y
948
+# CONFIG_SLATTACH is not set
949
+CONFIG_SSL_CLIENT=y
950
+# CONFIG_TC is not set
951
+# CONFIG_FEATURE_TC_INGRESS is not set
952
+# CONFIG_TCPSVD is not set
953
+# CONFIG_UDPSVD is not set
954
+# CONFIG_TELNET is not set
955
+# CONFIG_FEATURE_TELNET_TTYPE is not set
956
+# CONFIG_FEATURE_TELNET_AUTOLOGIN is not set
957
+# CONFIG_FEATURE_TELNET_WIDTH is not set
958
+# CONFIG_TELNETD is not set
959
+# CONFIG_FEATURE_TELNETD_STANDALONE is not set
960
+CONFIG_FEATURE_TELNETD_PORT_DEFAULT=0
961
+# CONFIG_FEATURE_TELNETD_INETD_WAIT is not set
962
+# CONFIG_TFTP is not set
963
+# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set
964
+# CONFIG_FEATURE_TFTP_HPA_COMPAT is not set
965
+# CONFIG_TFTPD is not set
966
+# CONFIG_FEATURE_TFTP_GET is not set
967
+# CONFIG_FEATURE_TFTP_PUT is not set
968
+# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
969
+# CONFIG_TFTP_DEBUG is not set
970
+CONFIG_TLS=y
971
+# CONFIG_TRACEROUTE is not set
972
+# CONFIG_TRACEROUTE6 is not set
973
+# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
974
+# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
975
+# CONFIG_TUNCTL is not set
976
+# CONFIG_FEATURE_TUNCTL_UG is not set
977
+# CONFIG_VCONFIG is not set
978
+CONFIG_WGET=y
979
+CONFIG_FEATURE_WGET_LONG_OPTIONS=y
980
+CONFIG_FEATURE_WGET_STATUSBAR=y
981
+CONFIG_FEATURE_WGET_FTP=y
982
+CONFIG_FEATURE_WGET_AUTHENTICATION=y
983
+CONFIG_FEATURE_WGET_TIMEOUT=y
984
+CONFIG_FEATURE_WGET_HTTPS=y
985
+CONFIG_FEATURE_WGET_OPENSSL=y
986
+CONFIG_WHOIS=y
987
+# CONFIG_ZCIP is not set
988
+# CONFIG_UDHCPD is not set
989
+# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set
990
+# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
991
+CONFIG_DHCPD_LEASES_FILE=""
992
+# CONFIG_DUMPLEASES is not set
993
+# CONFIG_DHCPRELAY is not set
994
+# CONFIG_UDHCPC is not set
995
+# CONFIG_FEATURE_UDHCPC_ARPING is not set
996
+# CONFIG_FEATURE_UDHCPC_SANITIZEOPT is not set
997
+CONFIG_UDHCPC_DEFAULT_SCRIPT=""
998
+# CONFIG_UDHCPC6 is not set
999
+# CONFIG_FEATURE_UDHCPC6_RFC3646 is not set
1000
+# CONFIG_FEATURE_UDHCPC6_RFC4704 is not set
1001
+# CONFIG_FEATURE_UDHCPC6_RFC4833 is not set
1002
+# CONFIG_FEATURE_UDHCPC6_RFC5970 is not set
1003
+CONFIG_UDHCPC_DEFAULT_INTERFACE=""
1004
+# CONFIG_FEATURE_UDHCP_PORT is not set
1005
+CONFIG_UDHCP_DEBUG=0
1006
+CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0
1007
+# CONFIG_FEATURE_UDHCP_RFC3397 is not set
1008
+# CONFIG_FEATURE_UDHCP_8021Q is not set
1009
+CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS=""
1010
+
1011
+#
1012
+# Print Utilities
1013
+#
1014
+# CONFIG_LPD is not set
1015
+# CONFIG_LPR is not set
1016
+# CONFIG_LPQ is not set
1017
+
1018
+#
1019
+# Mail Utilities
1020
+#
1021
+CONFIG_FEATURE_MIME_CHARSET="utf-8"
1022
+# CONFIG_MAKEMIME is not set
1023
+# CONFIG_POPMAILDIR is not set
1024
+# CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set
1025
+# CONFIG_REFORMIME is not set
1026
+# CONFIG_FEATURE_REFORMIME_COMPAT is not set
1027
+CONFIG_SENDMAIL=y
1028
+
1029
+#
1030
+# Process Utilities
1031
+#
1032
+# CONFIG_FEATURE_FAST_TOP is not set
1033
+CONFIG_FEATURE_SHOW_THREADS=y
1034
+CONFIG_FREE=y
1035
+CONFIG_FUSER=y
1036
+CONFIG_IOSTAT=y
1037
+CONFIG_KILL=y
1038
+CONFIG_KILLALL=y
1039
+# CONFIG_KILLALL5 is not set
1040
+CONFIG_LSOF=y
1041
+CONFIG_MPSTAT=y
1042
+CONFIG_NMETER=y
1043
+CONFIG_PGREP=y
1044
+CONFIG_PKILL=y
1045
+CONFIG_PIDOF=y
1046
+CONFIG_FEATURE_PIDOF_SINGLE=y
1047
+CONFIG_FEATURE_PIDOF_OMIT=y
1048
+CONFIG_PMAP=y
1049
+# CONFIG_POWERTOP is not set
1050
+# CONFIG_FEATURE_POWERTOP_INTERACTIVE is not set
1051
+CONFIG_PS=y
1052
+# CONFIG_FEATURE_PS_WIDE is not set
1053
+# CONFIG_FEATURE_PS_LONG is not set
1054
+CONFIG_FEATURE_PS_TIME=y
1055
+# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set
1056
+CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS=y
1057
+CONFIG_PSTREE=y
1058
+CONFIG_PWDX=y
1059
+CONFIG_SMEMCAP=y
1060
+CONFIG_BB_SYSCTL=y
1061
+CONFIG_TOP=y
1062
+CONFIG_FEATURE_TOP_INTERACTIVE=y
1063
+CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y
1064
+CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y
1065
+CONFIG_FEATURE_TOP_SMP_CPU=y
1066
+CONFIG_FEATURE_TOP_DECIMALS=y
1067
+CONFIG_FEATURE_TOP_SMP_PROCESS=y
1068
+CONFIG_FEATURE_TOPMEM=y
1069
+CONFIG_UPTIME=y
1070
+CONFIG_FEATURE_UPTIME_UTMP_SUPPORT=y
1071
+CONFIG_WATCH=y
1072
+
1073
+#
1074
+# Runit Utilities
1075
+#
1076
+CONFIG_CHPST=y
1077
+CONFIG_SETUIDGID=y
1078
+CONFIG_ENVUIDGID=y
1079
+CONFIG_ENVDIR=y
1080
+CONFIG_SOFTLIMIT=y
1081
+CONFIG_RUNSV=y
1082
+CONFIG_RUNSVDIR=y
1083
+# CONFIG_FEATURE_RUNSVDIR_LOG is not set
1084
+CONFIG_SV=y
1085
+CONFIG_SV_DEFAULT_SERVICE_DIR="/var/service"
1086
+CONFIG_SVC=y
1087
+CONFIG_SVOK=y
1088
+CONFIG_SVLOGD=y
1089
+# CONFIG_CHCON is not set
1090
+# CONFIG_GETENFORCE is not set
1091
+# CONFIG_GETSEBOOL is not set
1092
+# CONFIG_LOAD_POLICY is not set
1093
+# CONFIG_MATCHPATHCON is not set
1094
+# CONFIG_RUNCON is not set
1095
+# CONFIG_SELINUXENABLED is not set
1096
+# CONFIG_SESTATUS is not set
1097
+# CONFIG_SETENFORCE is not set
1098
+# CONFIG_SETFILES is not set
1099
+# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set
1100
+# CONFIG_RESTORECON is not set
1101
+# CONFIG_SETSEBOOL is not set
1102
+
1103
+#
1104
+# Shells
1105
+#
1106
+CONFIG_SH_IS_ASH=y
1107
+# CONFIG_SH_IS_HUSH is not set
1108
+# CONFIG_SH_IS_NONE is not set
1109
+# CONFIG_BASH_IS_ASH is not set
1110
+# CONFIG_BASH_IS_HUSH is not set
1111
+CONFIG_BASH_IS_NONE=y
1112
+CONFIG_SHELL_ASH=y
1113
+CONFIG_ASH=y
1114
+CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
1115
+CONFIG_ASH_INTERNAL_GLOB=y
1116
+CONFIG_ASH_BASH_COMPAT=y
1117
+# CONFIG_ASH_BASH_SOURCE_CURDIR is not set
1118
+CONFIG_ASH_BASH_NOT_FOUND_HOOK=y
1119
+CONFIG_ASH_JOB_CONTROL=y
1120
+CONFIG_ASH_ALIAS=y
1121
+CONFIG_ASH_RANDOM_SUPPORT=y
1122
+CONFIG_ASH_EXPAND_PRMT=y
1123
+CONFIG_ASH_IDLE_TIMEOUT=y
1124
+CONFIG_ASH_MAIL=y
1125
+CONFIG_ASH_ECHO=y
1126
+CONFIG_ASH_PRINTF=y
1127
+CONFIG_ASH_TEST=y
1128
+CONFIG_ASH_HELP=y
1129
+CONFIG_ASH_GETOPTS=y
1130
+CONFIG_ASH_CMDCMD=y
1131
+# CONFIG_CTTYHACK is not set
1132
+# CONFIG_HUSH is not set
1133
+# CONFIG_SHELL_HUSH is not set
1134
+# CONFIG_HUSH_BASH_COMPAT is not set
1135
+# CONFIG_HUSH_BRACE_EXPANSION is not set
1136
+# CONFIG_HUSH_BASH_SOURCE_CURDIR is not set
1137
+# CONFIG_HUSH_LINENO_VAR is not set
1138
+# CONFIG_HUSH_INTERACTIVE is not set
1139
+# CONFIG_HUSH_SAVEHISTORY is not set
1140
+# CONFIG_HUSH_JOB is not set
1141
+# CONFIG_HUSH_TICK is not set
1142
+# CONFIG_HUSH_IF is not set
1143
+# CONFIG_HUSH_LOOPS is not set
1144
+# CONFIG_HUSH_CASE is not set
1145
+# CONFIG_HUSH_FUNCTIONS is not set
1146
+# CONFIG_HUSH_LOCAL is not set
1147
+# CONFIG_HUSH_RANDOM_SUPPORT is not set
1148
+# CONFIG_HUSH_MODE_X is not set
1149
+# CONFIG_HUSH_ECHO is not set
1150
+# CONFIG_HUSH_PRINTF is not set
1151
+# CONFIG_HUSH_TEST is not set
1152
+# CONFIG_HUSH_HELP is not set
1153
+# CONFIG_HUSH_EXPORT is not set
1154
+# CONFIG_HUSH_EXPORT_N is not set
1155
+# CONFIG_HUSH_READONLY is not set
1156
+# CONFIG_HUSH_KILL is not set
1157
+# CONFIG_HUSH_WAIT is not set
1158
+# CONFIG_HUSH_COMMAND is not set
1159
+# CONFIG_HUSH_TRAP is not set
1160
+# CONFIG_HUSH_TYPE is not set
1161
+# CONFIG_HUSH_TIMES is not set
1162
+# CONFIG_HUSH_READ is not set
1163
+# CONFIG_HUSH_SET is not set
1164
+# CONFIG_HUSH_UNSET is not set
1165
+# CONFIG_HUSH_ULIMIT is not set
1166
+# CONFIG_HUSH_UMASK is not set
1167
+# CONFIG_HUSH_GETOPTS is not set
1168
+# CONFIG_HUSH_MEMLEAK is not set
1169
+
1170
+#
1171
+# Options common to all shells
1172
+#
1173
+CONFIG_FEATURE_SH_MATH=y
1174
+CONFIG_FEATURE_SH_MATH_64=y
1175
+CONFIG_FEATURE_SH_MATH_BASE=y
1176
+CONFIG_FEATURE_SH_EXTRA_QUIET=y
1177
+# CONFIG_FEATURE_SH_STANDALONE is not set
1178
+# CONFIG_FEATURE_SH_NOFORK is not set
1179
+CONFIG_FEATURE_SH_READ_FRAC=y
1180
+CONFIG_FEATURE_SH_HISTFILESIZE=y
1181
+CONFIG_FEATURE_SH_EMBEDDED_SCRIPTS=y
1182
+
1183
+#
1184
+# System Logging Utilities
1185
+#
1186
+# CONFIG_KLOGD is not set
1187
+# CONFIG_FEATURE_KLOGD_KLOGCTL is not set
1188
+# CONFIG_LOGGER is not set
1189
+# CONFIG_LOGREAD is not set
1190
+# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set
1191
+# CONFIG_SYSLOGD is not set
1192
+# CONFIG_FEATURE_ROTATE_LOGFILE is not set
1193
+# CONFIG_FEATURE_REMOTE_LOG is not set
1194
+# CONFIG_FEATURE_SYSLOGD_DUP is not set
1195
+# CONFIG_FEATURE_SYSLOGD_CFG is not set
1196
+# CONFIG_FEATURE_SYSLOGD_PRECISE_TIMESTAMPS is not set
1197
+CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=0
1198
+# CONFIG_FEATURE_IPC_SYSLOG is not set
1199
+CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=0
1200
+# CONFIG_FEATURE_KMSG_SYSLOG is not set
--- a/containers/busybox-config
+++ b/containers/busybox-config
@@ -0,0 +1,1200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/containers/busybox-config
+++ b/containers/busybox-config
@@ -0,0 +1,1200 @@
1 #
2 # Automatically generated make config: don't edit
3 # Busybox version: 1.35.0
4 # Tue Aug 16 02:15:21 2022
5 #
6 CONFIG_HAVE_DOT_CONFIG=y
7
8 #
9 # Settings
10 #
11 CONFIG_DESKTOP=y
12 # CONFIG_EXTRA_COMPAT is not set
13 # CONFIG_FEDORA_COMPAT is not set
14 CONFIG_INCLUDE_SUSv2=y
15 CONFIG_LONG_OPTS=y
16 CONFIG_SHOW_USAGE=y
17 CONFIG_FEATURE_VERBOSE_USAGE=y
18 CONFIG_FEATURE_COMPRESS_USAGE=y
19 CONFIG_LFS=y
20 # CONFIG_PAM is not set
21 CONFIG_FEATURE_DEVPTS=y
22 CONFIG_FEATURE_UTMP=y
23 CONFIG_FEATURE_WTMP=y
24 CONFIG_FEATURE_PIDFILE=y
25 CONFIG_PID_FILE_PATH="/var/run"
26 CONFIG_BUSYBOX=y
27 CONFIG_FEATURE_SHOW_SCRIPT=y
28 CONFIG_FEATURE_INSTALLER=y
29 # CONFIG_INSTALL_NO_USR is not set
30 CONFIG_FEATURE_SUID=y
31 CONFIG_FEATURE_SUID_CONFIG=y
32 CONFIG_FEATURE_SUID_CONFIG_QUIET=y
33 # CONFIG_FEATURE_PREFER_APPLETS is not set
34 CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
35 # CONFIG_SELINUX is not set
36 # CONFIG_FEATURE_CLEAN_UP is not set
37 CONFIG_FEATURE_SYSLOG_INFO=y
38 CONFIG_FEATURE_SYSLOG=y
39
40 #
41 # Build Options
42 #
43 CONFIG_STATIC=y
44 # CONFIG_PIE is not set
45 # CONFIG_NOMMU is not set
46 # CONFIG_BUILD_LIBBUSYBOX is not set
47 # CONFIG_FEATURE_LIBBUSYBOX_STATIC is not set
48 # CONFIG_FEATURE_INDIVIDUAL is not set
49 # CONFIG_FEATURE_SHARED_BUSYBOX is not set
50 CONFIG_CROSS_COMPILER_PREFIX=""
51 CONFIG_SYSROOT=""
52 CONFIG_EXTRA_CFLAGS=""
53 CONFIG_EXTRA_LDFLAGS=""
54 CONFIG_EXTRA_LDLIBS=""
55 # CONFIG_USE_PORTABLE_CODE is not set
56 CONFIG_STACK_OPTIMIZATION_386=y
57 CONFIG_STATIC_LIBGCC=y
58
59 #
60 # Installation Options ("make install" behavior)
61 #
62 CONFIG_INSTALL_APPLET_SYMLINKS=y
63 # CONFIG_INSTALL_APPLET_HARDLINKS is not set
64 # CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set
65 # CONFIG_INSTALL_APPLET_DONT is not set
66 # CONFIG_INSTALL_SH_APPLET_SYMLINK is not set
67 # CONFIG_INSTALL_SH_APPLET_HARDLINK is not set
68 # CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set
69 CONFIG_PREFIX="./_install"
70
71 #
72 # Debugging Options
73 #
74 # CONFIG_DEBUG is not set
75 # CONFIG_DEBUG_PESSIMIZE is not set
76 # CONFIG_DEBUG_SANITIZE is not set
77 # CONFIG_UNIT_TEST is not set
78 # CONFIG_WERROR is not set
79 # CONFIG_WARN_SIMPLE_MSG is not set
80 CONFIG_NO_DEBUG_LIB=y
81 # CONFIG_DMALLOC is not set
82 # CONFIG_EFENCE is not set
83
84 #
85 # Library Tuning
86 #
87 # CONFIG_FEATURE_USE_BSS_TAIL is not set
88 CONFIG_FLOAT_DURATION=y
89 CONFIG_FEATURE_RTMINMAX=y
90 CONFIG_FEATURE_RTMINMAX_USE_LIBC_DEFINITIONS=y
91 CONFIG_FEATURE_BUFFERS_USE_MALLOC=y
92 # CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set
93 # CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
94 CONFIG_PASSWORD_MINLEN=6
95 CONFIG_MD5_SMALL=1
96 CONFIG_SHA3_SMALL=1
97 CONFIG_FEATURE_NON_POSIX_CP=y
98 # CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set
99 CONFIG_FEATURE_USE_SENDFILE=y
100 CONFIG_FEATURE_COPYBUF_KB=4
101 CONFIG_MONOTONIC_SYSCALL=y
102 CONFIG_IOCTL_HEX2STR_ERROR=y
103 CONFIG_FEATURE_EDITING=y
104 CONFIG_FEATURE_EDITING_MAX_LEN=1024
105 # CONFIG_FEATURE_EDITING_VI is not set
106 CONFIG_FEATURE_EDITING_HISTORY=255
107 CONFIG_FEATURE_EDITING_SAVEHISTORY=y
108 # CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is not set
109 CONFIG_FEATURE_REVERSE_SEARCH=y
110 CONFIG_FEATURE_TAB_COMPLETION=y
111 CONFIG_FEATURE_USERNAME_COMPLETION=y
112 CONFIG_FEATURE_EDITING_FANCY_PROMPT=y
113 CONFIG_FEATURE_EDITING_WINCH=y
114 # CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set
115 # CONFIG_LOCALE_SUPPORT is not set
116 CONFIG_UNICODE_SUPPORT=y
117 # CONFIG_UNICODE_USING_LOCALE is not set
118 # CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set
119 CONFIG_SUBST_WCHAR=63
120 CONFIG_LAST_SUPPORTED_WCHAR=767
121 # CONFIG_UNICODE_COMBINING_WCHARS is not set
122 # CONFIG_UNICODE_WIDE_WCHARS is not set
123 # CONFIG_UNICODE_BIDI_SUPPORT is not set
124 # CONFIG_UNICODE_NEUTRAL_TABLE is not set
125 # CONFIG_UNICODE_PRESERVE_BROKEN is not set
126
127 #
128 # Applets
129 #
130
131 #
132 # Archival Utilities
133 #
134 # CONFIG_FEATURE_SEAMLESS_XZ is not set
135 # CONFIG_FEATURE_SEAMLESS_LZMA is not set
136 # CONFIG_FEATURE_SEAMLESS_BZ2 is not set
137 CONFIG_FEATURE_SEAMLESS_GZ=y
138 # CONFIG_FEATURE_SEAMLESS_Z is not set
139 # CONFIG_AR is not set
140 # CONFIG_FEATURE_AR_LONG_FILENAMES is not set
141 # CONFIG_FEATURE_AR_CREATE is not set
142 # CONFIG_UNCOMPRESS is not set
143 CONFIG_GUNZIP=y
144 CONFIG_ZCAT=y
145 CONFIG_FEATURE_GUNZIP_LONG_OPTIONS=y
146 # CONFIG_BUNZIP2 is not set
147 # CONFIG_BZCAT is not set
148 # CONFIG_UNLZMA is not set
149 # CONFIG_LZCAT is not set
150 # CONFIG_LZMA is not set
151 # CONFIG_UNXZ is not set
152 # CONFIG_XZCAT is not set
153 # CONFIG_XZ is not set
154 # CONFIG_BZIP2 is not set
155 CONFIG_BZIP2_SMALL=0
156 # CONFIG_FEATURE_BZIP2_DECOMPRESS is not set
157 # CONFIG_CPIO is not set
158 # CONFIG_FEATURE_CPIO_O is not set
159 # CONFIG_FEATURE_CPIO_P is not set
160 # CONFIG_FEATURE_CPIO_IGNORE_DEVNO is not set
161 # CONFIG_FEATURE_CPIO_RENUMBER_INODES is not set
162 # CONFIG_DPKG is not set
163 # CONFIG_DPKG_DEB is not set
164 CONFIG_GZIP=y
165 CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
166 CONFIG_GZIP_FAST=0
167 # CONFIG_FEATURE_GZIP_LEVELS is not set
168 CONFIG_FEATURE_GZIP_DECOMPRESS=y
169 # CONFIG_LZOP is not set
170 # CONFIG_UNLZOP is not set
171 # CONFIG_LZOPCAT is not set
172 # CONFIG_LZOP_COMPR_HIGH is not set
173 # CONFIG_RPM is not set
174 # CONFIG_RPM2CPIO is not set
175 CONFIG_TAR=y
176 CONFIG_FEATURE_TAR_LONG_OPTIONS=y
177 CONFIG_FEATURE_TAR_CREATE=y
178 CONFIG_FEATURE_TAR_AUTODETECT=y
179 CONFIG_FEATURE_TAR_FROM=y
180 # CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY is not set
181 # CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set
182 CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
183 # CONFIG_FEATURE_TAR_TO_COMMAND is not set
184 CONFIG_FEATURE_TAR_UNAME_GNAME=y
185 CONFIG_FEATURE_TAR_NOPRESERVE_TIME=y
186 # CONFIG_FEATURE_TAR_SELINUX is not set
187 CONFIG_UNZIP=y
188 CONFIG_FEATURE_UNZIP_CDF=y
189 CONFIG_FEATURE_UNZIP_BZIP2=y
190 CONFIG_FEATURE_UNZIP_LZMA=y
191 CONFIG_FEATURE_UNZIP_XZ=y
192 # CONFIG_FEATURE_LZMA_FAST is not set
193
194 #
195 # Coreutils
196 #
197 CONFIG_FEATURE_VERBOSE=y
198
199 #
200 # Common options for date and touch
201 #
202 CONFIG_FEATURE_TIMEZONE=y
203
204 #
205 # Common options for cp and mv
206 #
207 CONFIG_FEATURE_PRESERVE_HARDLINKS=y
208
209 #
210 # Common options for df, du, ls
211 #
212 CONFIG_FEATURE_HUMAN_READABLE=y
213 CONFIG_BASENAME=y
214 CONFIG_CAT=y
215 CONFIG_FEATURE_CATN=y
216 CONFIG_FEATURE_CATV=y
217 CONFIG_CHGRP=y
218 CONFIG_CHMOD=y
219 CONFIG_CHOWN=y
220 CONFIG_FEATURE_CHOWN_LONG_OPTIONS=y
221 CONFIG_CHROOT=y
222 # CONFIG_CKSUM is not set
223 # CONFIG_CRC32 is not set
224 CONFIG_COMM=y
225 CONFIG_CP=y
226 CONFIG_FEATURE_CP_LONG_OPTIONS=y
227 CONFIG_FEATURE_CP_REFLINK=y
228 CONFIG_CUT=y
229 CONFIG_FEATURE_CUT_REGEX=y
230 CONFIG_DATE=y
231 CONFIG_FEATURE_DATE_ISOFMT=y
232 # CONFIG_FEATURE_DATE_NANO is not set
233 CONFIG_FEATURE_DATE_COMPAT=y
234 CONFIG_DD=y
235 CONFIG_FEATURE_DD_SIGNAL_HANDLING=y
236 CONFIG_FEATURE_DD_THIRD_STATUS_LINE=y
237 CONFIG_FEATURE_DD_IBS_OBS=y
238 CONFIG_FEATURE_DD_STATUS=y
239 CONFIG_DF=y
240 CONFIG_FEATURE_DF_FANCY=y
241 CONFIG_FEATURE_SKIP_ROOTFS=y
242 CONFIG_DIRNAME=y
243 CONFIG_DOS2UNIX=y
244 CONFIG_UNIX2DOS=y
245 CONFIG_DU=y
246 CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y
247 # CONFIG_ECHO is not set
248 CONFIG_FEATURE_FANCY_ECHO=y
249 CONFIG_ENV=y
250 CONFIG_EXPAND=y
251 CONFIG_UNEXPAND=y
252 CONFIG_EXPR=y
253 CONFIG_EXPR_MATH_SUPPORT_64=y
254 # CONFIG_FACTOR is not set
255 CONFIG_FALSE=y
256 CONFIG_FOLD=y
257 CONFIG_HEAD=y
258 CONFIG_FEATURE_FANCY_HEAD=y
259 CONFIG_HOSTID=y
260 CONFIG_ID=y
261 CONFIG_GROUPS=y
262 CONFIG_INSTALL=y
263 CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y
264 CONFIG_LINK=y
265 CONFIG_LN=y
266 # CONFIG_LOGNAME is not set
267 CONFIG_LS=y
268 CONFIG_FEATURE_LS_FILETYPES=y
269 CONFIG_FEATURE_LS_FOLLOWLINKS=y
270 CONFIG_FEATURE_LS_RECURSIVE=y
271 CONFIG_FEATURE_LS_WIDTH=y
272 CONFIG_FEATURE_LS_SORTFILES=y
273 CONFIG_FEATURE_LS_TIMESTAMPS=y
274 CONFIG_FEATURE_LS_USERNAME=y
275 CONFIG_FEATURE_LS_COLOR=y
276 CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y
277 # CONFIG_MD5SUM is not set
278 # CONFIG_SHA1SUM is not set
279 # CONFIG_SHA256SUM is not set
280 # CONFIG_SHA512SUM is not set
281 # CONFIG_SHA3SUM is not set
282 # CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set
283 CONFIG_MKDIR=y
284 CONFIG_MKFIFO=y
285 CONFIG_MKNOD=y
286 CONFIG_MKTEMP=y
287 CONFIG_MV=y
288 CONFIG_NICE=y
289 CONFIG_NL=y
290 CONFIG_NOHUP=y
291 CONFIG_NPROC=y
292 CONFIG_OD=y
293 CONFIG_PASTE=y
294 # CONFIG_PRINTENV is not set
295 # CONFIG_PRINTF is not set
296 CONFIG_PWD=y
297 CONFIG_READLINK=y
298 CONFIG_FEATURE_READLINK_FOLLOW=y
299 CONFIG_REALPATH=y
300 CONFIG_RM=y
301 CONFIG_RMDIR=y
302 CONFIG_SEQ=y
303 CONFIG_SHRED=y
304 CONFIG_SHUF=y
305 CONFIG_SLEEP=y
306 CONFIG_FEATURE_FANCY_SLEEP=y
307 CONFIG_SORT=y
308 # CONFIG_FEATURE_SORT_BIG is not set
309 # CONFIG_FEATURE_SORT_OPTIMIZE_MEMORY is not set
310 CONFIG_SPLIT=y
311 CONFIG_FEATURE_SPLIT_FANCY=y
312 CONFIG_STAT=y
313 CONFIG_FEATURE_STAT_FORMAT=y
314 CONFIG_FEATURE_STAT_FILESYSTEM=y
315 CONFIG_STTY=y
316 # CONFIG_SUM is not set
317 CONFIG_SYNC=y
318 CONFIG_FEATURE_SYNC_FANCY=y
319 CONFIG_FSYNC=y
320 CONFIG_TAC=y
321 CONFIG_TAIL=y
322 CONFIG_FEATURE_FANCY_TAIL=y
323 CONFIG_TEE=y
324 CONFIG_FEATURE_TEE_USE_BLOCK_IO=y
325 # CONFIG_TEST is not set
326 # CONFIG_TEST1 is not set
327 # CONFIG_TEST2 is not set
328 # CONFIG_FEATURE_TEST_64 is not set
329 CONFIG_TIMEOUT=y
330 CONFIG_TOUCH=y
331 CONFIG_FEATURE_TOUCH_SUSV3=y
332 CONFIG_TR=y
333 CONFIG_FEATURE_TR_CLASSES=y
334 CONFIG_FEATURE_TR_EQUIV=y
335 CONFIG_TRUE=y
336 CONFIG_TRUNCATE=y
337 CONFIG_TTY=y
338 CONFIG_UNAME=y
339 CONFIG_UNAME_OSNAME="GNU/Linux"
340 CONFIG_BB_ARCH=y
341 CONFIG_UNIQ=y
342 CONFIG_UNLINK=y
343 CONFIG_USLEEP=y
344 CONFIG_UUDECODE=y
345 CONFIG_BASE32=y
346 CONFIG_BASE64=y
347 CONFIG_UUENCODE=y
348 CONFIG_WC=y
349 CONFIG_FEATURE_WC_LARGE=y
350 CONFIG_WHO=y
351 CONFIG_W=y
352 CONFIG_USERS=y
353 CONFIG_WHOAMI=y
354 CONFIG_YES=y
355
356 #
357 # Console Utilities
358 #
359 # CONFIG_CHVT is not set
360 CONFIG_CLEAR=y
361 # CONFIG_DEALLOCVT is not set
362 # CONFIG_DUMPKMAP is not set
363 # CONFIG_FGCONSOLE is not set
364 # CONFIG_KBD_MODE is not set
365 # CONFIG_LOADFONT is not set
366 # CONFIG_SETFONT is not set
367 # CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set
368 CONFIG_DEFAULT_SETFONT_DIR=""
369 # CONFIG_FEATURE_LOADFONT_PSF2 is not set
370 # CONFIG_FEATURE_LOADFONT_RAW is not set
371 # CONFIG_LOADKMAP is not set
372 # CONFIG_OPENVT is not set
373 # CONFIG_RESET is not set
374 # CONFIG_RESIZE is not set
375 # CONFIG_FEATURE_RESIZE_PRINT is not set
376 # CONFIG_SETCONSOLE is not set
377 # CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set
378 # CONFIG_SETKEYCODES is not set
379 # CONFIG_SETLOGCONS is not set
380 # CONFIG_SHOWKEY is not set
381
382 #
383 # Debian Utilities
384 #
385 # CONFIG_PIPE_PROGRESS is not set
386 # CONFIG_RUN_PARTS is not set
387 # CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS is not set
388 # CONFIG_FEATURE_RUN_PARTS_FANCY is not set
389 # CONFIG_START_STOP_DAEMON is not set
390 # CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set
391 # CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set
392 CONFIG_WHICH=y
393
394 #
395 # klibc-utils
396 #
397 # CONFIG_MINIPS is not set
398 # CONFIG_NUKE is not set
399 # CONFIG_RESUME is not set
400 # CONFIG_RUN_INIT is not set
401
402 #
403 # Editors
404 #
405 # CONFIG_AWK is not set
406 # CONFIG_FEATURE_AWK_LIBM is not set
407 # CONFIG_FEATURE_AWK_GNU_EXTENSIONS is not set
408 # CONFIG_CMP is not set
409 CONFIG_DIFF=y
410 CONFIG_FEATURE_DIFF_LONG_OPTIONS=y
411 CONFIG_FEATURE_DIFF_DIR=y
412 # CONFIG_ED is not set
413 CONFIG_PATCH=y
414 CONFIG_SED=y
415 CONFIG_VI=y
416 CONFIG_FEATURE_VI_MAX_LEN=4096
417 # CONFIG_FEATURE_VI_8BIT is not set
418 CONFIG_FEATURE_VI_COLON=y
419 CONFIG_FEATURE_VI_COLON_EXPAND=y
420 CONFIG_FEATURE_VI_YANKMARK=y
421 CONFIG_FEATURE_VI_SEARCH=y
422 # CONFIG_FEATURE_VI_REGEX_SEARCH is not set
423 CONFIG_FEATURE_VI_USE_SIGNALS=y
424 CONFIG_FEATURE_VI_DOT_CMD=y
425 CONFIG_FEATURE_VI_READONLY=y
426 CONFIG_FEATURE_VI_SETOPTS=y
427 CONFIG_FEATURE_VI_SET=y
428 CONFIG_FEATURE_VI_WIN_RESIZE=y
429 CONFIG_FEATURE_VI_ASK_TERMINAL=y
430 CONFIG_FEATURE_VI_UNDO=y
431 CONFIG_FEATURE_VI_UNDO_QUEUE=y
432 CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=256
433 CONFIG_FEATURE_VI_VERBOSE_STATUS=y
434 CONFIG_FEATURE_ALLOW_EXEC=y
435
436 #
437 # Finding Utilities
438 #
439 CONFIG_FIND=y
440 CONFIG_FEATURE_FIND_PRINT0=y
441 CONFIG_FEATURE_FIND_MTIME=y
442 CONFIG_FEATURE_FIND_ATIME=y
443 CONFIG_FEATURE_FIND_CTIME=y
444 CONFIG_FEATURE_FIND_MMIN=y
445 CONFIG_FEATURE_FIND_AMIN=y
446 CONFIG_FEATURE_FIND_CMIN=y
447 CONFIG_FEATURE_FIND_PERM=y
448 CONFIG_FEATURE_FIND_TYPE=y
449 CONFIG_FEATURE_FIND_EXECUTABLE=y
450 CONFIG_FEATURE_FIND_XDEV=y
451 CONFIG_FEATURE_FIND_MAXDEPTH=y
452 CONFIG_FEATURE_FIND_NEWER=y
453 CONFIG_FEATURE_FIND_INUM=y
454 CONFIG_FEATURE_FIND_SAMEFILE=y
455 CONFIG_FEATURE_FIND_EXEC=y
456 CONFIG_FEATURE_FIND_EXEC_PLUS=y
457 CONFIG_FEATURE_FIND_USER=y
458 CONFIG_FEATURE_FIND_GROUP=y
459 CONFIG_FEATURE_FIND_NOT=y
460 CONFIG_FEATURE_FIND_DEPTH=y
461 CONFIG_FEATURE_FIND_PAREN=y
462 CONFIG_FEATURE_FIND_SIZE=y
463 CONFIG_FEATURE_FIND_PRUNE=y
464 CONFIG_FEATURE_FIND_QUIT=y
465 CONFIG_FEATURE_FIND_DELETE=y
466 CONFIG_FEATURE_FIND_EMPTY=y
467 CONFIG_FEATURE_FIND_PATH=y
468 CONFIG_FEATURE_FIND_REGEX=y
469 # CONFIG_FEATURE_FIND_CONTEXT is not set
470 CONFIG_FEATURE_FIND_LINKS=y
471 CONFIG_GREP=y
472 # CONFIG_EGREP is not set
473 # CONFIG_FGREP is not set
474 CONFIG_FEATURE_GREP_CONTEXT=y
475 CONFIG_XARGS=y
476 CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION=y
477 CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y
478 CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y
479 CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
480 CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR=y
481 CONFIG_FEATURE_XARGS_SUPPORT_PARALLEL=y
482 CONFIG_FEATURE_XARGS_SUPPORT_ARGS_FILE=y
483
484 #
485 # Init Utilities
486 #
487 # CONFIG_BOOTCHARTD is not set
488 # CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set
489 # CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set
490 # CONFIG_HALT is not set
491 # CONFIG_POWEROFF is not set
492 # CONFIG_REBOOT is not set
493 # CONFIG_FEATURE_WAIT_FOR_INIT is not set
494 # CONFIG_FEATURE_CALL_TELINIT is not set
495 CONFIG_TELINIT_PATH=""
496 # CONFIG_INIT is not set
497 # CONFIG_LINUXRC is not set
498 # CONFIG_FEATURE_USE_INITTAB is not set
499 # CONFIG_FEATURE_KILL_REMOVED is not set
500 CONFIG_FEATURE_KILL_DELAY=0
501 # CONFIG_FEATURE_INIT_SCTTY is not set
502 # CONFIG_FEATURE_INIT_SYSLOG is not set
503 # CONFIG_FEATURE_INIT_QUIET is not set
504 # CONFIG_FEATURE_INIT_COREDUMPS is not set
505 CONFIG_INIT_TERMINAL_TYPE=""
506 # CONFIG_FEATURE_INIT_MODIFY_CMDLINE is not set
507
508 #
509 # Login/Password Management Utilities
510 #
511 # CONFIG_FEATURE_SHADOWPASSWDS is not set
512 CONFIG_USE_BB_PWD_GRP=y
513 # CONFIG_USE_BB_SHADOW is not set
514 CONFIG_USE_BB_CRYPT=y
515 CONFIG_USE_BB_CRYPT_SHA=y
516 # CONFIG_ADD_SHELL is not set
517 # CONFIG_REMOVE_SHELL is not set
518 CONFIG_ADDGROUP=y
519 # CONFIG_FEATURE_ADDUSER_TO_GROUP is not set
520 CONFIG_ADDUSER=y
521 # CONFIG_FEATURE_CHECK_NAMES is not set
522 CONFIG_LAST_ID=60000
523 CONFIG_FIRST_SYSTEM_ID=100
524 CONFIG_LAST_SYSTEM_ID=999
525 # CONFIG_CHPASSWD is not set
526 CONFIG_FEATURE_DEFAULT_PASSWD_ALGO=""
527 # CONFIG_CRYPTPW is not set
528 # CONFIG_MKPASSWD is not set
529 # CONFIG_DELUSER is not set
530 # CONFIG_DELGROUP is not set
531 # CONFIG_FEATURE_DEL_USER_FROM_GROUP is not set
532 # CONFIG_GETTY is not set
533 # CONFIG_LOGIN is not set
534 # CONFIG_LOGIN_SESSION_AS_CHILD is not set
535 # CONFIG_LOGIN_SCRIPTS is not set
536 # CONFIG_FEATURE_NOLOGIN is not set
537 # CONFIG_FEATURE_SECURETTY is not set
538 # CONFIG_PASSWD is not set
539 # CONFIG_FEATURE_PASSWD_WEAK_CHECK is not set
540 # CONFIG_SU is not set
541 # CONFIG_FEATURE_SU_SYSLOG is not set
542 # CONFIG_FEATURE_SU_CHECKS_SHELLS is not set
543 # CONFIG_FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY is not set
544 # CONFIG_SULOGIN is not set
545 # CONFIG_VLOCK is not set
546
547 #
548 # Linux Ext2 FS Progs
549 #
550 # CONFIG_CHATTR is not set
551 # CONFIG_FSCK is not set
552 # CONFIG_LSATTR is not set
553 # CONFIG_TUNE2FS is not set
554
555 #
556 # Linux Module Utilities
557 #
558 # CONFIG_MODPROBE_SMALL is not set
559 # CONFIG_DEPMOD is not set
560 # CONFIG_INSMOD is not set
561 # CONFIG_LSMOD is not set
562 # CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set
563 # CONFIG_MODINFO is not set
564 # CONFIG_MODPROBE is not set
565 # CONFIG_FEATURE_MODPROBE_BLACKLIST is not set
566 # CONFIG_RMMOD is not set
567
568 #
569 # Options common to multiple modutils
570 #
571 # CONFIG_FEATURE_CMDLINE_MODULE_OPTIONS is not set
572 # CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set
573 # CONFIG_FEATURE_2_4_MODULES is not set
574 # CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set
575 # CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set
576 # CONFIG_FEATURE_INSMOD_LOADINKMEM is not set
577 # CONFIG_FEATURE_INSMOD_LOAD_MAP is not set
578 # CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set
579 # CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set
580 # CONFIG_FEATURE_INSMOD_TRY_MMAP is not set
581 # CONFIG_FEATURE_MODUTILS_ALIAS is not set
582 # CONFIG_FEATURE_MODUTILS_SYMBOLS is not set
583 CONFIG_DEFAULT_MODULES_DIR=""
584 CONFIG_DEFAULT_DEPMOD_FILE=""
585
586 #
587 # Linux System Utilities
588 #
589 # CONFIG_ACPID is not set
590 # CONFIG_FEATURE_ACPID_COMPAT is not set
591 # CONFIG_BLKDISCARD is not set
592 # CONFIG_BLKID is not set
593 # CONFIG_FEATURE_BLKID_TYPE is not set
594 # CONFIG_BLOCKDEV is not set
595 # CONFIG_CAL is not set
596 # CONFIG_CHRT is not set
597 # CONFIG_DMESG is not set
598 # CONFIG_FEATURE_DMESG_PRETTY is not set
599 # CONFIG_EJECT is not set
600 # CONFIG_FEATURE_EJECT_SCSI is not set
601 # CONFIG_FALLOCATE is not set
602 # CONFIG_FATATTR is not set
603 # CONFIG_FBSET is not set
604 # CONFIG_FEATURE_FBSET_FANCY is not set
605 # CONFIG_FEATURE_FBSET_READMODE is not set
606 # CONFIG_FDFORMAT is not set
607 # CONFIG_FDISK is not set
608 # CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set
609 # CONFIG_FEATURE_FDISK_WRITABLE is not set
610 # CONFIG_FEATURE_AIX_LABEL is not set
611 # CONFIG_FEATURE_SGI_LABEL is not set
612 # CONFIG_FEATURE_SUN_LABEL is not set
613 # CONFIG_FEATURE_OSF_LABEL is not set
614 # CONFIG_FEATURE_GPT_LABEL is not set
615 # CONFIG_FEATURE_FDISK_ADVANCED is not set
616 # CONFIG_FINDFS is not set
617 # CONFIG_FLOCK is not set
618 # CONFIG_FDFLUSH is not set
619 # CONFIG_FREERAMDISK is not set
620 # CONFIG_FSCK_MINIX is not set
621 # CONFIG_FSFREEZE is not set
622 # CONFIG_FSTRIM is not set
623 # CONFIG_GETOPT is not set
624 # CONFIG_FEATURE_GETOPT_LONG is not set
625 CONFIG_HEXDUMP=y
626 CONFIG_HD=y
627 CONFIG_XXD=y
628 # CONFIG_HWCLOCK is not set
629 # CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set
630 # CONFIG_IONICE is not set
631 # CONFIG_IPCRM is not set
632 # CONFIG_IPCS is not set
633 # CONFIG_LAST is not set
634 # CONFIG_FEATURE_LAST_FANCY is not set
635 # CONFIG_LOSETUP is not set
636 # CONFIG_LSPCI is not set
637 # CONFIG_LSUSB is not set
638 # CONFIG_MDEV is not set
639 # CONFIG_FEATURE_MDEV_CONF is not set
640 # CONFIG_FEATURE_MDEV_RENAME is not set
641 # CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set
642 # CONFIG_FEATURE_MDEV_EXEC is not set
643 # CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set
644 # CONFIG_FEATURE_MDEV_DAEMON is not set
645 # CONFIG_MESG is not set
646 # CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set
647 # CONFIG_MKE2FS is not set
648 # CONFIG_MKFS_EXT2 is not set
649 # CONFIG_MKFS_MINIX is not set
650 # CONFIG_FEATURE_MINIX2 is not set
651 # CONFIG_MKFS_REISER is not set
652 # CONFIG_MKDOSFS is not set
653 # CONFIG_MKFS_VFAT is not set
654 # CONFIG_MKSWAP is not set
655 # CONFIG_FEATURE_MKSWAP_UUID is not set
656 CONFIG_MORE=y
657 CONFIG_MOUNT=y
658 CONFIG_FEATURE_MOUNT_FAKE=y
659 CONFIG_FEATURE_MOUNT_VERBOSE=y
660 # CONFIG_FEATURE_MOUNT_HELPERS is not set
661 # CONFIG_FEATURE_MOUNT_LABEL is not set
662 # CONFIG_FEATURE_MOUNT_NFS is not set
663 # CONFIG_FEATURE_MOUNT_CIFS is not set
664 CONFIG_FEATURE_MOUNT_FLAGS=y
665 CONFIG_FEATURE_MOUNT_FSTAB=y
666 CONFIG_FEATURE_MOUNT_OTHERTAB=y
667 # CONFIG_MOUNTPOINT is not set
668 CONFIG_NOLOGIN=y
669 # CONFIG_NOLOGIN_DEPENDENCIES is not set
670 # CONFIG_NSENTER is not set
671 # CONFIG_PIVOT_ROOT is not set
672 # CONFIG_RDATE is not set
673 # CONFIG_RDEV is not set
674 # CONFIG_READPROFILE is not set
675 CONFIG_RENICE=y
676 CONFIG_REV=y
677 # CONFIG_RTCWAKE is not set
678 # CONFIG_SCRIPT is not set
679 # CONFIG_SCRIPTREPLAY is not set
680 # CONFIG_SETARCH is not set
681 # CONFIG_LINUX32 is not set
682 # CONFIG_LINUX64 is not set
683 # CONFIG_SETPRIV is not set
684 # CONFIG_FEATURE_SETPRIV_DUMP is not set
685 # CONFIG_FEATURE_SETPRIV_CAPABILITIES is not set
686 # CONFIG_FEATURE_SETPRIV_CAPABILITY_NAMES is not set
687 # CONFIG_SETSID is not set
688 # CONFIG_SWAPON is not set
689 # CONFIG_FEATURE_SWAPON_DISCARD is not set
690 # CONFIG_FEATURE_SWAPON_PRI is not set
691 # CONFIG_SWAPOFF is not set
692 # CONFIG_FEATURE_SWAPONOFF_LABEL is not set
693 # CONFIG_SWITCH_ROOT is not set
694 # CONFIG_TASKSET is not set
695 # CONFIG_FEATURE_TASKSET_FANCY is not set
696 # CONFIG_FEATURE_TASKSET_CPULIST is not set
697 # CONFIG_UEVENT is not set
698 CONFIG_UMOUNT=y
699 CONFIG_FEATURE_UMOUNT_ALL=y
700 # CONFIG_UNSHARE is not set
701 # CONFIG_WALL is not set
702
703 #
704 # Common options for mount/umount
705 #
706 # CONFIG_FEATURE_MOUNT_LOOP is not set
707 # CONFIG_FEATURE_MOUNT_LOOP_CREATE is not set
708 # CONFIG_FEATURE_MTAB_SUPPORT is not set
709 # CONFIG_VOLUMEID is not set
710 # CONFIG_FEATURE_VOLUMEID_BCACHE is not set
711 # CONFIG_FEATURE_VOLUMEID_BTRFS is not set
712 # CONFIG_FEATURE_VOLUMEID_CRAMFS is not set
713 # CONFIG_FEATURE_VOLUMEID_EROFS is not set
714 # CONFIG_FEATURE_VOLUMEID_EXFAT is not set
715 # CONFIG_FEATURE_VOLUMEID_EXT is not set
716 # CONFIG_FEATURE_VOLUMEID_F2FS is not set
717 # CONFIG_FEATURE_VOLUMEID_FAT is not set
718 # CONFIG_FEATURE_VOLUMEID_HFS is not set
719 # CONFIG_FEATURE_VOLUMEID_ISO9660 is not set
720 # CONFIG_FEATURE_VOLUMEID_JFS is not set
721 # CONFIG_FEATURE_VOLUMEID_LFS is not set
722 # CONFIG_FEATURE_VOLUMEID_LINUXRAID is not set
723 # CONFIG_FEATURE_VOLUMEID_LINUXSWAP is not set
724 # CONFIG_FEATURE_VOLUMEID_LUKS is not set
725 # CONFIG_FEATURE_VOLUMEID_MINIX is not set
726 # CONFIG_FEATURE_VOLUMEID_NILFS is not set
727 # CONFIG_FEATURE_VOLUMEID_NTFS is not set
728 # CONFIG_FEATURE_VOLUMEID_OCFS2 is not set
729 # CONFIG_FEATURE_VOLUMEID_REISERFS is not set
730 # CONFIG_FEATURE_VOLUMEID_ROMFS is not set
731 # CONFIG_FEATURE_VOLUMEID_SQUASHFS is not set
732 # CONFIG_FEATURE_VOLUMEID_SYSV is not set
733 # CONFIG_FEATURE_VOLUMEID_UBIFS is not set
734 # CONFIG_FEATURE_VOLUMEID_UDF is not set
735 # CONFIG_FEATURE_VOLUMEID_XFS is not set
736
737 #
738 # Miscellaneous Utilities
739 #
740 # CONFIG_ADJTIMEX is not set
741 # CONFIG_ASCII is not set
742 # CONFIG_BBCONFIG is not set
743 # CONFIG_FEATURE_COMPRESS_BBCONFIG is not set
744 CONFIG_BC=y
745 # CONFIG_DC is not set
746 CONFIG_FEATURE_DC_BIG=y
747 # CONFIG_FEATURE_DC_LIBM is not set
748 # CONFIG_FEATURE_BC_INTERACTIVE is not set
749 # CONFIG_FEATURE_BC_LONG_OPTIONS is not set
750 # CONFIG_BEEP is not set
751 CONFIG_FEATURE_BEEP_FREQ=0
752 CONFIG_FEATURE_BEEP_LENGTH_MS=0
753 # CONFIG_CHAT is not set
754 # CONFIG_FEATURE_CHAT_NOFAIL is not set
755 # CONFIG_FEATURE_CHAT_TTY_HIFI is not set
756 # CONFIG_FEATURE_CHAT_IMPLICIT_CR is not set
757 # CONFIG_FEATURE_CHAT_SWALLOW_OPTS is not set
758 # CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set
759 # CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set
760 # CONFIG_FEATURE_CHAT_CLR_ABORT is not set
761 # CONFIG_CONSPY is not set
762 CONFIG_CROND=y
763 CONFIG_FEATURE_CROND_D=y
764 CONFIG_FEATURE_CROND_CALL_SENDMAIL=y
765 CONFIG_FEATURE_CROND_SPECIAL_TIMES=y
766 CONFIG_FEATURE_CROND_DIR="/var/spool/cron"
767 CONFIG_CRONTAB=y
768 # CONFIG_DEVFSD is not set
769 # CONFIG_DEVFSD_MODLOAD is not set
770 # CONFIG_DEVFSD_FG_NP is not set
771 # CONFIG_DEVFSD_VERBOSE is not set
772 # CONFIG_FEATURE_DEVFS is not set
773 # CONFIG_DEVMEM is not set
774 # CONFIG_FBSPLASH is not set
775 # CONFIG_FLASH_ERASEALL is not set
776 # CONFIG_FLASH_LOCK is not set
777 # CONFIG_FLASH_UNLOCK is not set
778 # CONFIG_FLASHCP is not set
779 # CONFIG_HDPARM is not set
780 # CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set
781 # CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set
782 # CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF is not set
783 # CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set
784 # CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set
785 # CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set
786 CONFIG_HEXEDIT=y
787 # CONFIG_I2CGET is not set
788 # CONFIG_I2CSET is not set
789 # CONFIG_I2CDUMP is not set
790 # CONFIG_I2CDETECT is not set
791 # CONFIG_I2CTRANSFER is not set
792 # CONFIG_INOTIFYD is not set
793 CONFIG_LESS=y
794 CONFIG_FEATURE_LESS_MAXLINES=9999999
795 CONFIG_FEATURE_LESS_BRACKETS=y
796 CONFIG_FEATURE_LESS_FLAGS=y
797 CONFIG_FEATURE_LESS_TRUNCATE=y
798 CONFIG_FEATURE_LESS_MARKS=y
799 CONFIG_FEATURE_LESS_REGEXP=y
800 CONFIG_FEATURE_LESS_WINCH=y
801 CONFIG_FEATURE_LESS_ASK_TERMINAL=y
802 CONFIG_FEATURE_LESS_DASHCMD=y
803 CONFIG_FEATURE_LESS_LINENUMS=y
804 CONFIG_FEATURE_LESS_RAW=y
805 CONFIG_FEATURE_LESS_ENV=y
806 # CONFIG_LSSCSI is not set
807 # CONFIG_MAKEDEVS is not set
808 # CONFIG_FEATURE_MAKEDEVS_LEAF is not set
809 # CONFIG_FEATURE_MAKEDEVS_TABLE is not set
810 # CONFIG_MAN is not set
811 # CONFIG_MICROCOM is not set
812 # CONFIG_MIM is not set
813 # CONFIG_MT is not set
814 # CONFIG_NANDWRITE is not set
815 # CONFIG_NANDDUMP is not set
816 # CONFIG_PARTPROBE is not set
817 # CONFIG_RAIDAUTORUN is not set
818 # CONFIG_READAHEAD is not set
819 # CONFIG_RFKILL is not set
820 # CONFIG_RUNLEVEL is not set
821 # CONFIG_RX is not set
822 # CONFIG_SETFATTR is not set
823 # CONFIG_SETSERIAL is not set
824 CONFIG_STRINGS=y
825 CONFIG_TIME=y
826 # CONFIG_TS is not set
827 # CONFIG_TTYSIZE is not set
828 # CONFIG_UBIATTACH is not set
829 # CONFIG_UBIDETACH is not set
830 # CONFIG_UBIMKVOL is not set
831 # CONFIG_UBIRMVOL is not set
832 # CONFIG_UBIRSVOL is not set
833 # CONFIG_UBIUPDATEVOL is not set
834 # CONFIG_UBIRENAME is not set
835 # CONFIG_VOLNAME is not set
836 # CONFIG_WATCHDOG is not set
837 # CONFIG_FEATURE_WATCHDOG_OPEN_TWICE is not set
838
839 #
840 # Networking Utilities
841 #
842 CONFIG_FEATURE_IPV6=y
843 # CONFIG_FEATURE_UNIX_LOCAL is not set
844 CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y
845 # CONFIG_VERBOSE_RESOLUTION_ERRORS is not set
846 # CONFIG_FEATURE_ETC_NETWORKS is not set
847 # CONFIG_FEATURE_ETC_SERVICES is not set
848 # CONFIG_FEATURE_HWIB is not set
849 # CONFIG_FEATURE_TLS_SHA1 is not set
850 # CONFIG_ARP is not set
851 # CONFIG_ARPING is not set
852 # CONFIG_BRCTL is not set
853 # CONFIG_FEATURE_BRCTL_FANCY is not set
854 # CONFIG_FEATURE_BRCTL_SHOW is not set
855 # CONFIG_DNSD is not set
856 # CONFIG_ETHER_WAKE is not set
857 # CONFIG_FTPD is not set
858 # CONFIG_FEATURE_FTPD_WRITE is not set
859 # CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set
860 # CONFIG_FEATURE_FTPD_AUTHENTICATION is not set
861 # CONFIG_FTPGET is not set
862 # CONFIG_FTPPUT is not set
863 # CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set
864 # CONFIG_HOSTNAME is not set
865 # CONFIG_DNSDOMAINNAME is not set
866 # CONFIG_HTTPD is not set
867 CONFIG_FEATURE_HTTPD_PORT_DEFAULT=0
868 # CONFIG_FEATURE_HTTPD_RANGES is not set
869 # CONFIG_FEATURE_HTTPD_SETUID is not set
870 # CONFIG_FEATURE_HTTPD_BASIC_AUTH is not set
871 # CONFIG_FEATURE_HTTPD_AUTH_MD5 is not set
872 # CONFIG_FEATURE_HTTPD_CGI is not set
873 # CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR is not set
874 # CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV is not set
875 # CONFIG_FEATURE_HTTPD_ENCODE_URL_STR is not set
876 # CONFIG_FEATURE_HTTPD_ERROR_PAGES is not set
877 # CONFIG_FEATURE_HTTPD_PROXY is not set
878 # CONFIG_FEATURE_HTTPD_GZIP is not set
879 # CONFIG_FEATURE_HTTPD_ETAG is not set
880 # CONFIG_FEATURE_HTTPD_LAST_MODIFIED is not set
881 # CONFIG_FEATURE_HTTPD_DATE is not set
882 # CONFIG_FEATURE_HTTPD_ACL_IP is not set
883 CONFIG_IFCONFIG=y
884 CONFIG_FEATURE_IFCONFIG_STATUS=y
885 # CONFIG_FEATURE_IFCONFIG_SLIP is not set
886 CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y
887 CONFIG_FEATURE_IFCONFIG_HW=y
888 CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y
889 # CONFIG_IFENSLAVE is not set
890 # CONFIG_IFPLUGD is not set
891 # CONFIG_IFUP is not set
892 # CONFIG_IFDOWN is not set
893 CONFIG_IFUPDOWN_IFSTATE_PATH=""
894 # CONFIG_FEATURE_IFUPDOWN_IP is not set
895 # CONFIG_FEATURE_IFUPDOWN_IPV4 is not set
896 # CONFIG_FEATURE_IFUPDOWN_IPV6 is not set
897 # CONFIG_FEATURE_IFUPDOWN_MAPPING is not set
898 # CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set
899 CONFIG_INETD=y
900 # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set
901 # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set
902 # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set
903 # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set
904 # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set
905 # CONFIG_FEATURE_INETD_RPC is not set
906 CONFIG_IP=y
907 # CONFIG_IPADDR is not set
908 # CONFIG_IPLINK is not set
909 # CONFIG_IPROUTE is not set
910 # CONFIG_IPTUNNEL is not set
911 # CONFIG_IPRULE is not set
912 # CONFIG_IPNEIGH is not set
913 CONFIG_FEATURE_IP_ADDRESS=y
914 CONFIG_FEATURE_IP_LINK=y
915 CONFIG_FEATURE_IP_ROUTE=y
916 CONFIG_FEATURE_IP_ROUTE_DIR="/etc/iproute2"
917 # CONFIG_FEATURE_IP_TUNNEL is not set
918 # CONFIG_FEATURE_IP_RULE is not set
919 CONFIG_FEATURE_IP_NEIGH=y
920 # CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set
921 CONFIG_IPCALC=y
922 CONFIG_FEATURE_IPCALC_LONG_OPTIONS=y
923 CONFIG_FEATURE_IPCALC_FANCY=y
924 # CONFIG_FAKEIDENTD is not set
925 # CONFIG_NAMEIF is not set
926 # CONFIG_FEATURE_NAMEIF_EXTENDED is not set
927 # CONFIG_NBDCLIENT is not set
928 CONFIG_NC=y
929 # CONFIG_NETCAT is not set
930 CONFIG_NC_SERVER=y
931 CONFIG_NC_EXTRA=y
932 CONFIG_NC_110_COMPAT=y
933 # CONFIG_NETSTAT is not set
934 # CONFIG_FEATURE_NETSTAT_WIDE is not set
935 # CONFIG_FEATURE_NETSTAT_PRG is not set
936 # CONFIG_NSLOOKUP is not set
937 # CONFIG_FEATURE_NSLOOKUP_BIG is not set
938 # CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS is not set
939 # CONFIG_NTPD is not set
940 # CONFIG_FEATURE_NTPD_SERVER is not set
941 # CONFIG_FEATURE_NTPD_CONF is not set
942 # CONFIG_FEATURE_NTP_AUTH is not set
943 # CONFIG_PING is not set
944 # CONFIG_PING6 is not set
945 # CONFIG_FEATURE_FANCY_PING is not set
946 # CONFIG_PSCAN is not set
947 CONFIG_ROUTE=y
948 # CONFIG_SLATTACH is not set
949 CONFIG_SSL_CLIENT=y
950 # CONFIG_TC is not set
951 # CONFIG_FEATURE_TC_INGRESS is not set
952 # CONFIG_TCPSVD is not set
953 # CONFIG_UDPSVD is not set
954 # CONFIG_TELNET is not set
955 # CONFIG_FEATURE_TELNET_TTYPE is not set
956 # CONFIG_FEATURE_TELNET_AUTOLOGIN is not set
957 # CONFIG_FEATURE_TELNET_WIDTH is not set
958 # CONFIG_TELNETD is not set
959 # CONFIG_FEATURE_TELNETD_STANDALONE is not set
960 CONFIG_FEATURE_TELNETD_PORT_DEFAULT=0
961 # CONFIG_FEATURE_TELNETD_INETD_WAIT is not set
962 # CONFIG_TFTP is not set
963 # CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set
964 # CONFIG_FEATURE_TFTP_HPA_COMPAT is not set
965 # CONFIG_TFTPD is not set
966 # CONFIG_FEATURE_TFTP_GET is not set
967 # CONFIG_FEATURE_TFTP_PUT is not set
968 # CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
969 # CONFIG_TFTP_DEBUG is not set
970 CONFIG_TLS=y
971 # CONFIG_TRACEROUTE is not set
972 # CONFIG_TRACEROUTE6 is not set
973 # CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
974 # CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
975 # CONFIG_TUNCTL is not set
976 # CONFIG_FEATURE_TUNCTL_UG is not set
977 # CONFIG_VCONFIG is not set
978 CONFIG_WGET=y
979 CONFIG_FEATURE_WGET_LONG_OPTIONS=y
980 CONFIG_FEATURE_WGET_STATUSBAR=y
981 CONFIG_FEATURE_WGET_FTP=y
982 CONFIG_FEATURE_WGET_AUTHENTICATION=y
983 CONFIG_FEATURE_WGET_TIMEOUT=y
984 CONFIG_FEATURE_WGET_HTTPS=y
985 CONFIG_FEATURE_WGET_OPENSSL=y
986 CONFIG_WHOIS=y
987 # CONFIG_ZCIP is not set
988 # CONFIG_UDHCPD is not set
989 # CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set
990 # CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
991 CONFIG_DHCPD_LEASES_FILE=""
992 # CONFIG_DUMPLEASES is not set
993 # CONFIG_DHCPRELAY is not set
994 # CONFIG_UDHCPC is not set
995 # CONFIG_FEATURE_UDHCPC_ARPING is not set
996 # CONFIG_FEATURE_UDHCPC_SANITIZEOPT is not set
997 CONFIG_UDHCPC_DEFAULT_SCRIPT=""
998 # CONFIG_UDHCPC6 is not set
999 # CONFIG_FEATURE_UDHCPC6_RFC3646 is not set
1000 # CONFIG_FEATURE_UDHCPC6_RFC4704 is not set
1001 # CONFIG_FEATURE_UDHCPC6_RFC4833 is not set
1002 # CONFIG_FEATURE_UDHCPC6_RFC5970 is not set
1003 CONFIG_UDHCPC_DEFAULT_INTERFACE=""
1004 # CONFIG_FEATURE_UDHCP_PORT is not set
1005 CONFIG_UDHCP_DEBUG=0
1006 CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0
1007 # CONFIG_FEATURE_UDHCP_RFC3397 is not set
1008 # CONFIG_FEATURE_UDHCP_8021Q is not set
1009 CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS=""
1010
1011 #
1012 # Print Utilities
1013 #
1014 # CONFIG_LPD is not set
1015 # CONFIG_LPR is not set
1016 # CONFIG_LPQ is not set
1017
1018 #
1019 # Mail Utilities
1020 #
1021 CONFIG_FEATURE_MIME_CHARSET="utf-8"
1022 # CONFIG_MAKEMIME is not set
1023 # CONFIG_POPMAILDIR is not set
1024 # CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set
1025 # CONFIG_REFORMIME is not set
1026 # CONFIG_FEATURE_REFORMIME_COMPAT is not set
1027 CONFIG_SENDMAIL=y
1028
1029 #
1030 # Process Utilities
1031 #
1032 # CONFIG_FEATURE_FAST_TOP is not set
1033 CONFIG_FEATURE_SHOW_THREADS=y
1034 CONFIG_FREE=y
1035 CONFIG_FUSER=y
1036 CONFIG_IOSTAT=y
1037 CONFIG_KILL=y
1038 CONFIG_KILLALL=y
1039 # CONFIG_KILLALL5 is not set
1040 CONFIG_LSOF=y
1041 CONFIG_MPSTAT=y
1042 CONFIG_NMETER=y
1043 CONFIG_PGREP=y
1044 CONFIG_PKILL=y
1045 CONFIG_PIDOF=y
1046 CONFIG_FEATURE_PIDOF_SINGLE=y
1047 CONFIG_FEATURE_PIDOF_OMIT=y
1048 CONFIG_PMAP=y
1049 # CONFIG_POWERTOP is not set
1050 # CONFIG_FEATURE_POWERTOP_INTERACTIVE is not set
1051 CONFIG_PS=y
1052 # CONFIG_FEATURE_PS_WIDE is not set
1053 # CONFIG_FEATURE_PS_LONG is not set
1054 CONFIG_FEATURE_PS_TIME=y
1055 # CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set
1056 CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS=y
1057 CONFIG_PSTREE=y
1058 CONFIG_PWDX=y
1059 CONFIG_SMEMCAP=y
1060 CONFIG_BB_SYSCTL=y
1061 CONFIG_TOP=y
1062 CONFIG_FEATURE_TOP_INTERACTIVE=y
1063 CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y
1064 CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y
1065 CONFIG_FEATURE_TOP_SMP_CPU=y
1066 CONFIG_FEATURE_TOP_DECIMALS=y
1067 CONFIG_FEATURE_TOP_SMP_PROCESS=y
1068 CONFIG_FEATURE_TOPMEM=y
1069 CONFIG_UPTIME=y
1070 CONFIG_FEATURE_UPTIME_UTMP_SUPPORT=y
1071 CONFIG_WATCH=y
1072
1073 #
1074 # Runit Utilities
1075 #
1076 CONFIG_CHPST=y
1077 CONFIG_SETUIDGID=y
1078 CONFIG_ENVUIDGID=y
1079 CONFIG_ENVDIR=y
1080 CONFIG_SOFTLIMIT=y
1081 CONFIG_RUNSV=y
1082 CONFIG_RUNSVDIR=y
1083 # CONFIG_FEATURE_RUNSVDIR_LOG is not set
1084 CONFIG_SV=y
1085 CONFIG_SV_DEFAULT_SERVICE_DIR="/var/service"
1086 CONFIG_SVC=y
1087 CONFIG_SVOK=y
1088 CONFIG_SVLOGD=y
1089 # CONFIG_CHCON is not set
1090 # CONFIG_GETENFORCE is not set
1091 # CONFIG_GETSEBOOL is not set
1092 # CONFIG_LOAD_POLICY is not set
1093 # CONFIG_MATCHPATHCON is not set
1094 # CONFIG_RUNCON is not set
1095 # CONFIG_SELINUXENABLED is not set
1096 # CONFIG_SESTATUS is not set
1097 # CONFIG_SETENFORCE is not set
1098 # CONFIG_SETFILES is not set
1099 # CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set
1100 # CONFIG_RESTORECON is not set
1101 # CONFIG_SETSEBOOL is not set
1102
1103 #
1104 # Shells
1105 #
1106 CONFIG_SH_IS_ASH=y
1107 # CONFIG_SH_IS_HUSH is not set
1108 # CONFIG_SH_IS_NONE is not set
1109 # CONFIG_BASH_IS_ASH is not set
1110 # CONFIG_BASH_IS_HUSH is not set
1111 CONFIG_BASH_IS_NONE=y
1112 CONFIG_SHELL_ASH=y
1113 CONFIG_ASH=y
1114 CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
1115 CONFIG_ASH_INTERNAL_GLOB=y
1116 CONFIG_ASH_BASH_COMPAT=y
1117 # CONFIG_ASH_BASH_SOURCE_CURDIR is not set
1118 CONFIG_ASH_BASH_NOT_FOUND_HOOK=y
1119 CONFIG_ASH_JOB_CONTROL=y
1120 CONFIG_ASH_ALIAS=y
1121 CONFIG_ASH_RANDOM_SUPPORT=y
1122 CONFIG_ASH_EXPAND_PRMT=y
1123 CONFIG_ASH_IDLE_TIMEOUT=y
1124 CONFIG_ASH_MAIL=y
1125 CONFIG_ASH_ECHO=y
1126 CONFIG_ASH_PRINTF=y
1127 CONFIG_ASH_TEST=y
1128 CONFIG_ASH_HELP=y
1129 CONFIG_ASH_GETOPTS=y
1130 CONFIG_ASH_CMDCMD=y
1131 # CONFIG_CTTYHACK is not set
1132 # CONFIG_HUSH is not set
1133 # CONFIG_SHELL_HUSH is not set
1134 # CONFIG_HUSH_BASH_COMPAT is not set
1135 # CONFIG_HUSH_BRACE_EXPANSION is not set
1136 # CONFIG_HUSH_BASH_SOURCE_CURDIR is not set
1137 # CONFIG_HUSH_LINENO_VAR is not set
1138 # CONFIG_HUSH_INTERACTIVE is not set
1139 # CONFIG_HUSH_SAVEHISTORY is not set
1140 # CONFIG_HUSH_JOB is not set
1141 # CONFIG_HUSH_TICK is not set
1142 # CONFIG_HUSH_IF is not set
1143 # CONFIG_HUSH_LOOPS is not set
1144 # CONFIG_HUSH_CASE is not set
1145 # CONFIG_HUSH_FUNCTIONS is not set
1146 # CONFIG_HUSH_LOCAL is not set
1147 # CONFIG_HUSH_RANDOM_SUPPORT is not set
1148 # CONFIG_HUSH_MODE_X is not set
1149 # CONFIG_HUSH_ECHO is not set
1150 # CONFIG_HUSH_PRINTF is not set
1151 # CONFIG_HUSH_TEST is not set
1152 # CONFIG_HUSH_HELP is not set
1153 # CONFIG_HUSH_EXPORT is not set
1154 # CONFIG_HUSH_EXPORT_N is not set
1155 # CONFIG_HUSH_READONLY is not set
1156 # CONFIG_HUSH_KILL is not set
1157 # CONFIG_HUSH_WAIT is not set
1158 # CONFIG_HUSH_COMMAND is not set
1159 # CONFIG_HUSH_TRAP is not set
1160 # CONFIG_HUSH_TYPE is not set
1161 # CONFIG_HUSH_TIMES is not set
1162 # CONFIG_HUSH_READ is not set
1163 # CONFIG_HUSH_SET is not set
1164 # CONFIG_HUSH_UNSET is not set
1165 # CONFIG_HUSH_ULIMIT is not set
1166 # CONFIG_HUSH_UMASK is not set
1167 # CONFIG_HUSH_GETOPTS is not set
1168 # CONFIG_HUSH_MEMLEAK is not set
1169
1170 #
1171 # Options common to all shells
1172 #
1173 CONFIG_FEATURE_SH_MATH=y
1174 CONFIG_FEATURE_SH_MATH_64=y
1175 CONFIG_FEATURE_SH_MATH_BASE=y
1176 CONFIG_FEATURE_SH_EXTRA_QUIET=y
1177 # CONFIG_FEATURE_SH_STANDALONE is not set
1178 # CONFIG_FEATURE_SH_NOFORK is not set
1179 CONFIG_FEATURE_SH_READ_FRAC=y
1180 CONFIG_FEATURE_SH_HISTFILESIZE=y
1181 CONFIG_FEATURE_SH_EMBEDDED_SCRIPTS=y
1182
1183 #
1184 # System Logging Utilities
1185 #
1186 # CONFIG_KLOGD is not set
1187 # CONFIG_FEATURE_KLOGD_KLOGCTL is not set
1188 # CONFIG_LOGGER is not set
1189 # CONFIG_LOGREAD is not set
1190 # CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set
1191 # CONFIG_SYSLOGD is not set
1192 # CONFIG_FEATURE_ROTATE_LOGFILE is not set
1193 # CONFIG_FEATURE_REMOTE_LOG is not set
1194 # CONFIG_FEATURE_SYSLOGD_DUP is not set
1195 # CONFIG_FEATURE_SYSLOGD_CFG is not set
1196 # CONFIG_FEATURE_SYSLOGD_PRECISE_TIMESTAMPS is not set
1197 CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=0
1198 # CONFIG_FEATURE_IPC_SYSLOG is not set
1199 CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=0
1200 # CONFIG_FEATURE_KMSG_SYSLOG is not set
+232 -88
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -53,10 +53,19 @@
5353
*/
5454
#if !defined(SQLITE_OS_WINRT)
5555
# define SQLITE_OS_WINRT 0
5656
#endif
5757
58
+/*
59
+** If SQLITE_SHELL_FIDDLE is defined then the shell is modified
60
+** somewhat for use as a WASM module in a web browser. This flag
61
+** should only be used when building the "fiddle" web application, as
62
+** the browser-mode build has much different user input requirements
63
+** and this build mode rewires the user input subsystem to account for
64
+** that.
65
+*/
66
+
5867
/*
5968
** Warning pragmas copied from msvc.h in the core.
6069
*/
6170
#if defined(_MSC_VER)
6271
#pragma warning(disable : 4054)
@@ -245,21 +254,10 @@
245254
#else
246255
# define setBinaryMode(X,Y)
247256
# define setTextMode(X,Y)
248257
#endif
249258
250
-/*
251
-** When compiling with emcc (a.k.a. emscripten), we're building a
252
-** WebAssembly (WASM) bundle and need to disable and rewire a few
253
-** things.
254
-*/
255
-#ifdef __EMSCRIPTEN__
256
-#define SQLITE_SHELL_WASM_MODE
257
-#else
258
-#undef SQLITE_SHELL_WASM_MODE
259
-#endif
260
-
261259
/* True if the timer is enabled */
262260
static int enableTimer = 0;
263261
264262
/* Return the current wall-clock time */
265263
static sqlite3_int64 timeOfDay(void){
@@ -717,11 +715,11 @@
717715
**
718716
** The result is stored in space obtained from malloc() and must either
719717
** be freed by the caller or else passed back into this routine via the
720718
** zPrior argument for reuse.
721719
*/
722
-#ifndef SQLITE_SHELL_WASM_MODE
720
+#ifndef SQLITE_SHELL_FIDDLE
723721
static char *one_input_line(FILE *in, char *zPrior, int isContinuation){
724722
char *zPrompt;
725723
char *zResult;
726724
if( in!=0 ){
727725
zResult = local_getline(zPrior, in);
@@ -737,11 +735,11 @@
737735
if( zResult && *zResult ) shell_add_history(zResult);
738736
#endif
739737
}
740738
return zResult;
741739
}
742
-#endif /* !SQLITE_SHELL_WASM_MODE */
740
+#endif /* !SQLITE_SHELL_FIDDLE */
743741
744742
/*
745743
** Return the value of a hexadecimal digit. Return -1 if the input
746744
** is not a hex digit.
747745
*/
@@ -3794,10 +3792,11 @@
37943792
#define re_compile sqlite3re_compile
37953793
#define re_free sqlite3re_free
37963794
37973795
/* The end-of-input character */
37983796
#define RE_EOF 0 /* End of input */
3797
+#define RE_START 0xfffffff /* Start of input - larger than an UTF-8 */
37993798
38003799
/* The NFA is implemented as sequence of opcodes taken from the following
38013800
** set. Each opcode has a single integer argument.
38023801
*/
38033802
#define RE_OP_MATCH 1 /* Match the one character in the argument */
@@ -3815,10 +3814,37 @@
38153814
#define RE_OP_DIGIT 13 /* digit: [0-9] */
38163815
#define RE_OP_NOTDIGIT 14 /* Not a digit */
38173816
#define RE_OP_SPACE 15 /* space: [ \t\n\r\v\f] */
38183817
#define RE_OP_NOTSPACE 16 /* Not a digit */
38193818
#define RE_OP_BOUNDARY 17 /* Boundary between word and non-word */
3819
+#define RE_OP_ATSTART 18 /* Currently at the start of the string */
3820
+
3821
+#if defined(SQLITE_DEBUG)
3822
+/* Opcode names used for symbolic debugging */
3823
+static const char *ReOpName[] = {
3824
+ "EOF",
3825
+ "MATCH",
3826
+ "ANY",
3827
+ "ANYSTAR",
3828
+ "FORK",
3829
+ "GOTO",
3830
+ "ACCEPT",
3831
+ "CC_INC",
3832
+ "CC_EXC",
3833
+ "CC_VALUE",
3834
+ "CC_RANGE",
3835
+ "WORD",
3836
+ "NOTWORD",
3837
+ "DIGIT",
3838
+ "NOTDIGIT",
3839
+ "SPACE",
3840
+ "NOTSPACE",
3841
+ "BOUNDARY",
3842
+ "ATSTART",
3843
+};
3844
+#endif /* SQLITE_DEBUG */
3845
+
38203846
38213847
/* Each opcode is a "state" in the NFA */
38223848
typedef unsigned short ReStateNumber;
38233849
38243850
/* Because this is an NFA and not a DFA, multiple states can be active at
@@ -3849,11 +3875,11 @@
38493875
const char *zErr; /* Error message to return */
38503876
char *aOp; /* Operators for the virtual machine */
38513877
int *aArg; /* Arguments to each operator */
38523878
unsigned (*xNextChar)(ReInput*); /* Next character function */
38533879
unsigned char zInit[12]; /* Initial text to match */
3854
- int nInit; /* Number of characters in zInit */
3880
+ int nInit; /* Number of bytes in zInit */
38553881
unsigned nState; /* Number of entries in aOp[] and aArg[] */
38563882
unsigned nAlloc; /* Slots allocated for aOp[] and aArg[] */
38573883
};
38583884
38593885
/* Add a state to the given state set if it is not already there */
@@ -3922,11 +3948,11 @@
39223948
ReStateSet aStateSet[2], *pThis, *pNext;
39233949
ReStateNumber aSpace[100];
39243950
ReStateNumber *pToFree;
39253951
unsigned int i = 0;
39263952
unsigned int iSwap = 0;
3927
- int c = RE_EOF+1;
3953
+ int c = RE_START;
39283954
int cPrev = 0;
39293955
int rc = 0;
39303956
ReInput in;
39313957
39323958
in.z = zIn;
@@ -3941,10 +3967,11 @@
39413967
strncmp((const char*)zIn+in.i, (const char*)pRe->zInit, pRe->nInit)!=0)
39423968
){
39433969
in.i++;
39443970
}
39453971
if( in.i+pRe->nInit>in.mx ) return 0;
3972
+ c = RE_START-1;
39463973
}
39473974
39483975
if( pRe->nState<=(sizeof(aSpace)/(sizeof(aSpace[0])*2)) ){
39493976
pToFree = 0;
39503977
aStateSet[0].aState = aSpace;
@@ -3968,10 +3995,14 @@
39683995
int x = pThis->aState[i];
39693996
switch( pRe->aOp[x] ){
39703997
case RE_OP_MATCH: {
39713998
if( pRe->aArg[x]==c ) re_add_state(pNext, x+1);
39723999
break;
4000
+ }
4001
+ case RE_OP_ATSTART: {
4002
+ if( cPrev==RE_START ) re_add_state(pThis, x+1);
4003
+ break;
39734004
}
39744005
case RE_OP_ANY: {
39754006
if( c!=0 ) re_add_state(pNext, x+1);
39764007
break;
39774008
}
@@ -4050,11 +4081,13 @@
40504081
}
40514082
}
40524083
}
40534084
}
40544085
for(i=0; i<pNext->nState; i++){
4055
- if( pRe->aOp[pNext->aState[i]]==RE_OP_ACCEPT ){ rc = 1; break; }
4086
+ int x = pNext->aState[i];
4087
+ while( pRe->aOp[x]==RE_OP_GOTO ) x += pRe->aArg[x];
4088
+ if( pRe->aOp[x]==RE_OP_ACCEPT ){ rc = 1; break; }
40564089
}
40574090
re_match_end:
40584091
sqlite3_free(pToFree);
40594092
return rc;
40604093
}
@@ -4205,11 +4238,10 @@
42054238
const char *zErr;
42064239
while( (c = p->xNextChar(&p->sIn))!=0 ){
42074240
iStart = p->nState;
42084241
switch( c ){
42094242
case '|':
4210
- case '$':
42114243
case ')': {
42124244
p->sIn.i--;
42134245
return 0;
42144246
}
42154247
case '(': {
@@ -4241,10 +4273,18 @@
42414273
}
42424274
case '?': {
42434275
if( iPrev<0 ) return "'?' without operand";
42444276
re_insert(p, iPrev, RE_OP_FORK, p->nState - iPrev+1);
42454277
break;
4278
+ }
4279
+ case '$': {
4280
+ re_append(p, RE_OP_MATCH, RE_EOF);
4281
+ break;
4282
+ }
4283
+ case '^': {
4284
+ re_append(p, RE_OP_ATSTART, 0);
4285
+ break;
42464286
}
42474287
case '{': {
42484288
int m = 0, n = 0;
42494289
int sz, j;
42504290
if( iPrev<0 ) return "'{m,n}' without operand";
@@ -4260,10 +4300,11 @@
42604300
p->sIn.i++;
42614301
sz = p->nState - iPrev;
42624302
if( m==0 ){
42634303
if( n==0 ) return "both m and n are zero in '{m,n}'";
42644304
re_insert(p, iPrev, RE_OP_FORK, sz+1);
4305
+ iPrev++;
42654306
n--;
42664307
}else{
42674308
for(j=1; j<m; j++) re_copy(p, iPrev, sz);
42684309
}
42694310
for(j=m; j<n; j++){
@@ -4378,15 +4419,11 @@
43784419
zErr = re_subcompile_re(pRe);
43794420
if( zErr ){
43804421
re_free(pRe);
43814422
return zErr;
43824423
}
4383
- if( rePeek(pRe)=='$' && pRe->sIn.i+1>=pRe->sIn.mx ){
4384
- re_append(pRe, RE_OP_MATCH, RE_EOF);
4385
- re_append(pRe, RE_OP_ACCEPT, 0);
4386
- *ppRe = pRe;
4387
- }else if( pRe->sIn.i>=pRe->sIn.mx ){
4424
+ if( pRe->sIn.i>=pRe->sIn.mx ){
43884425
re_append(pRe, RE_OP_ACCEPT, 0);
43894426
*ppRe = pRe;
43904427
}else{
43914428
re_free(pRe);
43924429
return "unrecognized character";
@@ -4465,10 +4502,71 @@
44654502
}
44664503
if( setAux ){
44674504
sqlite3_set_auxdata(context, 0, pRe, (void(*)(void*))re_free);
44684505
}
44694506
}
4507
+
4508
+#if defined(SQLITE_DEBUG)
4509
+/*
4510
+** This function is used for testing and debugging only. It is only available
4511
+** if the SQLITE_DEBUG compile-time option is used.
4512
+**
4513
+** Compile a regular expression and then convert the compiled expression into
4514
+** text and return that text.
4515
+*/
4516
+static void re_bytecode_func(
4517
+ sqlite3_context *context,
4518
+ int argc,
4519
+ sqlite3_value **argv
4520
+){
4521
+ const char *zPattern;
4522
+ const char *zErr;
4523
+ ReCompiled *pRe;
4524
+ sqlite3_str *pStr;
4525
+ int i;
4526
+ int n;
4527
+ char *z;
4528
+
4529
+ zPattern = (const char*)sqlite3_value_text(argv[0]);
4530
+ if( zPattern==0 ) return;
4531
+ zErr = re_compile(&pRe, zPattern, sqlite3_user_data(context)!=0);
4532
+ if( zErr ){
4533
+ re_free(pRe);
4534
+ sqlite3_result_error(context, zErr, -1);
4535
+ return;
4536
+ }
4537
+ if( pRe==0 ){
4538
+ sqlite3_result_error_nomem(context);
4539
+ return;
4540
+ }
4541
+ pStr = sqlite3_str_new(0);
4542
+ if( pStr==0 ) goto re_bytecode_func_err;
4543
+ if( pRe->nInit>0 ){
4544
+ sqlite3_str_appendf(pStr, "INIT ");
4545
+ for(i=0; i<pRe->nInit; i++){
4546
+ sqlite3_str_appendf(pStr, "%02x", pRe->zInit[i]);
4547
+ }
4548
+ sqlite3_str_appendf(pStr, "\n");
4549
+ }
4550
+ for(i=0; (unsigned)i<pRe->nState; i++){
4551
+ sqlite3_str_appendf(pStr, "%-8s %4d\n",
4552
+ ReOpName[(unsigned char)pRe->aOp[i]], pRe->aArg[i]);
4553
+ }
4554
+ n = sqlite3_str_length(pStr);
4555
+ z = sqlite3_str_finish(pStr);
4556
+ if( n==0 ){
4557
+ sqlite3_free(z);
4558
+ }else{
4559
+ sqlite3_result_text(context, z, n-1, sqlite3_free);
4560
+ }
4561
+
4562
+re_bytecode_func_err:
4563
+ re_free(pRe);
4564
+}
4565
+
4566
+#endif /* SQLITE_DEBUG */
4567
+
44704568
44714569
/*
44724570
** Invoke this routine to register the regexp() function with the
44734571
** SQLite database connection.
44744572
*/
@@ -4490,16 +4588,23 @@
44904588
/* The regexpi(PATTERN,STRING) function is a case-insensitive version
44914589
** of regexp(PATTERN,STRING). */
44924590
rc = sqlite3_create_function(db, "regexpi", 2,
44934591
SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
44944592
(void*)db, re_sql_func, 0, 0);
4593
+#if defined(SQLITE_DEBUG)
4594
+ if( rc==SQLITE_OK ){
4595
+ rc = sqlite3_create_function(db, "regexp_bytecode", 1,
4596
+ SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
4597
+ 0, re_bytecode_func, 0, 0);
4598
+ }
4599
+#endif /* SQLITE_DEBUG */
44954600
}
44964601
return rc;
44974602
}
44984603
44994604
/************************* End ../ext/misc/regexp.c ********************/
4500
-#ifndef SQLITE_SHELL_WASM_MODE
4605
+#ifndef SQLITE_SHELL_FIDDLE
45014606
/************************* Begin ../ext/misc/fileio.c ******************/
45024607
/*
45034608
** 2014-06-13
45044609
**
45054610
** The author disclaims copyright to this source code. In place of
@@ -10047,10 +10152,14 @@
1004710152
** Return true if zId must be quoted in order to use it as an SQL
1004810153
** identifier, or false otherwise.
1004910154
*/
1005010155
static int idxIdentifierRequiresQuotes(const char *zId){
1005110156
int i;
10157
+ int nId = STRLEN(zId);
10158
+
10159
+ if( sqlite3_keyword_check(zId, nId) ) return 1;
10160
+
1005210161
for(i=0; zId[i]; i++){
1005310162
if( !(zId[i]=='_')
1005410163
&& !(zId[i]>='0' && zId[i]<='9')
1005510164
&& !(zId[i]>='a' && zId[i]<='z')
1005610165
&& !(zId[i]>='A' && zId[i]<='Z')
@@ -12248,19 +12357,19 @@
1224812357
int nIndent; /* Size of array aiIndent[] */
1224912358
int iIndent; /* Index of current op in aiIndent[] */
1225012359
char *zNonce; /* Nonce for temporary safe-mode excapes */
1225112360
EQPGraph sGraph; /* Information for the graphical EXPLAIN QUERY PLAN */
1225212361
ExpertInfo expert; /* Valid if previous command was ".expert OPT..." */
12253
-#ifdef SQLITE_SHELL_WASM_MODE
12362
+#ifdef SQLITE_SHELL_FIDDLE
1225412363
struct {
1225512364
const char * zInput; /* Input string from wasm/JS proxy */
1225612365
const char * zPos; /* Cursor pos into zInput */
1225712366
} wasm;
1225812367
#endif
1225912368
};
1226012369
12261
-#ifdef SQLITE_SHELL_WASM_MODE
12370
+#ifdef SQLITE_SHELL_FIDDLE
1226212371
static ShellState shellState;
1226312372
#endif
1226412373
1226512374
1226612375
/* Allowed values for ShellState.autoEQP
@@ -12588,14 +12697,27 @@
1258812697
/*
1258912698
** Output the given string as a hex-encoded blob (eg. X'1234' )
1259012699
*/
1259112700
static void output_hex_blob(FILE *out, const void *pBlob, int nBlob){
1259212701
int i;
12593
- char *zBlob = (char *)pBlob;
12594
- raw_printf(out,"X'");
12595
- for(i=0; i<nBlob; i++){ raw_printf(out,"%02x",zBlob[i]&0xff); }
12596
- raw_printf(out,"'");
12702
+ unsigned char *aBlob = (unsigned char*)pBlob;
12703
+
12704
+ char *zStr = sqlite3_malloc(nBlob*2 + 1);
12705
+ shell_check_oom(zStr);
12706
+
12707
+ for(i=0; i<nBlob; i++){
12708
+ static const char aHex[] = {
12709
+ '0', '1', '2', '3', '4', '5', '6', '7',
12710
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
12711
+ };
12712
+ zStr[i*2] = aHex[ (aBlob[i] >> 4) ];
12713
+ zStr[i*2+1] = aHex[ (aBlob[i] & 0x0F) ];
12714
+ }
12715
+ zStr[i*2] = '\0';
12716
+
12717
+ raw_printf(out,"X'%s'", zStr);
12718
+ sqlite3_free(zStr);
1259712719
}
1259812720
1259912721
/*
1260012722
** Find a string that is not found anywhere in z[]. Return a pointer
1260112723
** to that string.
@@ -12924,11 +13046,11 @@
1292413046
UNUSED_PARAMETER(zA2);
1292513047
UNUSED_PARAMETER(zA3);
1292613048
UNUSED_PARAMETER(zA4);
1292713049
switch( op ){
1292813050
case SQLITE_ATTACH: {
12929
-#ifndef SQLITE_SHELL_WASM_MODE
13051
+#ifndef SQLITE_SHELL_FIDDLE
1293013052
/* In WASM builds the filesystem is a virtual sandbox, so
1293113053
** there's no harm in using ATTACH. */
1293213054
failIfSafeMode(p, "cannot run ATTACH in safe mode");
1293313055
#endif
1293413056
break;
@@ -12997,19 +13119,41 @@
1299713119
/*
1299813120
** Print a schema statement. Part of MODE_Semi and MODE_Pretty output.
1299913121
**
1300013122
** This routine converts some CREATE TABLE statements for shadow tables
1300113123
** in FTS3/4/5 into CREATE TABLE IF NOT EXISTS statements.
13124
+**
13125
+** If the schema statement in z[] contains a start-of-comment and if
13126
+** sqlite3_complete() returns false, try to terminate the comment before
13127
+** printing the result. https://sqlite.org/forum/forumpost/d7be961c5c
1300213128
*/
1300313129
static void printSchemaLine(FILE *out, const char *z, const char *zTail){
13130
+ char *zToFree = 0;
1300413131
if( z==0 ) return;
1300513132
if( zTail==0 ) return;
13133
+ if( zTail[0]==';' && (strstr(z, "/*")!=0 || strstr(z,"--")!=0) ){
13134
+ const char *zOrig = z;
13135
+ static const char *azTerm[] = { "", "*/", "\n" };
13136
+ int i;
13137
+ for(i=0; i<ArraySize(azTerm); i++){
13138
+ char *zNew = sqlite3_mprintf("%s%s;", zOrig, azTerm[i]);
13139
+ if( sqlite3_complete(zNew) ){
13140
+ size_t n = strlen(zNew);
13141
+ zNew[n-1] = 0;
13142
+ zToFree = zNew;
13143
+ z = zNew;
13144
+ break;
13145
+ }
13146
+ sqlite3_free(zNew);
13147
+ }
13148
+ }
1300613149
if( sqlite3_strglob("CREATE TABLE ['\"]*", z)==0 ){
1300713150
utf8_printf(out, "CREATE TABLE IF NOT EXISTS %s%s", z+13, zTail);
1300813151
}else{
1300913152
utf8_printf(out, "%s%s", z, zTail);
1301013153
}
13154
+ sqlite3_free(zToFree);
1301113155
}
1301213156
static void printSchemaLineN(FILE *out, char *z, int n, const char *zTail){
1301313157
char c = z[n];
1301413158
z[n] = 0;
1301513159
printSchemaLine(out, z, zTail);
@@ -15338,11 +15482,11 @@
1533815482
** There must be two or more spaces between the end of the command and the
1533915483
** start of the description of what that command does.
1534015484
*/
1534115485
static const char *(azHelp[]) = {
1534215486
#if defined(SQLITE_HAVE_ZLIB) && !defined(SQLITE_OMIT_VIRTUALTABLE) \
15343
- && !defined(SQLITE_SHELL_WASM_MODE)
15487
+ && !defined(SQLITE_SHELL_FIDDLE)
1534415488
".archive ... Manage SQL archives",
1534515489
" Each command must have exactly one of the following options:",
1534615490
" -c, --create Create a new archive",
1534715491
" -u, --update Add or update files with changed mtime",
1534815492
" -i, --insert Like -u but always add even if unchanged",
@@ -15364,23 +15508,23 @@
1536415508
" http://sqlite.org/cli.html#sqlite_archive_support",
1536515509
#endif
1536615510
#ifndef SQLITE_OMIT_AUTHORIZATION
1536715511
".auth ON|OFF Show authorizer callbacks",
1536815512
#endif
15369
-#ifndef SQLITE_SHELL_WASM_MODE
15513
+#ifndef SQLITE_SHELL_FIDDLE
1537015514
".backup ?DB? FILE Backup DB (default \"main\") to FILE",
1537115515
" Options:",
1537215516
" --append Use the appendvfs",
1537315517
" --async Write to FILE without journal and fsync()",
1537415518
#endif
1537515519
".bail on|off Stop after hitting an error. Default OFF",
1537615520
".binary on|off Turn binary output on or off. Default OFF",
15377
-#ifndef SQLITE_SHELL_WASM_MODE
15521
+#ifndef SQLITE_SHELL_FIDDLE
1537815522
".cd DIRECTORY Change the working directory to DIRECTORY",
1537915523
#endif
1538015524
".changes on|off Show number of rows changed by SQL",
15381
-#ifndef SQLITE_SHELL_WASM_MODE
15525
+#ifndef SQLITE_SHELL_FIDDLE
1538215526
".check GLOB Fail if output since .testcase does not match",
1538315527
".clone NEWDB Clone data into NEWDB from the existing database",
1538415528
#endif
1538515529
".connection [close] [#] Open or close an auxiliary database connection",
1538615530
".databases List names and files of attached databases",
@@ -15402,15 +15546,15 @@
1540215546
#ifdef SQLITE_DEBUG
1540315547
" test Show raw EXPLAIN QUERY PLAN output",
1540415548
" trace Like \"full\" but enable \"PRAGMA vdbe_trace\"",
1540515549
#endif
1540615550
" trigger Like \"full\" but also show trigger bytecode",
15407
-#ifndef SQLITE_SHELL_WASM_MODE
15551
+#ifndef SQLITE_SHELL_FIDDLE
1540815552
".excel Display the output of next command in spreadsheet",
1540915553
" --bom Put a UTF8 byte-order mark on intermediate file",
1541015554
#endif
15411
-#ifndef SQLITE_SHELL_WASM_MODE
15555
+#ifndef SQLITE_SHELL_FIDDLE
1541215556
".exit ?CODE? Exit this program with return-code CODE",
1541315557
#endif
1541415558
".expert EXPERIMENTAL. Suggest indexes for queries",
1541515559
".explain ?on|off|auto? Change the EXPLAIN formatting mode. Default: auto",
1541615560
".filectrl CMD ... Run various sqlite3_file_control() operations",
@@ -15417,11 +15561,11 @@
1541715561
" --schema SCHEMA Use SCHEMA instead of \"main\"",
1541815562
" --help Show CMD details",
1541915563
".fullschema ?--indent? Show schema and the content of sqlite_stat tables",
1542015564
".headers on|off Turn display of headers on or off",
1542115565
".help ?-all? ?PATTERN? Show help text for PATTERN",
15422
-#ifndef SQLITE_SHELL_WASM_MODE
15566
+#ifndef SQLITE_SHELL_FIDDLE
1542315567
".import FILE TABLE Import data from FILE into TABLE",
1542415568
" Options:",
1542515569
" --ascii Use \\037 and \\036 as column and row separators",
1542615570
" --csv Use , and \\n as column and row separators",
1542715571
" --skip N Skip the first N rows of input",
@@ -15446,14 +15590,14 @@
1544615590
#endif
1544715591
".limit ?LIMIT? ?VAL? Display or change the value of an SQLITE_LIMIT",
1544815592
".lint OPTIONS Report potential schema issues.",
1544915593
" Options:",
1545015594
" fkey-indexes Find missing foreign key indexes",
15451
-#if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_WASM_MODE)
15595
+#if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_FIDDLE)
1545215596
".load FILE ?ENTRY? Load an extension library",
1545315597
#endif
15454
-#ifndef SQLITE_SHELL_WASM_MODE
15598
+#ifndef SQLITE_SHELL_FIDDLE
1545515599
".log FILE|off Turn logging on or off. FILE can be stderr/stdout",
1545615600
#endif
1545715601
".mode MODE ?OPTIONS? Set output mode",
1545815602
" MODE is one of:",
1545915603
" ascii Columns/rows delimited by 0x1F and 0x1E",
@@ -15476,15 +15620,15 @@
1547615620
" --wordwrap B Wrap or not at word boundaries per B (on/off)",
1547715621
" --ww Shorthand for \"--wordwrap 1\"",
1547815622
" --quote Quote output text as SQL literals",
1547915623
" --noquote Do not quote output text",
1548015624
" TABLE The name of SQL table used for \"insert\" mode",
15481
-#ifndef SQLITE_SHELL_WASM_MODE
15625
+#ifndef SQLITE_SHELL_FIDDLE
1548215626
".nonce STRING Suspend safe mode for one command if nonce matches",
1548315627
#endif
1548415628
".nullvalue STRING Use STRING in place of NULL values",
15485
-#ifndef SQLITE_SHELL_WASM_MODE
15629
+#ifndef SQLITE_SHELL_FIDDLE
1548615630
".once ?OPTIONS? ?FILE? Output for the next SQL command only to FILE",
1548715631
" If FILE begins with '|' then open as a pipe",
1548815632
" --bom Put a UTF8 byte-order mark at the beginning",
1548915633
" -e Send output to the system text editor",
1549015634
" -x Send output as CSV to a spreadsheet (same as \".excel\")",
@@ -15502,11 +15646,11 @@
1550215646
#endif
1550315647
" --new Initialize FILE to an empty database",
1550415648
" --nofollow Do not follow symbolic links",
1550515649
" --readonly Open FILE readonly",
1550615650
" --zip FILE is a ZIP archive",
15507
-#ifndef SQLITE_SHELL_WASM_MODE
15651
+#ifndef SQLITE_SHELL_FIDDLE
1550815652
".output ?FILE? Send output to FILE or stdout if FILE is omitted",
1550915653
" If FILE begins with '|' then open it as a pipe.",
1551015654
" Options:",
1551115655
" --bom Prefix output with a UTF8 byte-order mark",
1551215656
" -e Send output to the system text editor",
@@ -15526,11 +15670,11 @@
1552615670
" --once Do no more than one progress interrupt",
1552715671
" --quiet|-q No output except at interrupts",
1552815672
" --reset Reset the count for each input and interrupt",
1552915673
#endif
1553015674
".prompt MAIN CONTINUE Replace the standard prompts",
15531
-#ifndef SQLITE_SHELL_WASM_MODE
15675
+#ifndef SQLITE_SHELL_FIDDLE
1553215676
".quit Exit this program",
1553315677
".read FILE Read input from FILE or command output",
1553415678
" If FILE begins with \"|\", it is a command that generates the input.",
1553515679
#endif
1553615680
#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
@@ -15539,11 +15683,11 @@
1553915683
" --recovery-db NAME Store recovery metadata in database file NAME",
1554015684
" --lost-and-found TABLE Alternative name for the lost-and-found table",
1554115685
" --no-rowids Do not attempt to recover rowid values",
1554215686
" that are not also INTEGER PRIMARY KEYs",
1554315687
#endif
15544
-#ifndef SQLITE_SHELL_WASM_MODE
15688
+#ifndef SQLITE_SHELL_FIDDLE
1554515689
".restore ?DB? FILE Restore content of DB (default \"main\") from FILE",
1554615690
".save ?OPTIONS? FILE Write database to FILE (an alias for .backup ...)",
1554715691
#endif
1554815692
".scanstats on|off Turn sqlite3_stmt_scanstatus() metrics on or off",
1554915693
".schema ?PATTERN? Show the CREATE statements matching PATTERN",
@@ -15576,24 +15720,24 @@
1557615720
" --sha3-224 Use the sha3-224 algorithm",
1557715721
" --sha3-256 Use the sha3-256 algorithm (default)",
1557815722
" --sha3-384 Use the sha3-384 algorithm",
1557915723
" --sha3-512 Use the sha3-512 algorithm",
1558015724
" Any other argument is a LIKE pattern for tables to hash",
15581
-#if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_WASM_MODE)
15725
+#if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_FIDDLE)
1558215726
".shell CMD ARGS... Run CMD ARGS... in a system shell",
1558315727
#endif
1558415728
".show Show the current values for various settings",
1558515729
".stats ?ARG? Show stats or turn stats on or off",
1558615730
" off Turn off automatic stat display",
1558715731
" on Turn on automatic stat display",
1558815732
" stmt Show statement stats",
1558915733
" vmstep Show the virtual machine step count only",
15590
-#if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_WASM_MODE)
15734
+#if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_FIDDLE)
1559115735
".system CMD ARGS... Run CMD ARGS... in a system shell",
1559215736
#endif
1559315737
".tables ?TABLE? List names of tables matching LIKE pattern TABLE",
15594
-#ifndef SQLITE_SHELL_WASM_MODE
15738
+#ifndef SQLITE_SHELL_FIDDLE
1559515739
".testcase NAME Begin redirecting output to 'testcase-out.txt'",
1559615740
#endif
1559715741
".testctrl CMD ... Run various sqlite3_test_control() operations",
1559815742
" Run \".testctrl\" with no arguments for details",
1559915743
".timeout MS Try opening locked tables for MS milliseconds",
@@ -16142,11 +16286,11 @@
1614216286
sqlite3_uint_init(p->db, 0, 0);
1614316287
sqlite3_decimal_init(p->db, 0, 0);
1614416288
sqlite3_regexp_init(p->db, 0, 0);
1614516289
sqlite3_ieee_init(p->db, 0, 0);
1614616290
sqlite3_series_init(p->db, 0, 0);
16147
-#ifndef SQLITE_SHELL_WASM_MODE
16291
+#ifndef SQLITE_SHELL_FIDDLE
1614816292
sqlite3_fileio_init(p->db, 0, 0);
1614916293
sqlite3_completion_init(p->db, 0, 0);
1615016294
#endif
1615116295
#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
1615216296
sqlite3_dbdata_init(p->db, 0, 0);
@@ -19272,19 +19416,19 @@
1927219416
}
1927319417
}else
1927419418
#endif
1927519419
1927619420
#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) \
19277
- && !defined(SQLITE_SHELL_WASM_MODE)
19421
+ && !defined(SQLITE_SHELL_FIDDLE)
1927819422
if( c=='a' && strncmp(azArg[0], "archive", n)==0 ){
1927919423
open_db(p, 0);
1928019424
failIfSafeMode(p, "cannot run .archive in safe mode");
1928119425
rc = arDotCommand(p, 0, azArg, nArg);
1928219426
}else
1928319427
#endif
1928419428
19285
-#ifndef SQLITE_SHELL_WASM_MODE
19429
+#ifndef SQLITE_SHELL_FIDDLE
1928619430
if( (c=='b' && n>=3 && strncmp(azArg[0], "backup", n)==0)
1928719431
|| (c=='s' && n>=3 && strncmp(azArg[0], "save", n)==0)
1928819432
){
1928919433
const char *zDestFile = 0;
1929019434
const char *zDb = 0;
@@ -19349,11 +19493,11 @@
1934919493
utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(pDest));
1935019494
rc = 1;
1935119495
}
1935219496
close_db(pDest);
1935319497
}else
19354
-#endif /* !defined(SQLITE_SHELL_WASM_MODE) */
19498
+#endif /* !defined(SQLITE_SHELL_FIDDLE) */
1935519499
1935619500
if( c=='b' && n>=3 && strncmp(azArg[0], "bail", n)==0 ){
1935719501
if( nArg==2 ){
1935819502
bail_on_error = booleanValue(azArg[1]);
1935919503
}else{
@@ -19380,11 +19524,11 @@
1938019524
*/
1938119525
if( c=='b' && n>=3 && strncmp(azArg[0], "breakpoint", n)==0 ){
1938219526
test_breakpoint();
1938319527
}else
1938419528
19385
-#ifndef SQLITE_SHELL_WASM_MODE
19529
+#ifndef SQLITE_SHELL_FIDDLE
1938619530
if( c=='c' && strcmp(azArg[0],"cd")==0 ){
1938719531
failIfSafeMode(p, "cannot run .cd in safe mode");
1938819532
if( nArg==2 ){
1938919533
#if defined(_WIN32) || defined(WIN32)
1939019534
wchar_t *z = sqlite3_win32_utf8_to_unicode(azArg[1]);
@@ -19400,11 +19544,11 @@
1940019544
}else{
1940119545
raw_printf(stderr, "Usage: .cd DIRECTORY\n");
1940219546
rc = 1;
1940319547
}
1940419548
}else
19405
-#endif /* !defined(SQLITE_SHELL_WASM_MODE) */
19549
+#endif /* !defined(SQLITE_SHELL_FIDDLE) */
1940619550
1940719551
if( c=='c' && n>=3 && strncmp(azArg[0], "changes", n)==0 ){
1940819552
if( nArg==2 ){
1940919553
setOrClearFlag(p, SHFLG_CountChanges, azArg[1]);
1941019554
}else{
@@ -19411,11 +19555,11 @@
1941119555
raw_printf(stderr, "Usage: .changes on|off\n");
1941219556
rc = 1;
1941319557
}
1941419558
}else
1941519559
19416
-#ifndef SQLITE_SHELL_WASM_MODE
19560
+#ifndef SQLITE_SHELL_FIDDLE
1941719561
/* Cancel output redirection, if it is currently set (by .testcase)
1941819562
** Then read the content of the testcase-out.txt file and compare against
1941919563
** azArg[1]. If there are differences, report an error and exit.
1942019564
*/
1942119565
if( c=='c' && n>=3 && strncmp(azArg[0], "check", n)==0 ){
@@ -19436,23 +19580,23 @@
1943619580
utf8_printf(stdout, "testcase-%s ok\n", p->zTestcase);
1943719581
p->nCheck++;
1943819582
}
1943919583
sqlite3_free(zRes);
1944019584
}else
19441
-#endif /* !defined(SQLITE_SHELL_WASM_MODE) */
19585
+#endif /* !defined(SQLITE_SHELL_FIDDLE) */
1944219586
19443
-#ifndef SQLITE_SHELL_WASM_MODE
19587
+#ifndef SQLITE_SHELL_FIDDLE
1944419588
if( c=='c' && strncmp(azArg[0], "clone", n)==0 ){
1944519589
failIfSafeMode(p, "cannot run .clone in safe mode");
1944619590
if( nArg==2 ){
1944719591
tryToClone(p, azArg[1]);
1944819592
}else{
1944919593
raw_printf(stderr, "Usage: .clone FILENAME\n");
1945019594
rc = 1;
1945119595
}
1945219596
}else
19453
-#endif /* !defined(SQLITE_SHELL_WASM_MODE) */
19597
+#endif /* !defined(SQLITE_SHELL_FIDDLE) */
1945419598
1945519599
if( c=='c' && strncmp(azArg[0], "connection", n)==0 ){
1945619600
if( nArg==1 ){
1945719601
/* List available connections */
1945819602
int i;
@@ -19737,11 +19881,11 @@
1973719881
raw_printf(stderr, "Usage: .eqp off|on|trace|trigger|full\n");
1973819882
rc = 1;
1973919883
}
1974019884
}else
1974119885
19742
-#ifndef SQLITE_SHELL_WASM_MODE
19886
+#ifndef SQLITE_SHELL_FIDDLE
1974319887
if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){
1974419888
if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc);
1974519889
rc = 2;
1974619890
}else
1974719891
#endif
@@ -19997,11 +20141,11 @@
1999720141
}else{
1999820142
showHelp(p->out, 0);
1999920143
}
2000020144
}else
2000120145
20002
-#ifndef SQLITE_SHELL_WASM_MODE
20146
+#ifndef SQLITE_SHELL_FIDDLE
2000320147
if( c=='i' && strncmp(azArg[0], "import", n)==0 ){
2000420148
char *zTable = 0; /* Insert data into this table */
2000520149
char *zSchema = 0; /* within this schema (may default to "main") */
2000620150
char *zFile = 0; /* Name of file to extra content from */
2000720151
sqlite3_stmt *pStmt = NULL; /* A statement */
@@ -20288,11 +20432,11 @@
2028820432
utf8_printf(p->out,
2028920433
"Added %d rows with %d errors using %d lines of input\n",
2029020434
sCtx.nRow, sCtx.nErr, sCtx.nLine-1);
2029120435
}
2029220436
}else
20293
-#endif /* !defined(SQLITE_SHELL_WASM_MODE) */
20437
+#endif /* !defined(SQLITE_SHELL_FIDDLE) */
2029420438
2029520439
#ifndef SQLITE_UNTESTABLE
2029620440
if( c=='i' && strncmp(azArg[0], "imposter", n)==0 ){
2029720441
char *zSql;
2029820442
char *zCollist = 0;
@@ -20478,11 +20622,11 @@
2047820622
if( c=='l' && n>2 && strncmp(azArg[0], "lint", n)==0 ){
2047920623
open_db(p, 0);
2048020624
lintDotCommand(p, azArg, nArg);
2048120625
}else
2048220626
20483
-#if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_WASM_MODE)
20627
+#if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_FIDDLE)
2048420628
if( c=='l' && strncmp(azArg[0], "load", n)==0 ){
2048520629
const char *zFile, *zProc;
2048620630
char *zErrMsg = 0;
2048720631
failIfSafeMode(p, "cannot run .load in safe mode");
2048820632
if( nArg<2 ){
@@ -20500,11 +20644,11 @@
2050020644
rc = 1;
2050120645
}
2050220646
}else
2050320647
#endif
2050420648
20505
-#ifndef SQLITE_SHELL_WASM_MODE
20649
+#ifndef SQLITE_SHELL_FIDDLE
2050620650
if( c=='l' && strncmp(azArg[0], "log", n)==0 ){
2050720651
failIfSafeMode(p, "cannot run .log in safe mode");
2050820652
if( nArg!=2 ){
2050920653
raw_printf(stderr, "Usage: .log FILENAME\n");
2051020654
rc = 1;
@@ -20637,11 +20781,11 @@
2063720781
rc = 1;
2063820782
}
2063920783
p->cMode = p->mode;
2064020784
}else
2064120785
20642
-#ifndef SQLITE_SHELL_WASM_MODE
20786
+#ifndef SQLITE_SHELL_FIDDLE
2064320787
if( c=='n' && strcmp(azArg[0], "nonce")==0 ){
2064420788
if( nArg!=2 ){
2064520789
raw_printf(stderr, "Usage: .nonce NONCE\n");
2064620790
rc = 1;
2064720791
}else if( p->zNonce==0 || strcmp(azArg[1],p->zNonce)!=0 ){
@@ -20652,11 +20796,11 @@
2065220796
p->bSafeMode = 0;
2065320797
return 0; /* Return immediately to bypass the safe mode reset
2065420798
** at the end of this procedure */
2065520799
}
2065620800
}else
20657
-#endif /* !defined(SQLITE_SHELL_WASM_MODE) */
20801
+#endif /* !defined(SQLITE_SHELL_FIDDLE) */
2065820802
2065920803
if( c=='n' && strncmp(azArg[0], "nullvalue", n)==0 ){
2066020804
if( nArg==2 ){
2066120805
sqlite3_snprintf(sizeof(p->nullValue), p->nullValue,
2066220806
"%.*s", (int)ArraySize(p->nullValue)-1, azArg[1]);
@@ -20674,11 +20818,11 @@
2067420818
int openMode = SHELL_OPEN_UNSPEC;
2067520819
2067620820
/* Check for command-line arguments */
2067720821
for(iName=1; iName<nArg; iName++){
2067820822
const char *z = azArg[iName];
20679
-#ifndef SQLITE_SHELL_WASM_MODE
20823
+#ifndef SQLITE_SHELL_FIDDLE
2068020824
if( optionMatch(z,"new") ){
2068120825
newFlag = 1;
2068220826
#ifdef SQLITE_HAVE_ZLIB
2068320827
}else if( optionMatch(z, "zip") ){
2068420828
openMode = SHELL_OPEN_ZIPFILE;
@@ -20696,11 +20840,11 @@
2069620840
openMode = SHELL_OPEN_HEXDB;
2069720841
}else if( optionMatch(z, "maxsize") && iName+1<nArg ){
2069820842
p->szMax = integerValue(azArg[++iName]);
2069920843
#endif /* SQLITE_OMIT_DESERIALIZE */
2070020844
}else
20701
-#endif /* !SQLITE_SHELL_WASM_MODE */
20845
+#endif /* !SQLITE_SHELL_FIDDLE */
2070220846
if( z[0]=='-' ){
2070320847
utf8_printf(stderr, "unknown option: %s\n", z);
2070420848
rc = 1;
2070520849
goto meta_command_exit;
2070620850
}else if( zFN ){
@@ -20724,11 +20868,11 @@
2072420868
p->szMax = 0;
2072520869
2072620870
/* If a filename is specified, try to open it first */
2072720871
if( zFN || p->openMode==SHELL_OPEN_HEXDB ){
2072820872
if( newFlag && zFN && !p->bSafeMode ) shellDeleteFile(zFN);
20729
-#ifndef SQLITE_SHELL_WASM_MODE
20873
+#ifndef SQLITE_SHELL_FIDDLE
2073020874
if( p->bSafeMode
2073120875
&& p->openMode!=SHELL_OPEN_HEXDB
2073220876
&& zFN
2073320877
&& strcmp(zFN,":memory:")!=0
2073420878
){
@@ -20757,11 +20901,11 @@
2075720901
p->pAuxDb->zDbFilename = 0;
2075820902
open_db(p, 0);
2075920903
}
2076020904
}else
2076120905
20762
-#ifndef SQLITE_SHELL_WASM_MODE
20906
+#ifndef SQLITE_SHELL_FIDDLE
2076320907
if( (c=='o'
2076420908
&& (strncmp(azArg[0], "output", n)==0||strncmp(azArg[0], "once", n)==0))
2076520909
|| (c=='e' && n==5 && strcmp(azArg[0],"excel")==0)
2076620910
){
2076720911
char *zFile = 0;
@@ -20873,11 +21017,11 @@
2087321017
sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", zFile);
2087421018
}
2087521019
}
2087621020
sqlite3_free(zFile);
2087721021
}else
20878
-#endif /* !defined(SQLITE_SHELL_WASM_MODE) */
21022
+#endif /* !defined(SQLITE_SHELL_FIDDLE) */
2087921023
2088021024
if( c=='p' && n>=3 && strncmp(azArg[0], "parameter", n)==0 ){
2088121025
open_db(p,0);
2088221026
if( nArg<=1 ) goto parameter_syntax_error;
2088321027
@@ -21043,17 +21187,17 @@
2104321187
if( nArg >= 3) {
2104421188
strncpy(continuePrompt,azArg[2],(int)ArraySize(continuePrompt)-1);
2104521189
}
2104621190
}else
2104721191
21048
-#ifndef SQLITE_SHELL_WASM_MODE
21192
+#ifndef SQLITE_SHELL_FIDDLE
2104921193
if( c=='q' && strncmp(azArg[0], "quit", n)==0 ){
2105021194
rc = 2;
2105121195
}else
2105221196
#endif
2105321197
21054
-#ifndef SQLITE_SHELL_WASM_MODE
21198
+#ifndef SQLITE_SHELL_FIDDLE
2105521199
if( c=='r' && n>=3 && strncmp(azArg[0], "read", n)==0 ){
2105621200
FILE *inSaved = p->in;
2105721201
int savedLineno = p->lineno;
2105821202
failIfSafeMode(p, "cannot run .read in safe mode");
2105921203
if( nArg!=2 ){
@@ -21084,13 +21228,13 @@
2108421228
fclose(p->in);
2108521229
}
2108621230
p->in = inSaved;
2108721231
p->lineno = savedLineno;
2108821232
}else
21089
-#endif /* !defined(SQLITE_SHELL_WASM_MODE) */
21233
+#endif /* !defined(SQLITE_SHELL_FIDDLE) */
2109021234
21091
-#ifndef SQLITE_SHELL_WASM_MODE
21235
+#ifndef SQLITE_SHELL_FIDDLE
2109221236
if( c=='r' && n>=3 && strncmp(azArg[0], "restore", n)==0 ){
2109321237
const char *zSrcFile;
2109421238
const char *zDb;
2109521239
sqlite3 *pSrc;
2109621240
sqlite3_backup *pBackup;
@@ -21138,11 +21282,11 @@
2113821282
utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(p->db));
2113921283
rc = 1;
2114021284
}
2114121285
close_db(pSrc);
2114221286
}else
21143
-#endif /* !defined(SQLITE_SHELL_WASM_MODE) */
21287
+#endif /* !defined(SQLITE_SHELL_FIDDLE) */
2114421288
2114521289
if( c=='s' && strncmp(azArg[0], "scanstats", n)==0 ){
2114621290
if( nArg==2 ){
2114721291
p->scanstatsOn = (u8)booleanValue(azArg[1]);
2114821292
#ifndef SQLITE_ENABLE_STMT_SCANSTATUS
@@ -21764,11 +21908,11 @@
2176421908
shell_exec(p, zSql, 0);
2176521909
}
2176621910
sqlite3_free(zSql);
2176721911
}else
2176821912
21769
-#if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_WASM_MODE)
21913
+#if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_FIDDLE)
2177021914
if( c=='s'
2177121915
&& (strncmp(azArg[0], "shell", n)==0 || strncmp(azArg[0],"system",n)==0)
2177221916
){
2177321917
char *zCmd;
2177421918
int i, x;
@@ -21785,11 +21929,11 @@
2178521929
}
2178621930
x = zCmd!=0 ? system(zCmd) : 1;
2178721931
sqlite3_free(zCmd);
2178821932
if( x ) raw_printf(stderr, "System command returns %d\n", x);
2178921933
}else
21790
-#endif /* !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_WASM_MODE) */
21934
+#endif /* !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_FIDDLE) */
2179121935
2179221936
if( c=='s' && strncmp(azArg[0], "show", n)==0 ){
2179321937
static const char *azBool[] = { "off", "on", "trigger", "full"};
2179421938
const char *zOut;
2179521939
int i;
@@ -21965,11 +22109,11 @@
2196522109
2196622110
for(ii=0; ii<nRow; ii++) sqlite3_free(azResult[ii]);
2196722111
sqlite3_free(azResult);
2196822112
}else
2196922113
21970
-#ifndef SQLITE_SHELL_WASM_MODE
22114
+#ifndef SQLITE_SHELL_FIDDLE
2197122115
/* Begin redirecting output to the file "testcase-out.txt" */
2197222116
if( c=='t' && strcmp(azArg[0],"testcase")==0 ){
2197322117
output_reset(p);
2197422118
p->out = output_file_open("testcase-out.txt", 0);
2197522119
if( p->out==0 ){
@@ -21979,11 +22123,11 @@
2197922123
sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "%s", azArg[1]);
2198022124
}else{
2198122125
sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "?");
2198222126
}
2198322127
}else
21984
-#endif /* !defined(SQLITE_SHELL_WASM_MODE) */
22128
+#endif /* !defined(SQLITE_SHELL_FIDDLE) */
2198522129
2198622130
#ifndef SQLITE_UNTESTABLE
2198722131
if( c=='t' && n>=8 && strncmp(azArg[0], "testctrl", n)==0 ){
2198822132
static const struct {
2198922133
const char *zCtrlName; /* Name of a test-control option */
@@ -22651,11 +22795,11 @@
2265122795
2265222796
static void echo_group_input(ShellState *p, const char *zDo){
2265322797
if( ShellHasFlag(p, SHFLG_Echo) ) utf8_printf(p->out, "%s\n", zDo);
2265422798
}
2265522799
22656
-#ifdef SQLITE_SHELL_WASM_MODE
22800
+#ifdef SQLITE_SHELL_FIDDLE
2265722801
/*
2265822802
** Alternate one_input_line() impl for wasm mode. This is not in the primary impl
2265922803
** because we need the global shellState and cannot access it from that function
2266022804
** without moving lots of code around (creating a larger/messier diff).
2266122805
*/
@@ -22682,11 +22826,11 @@
2268222826
shell_check_oom(zLine);
2268322827
memcpy(zLine, zBegin, (size_t)nZ);
2268422828
zLine[nZ] = 0;
2268522829
return zLine;
2268622830
}
22687
-#endif /* SQLITE_SHELL_WASM_MODE */
22831
+#endif /* SQLITE_SHELL_FIDDLE */
2268822832
2268922833
/*
2269022834
** Read input from *in and process it. If *in==0 then input
2269122835
** is interactive - the user is typing it it. Otherwise, input
2269222836
** is coming from a file or device. A prompt is issued and history
@@ -23065,11 +23209,11 @@
2306523209
# else
2306623210
# define SQLITE_SHELL_IS_UTF8 (1)
2306723211
# endif
2306823212
#endif
2306923213
23070
-#ifdef SQLITE_SHELL_WASM_MODE
23214
+#ifdef SQLITE_SHELL_FIDDLE
2307123215
# define main fiddle_main
2307223216
#endif
2307323217
2307423218
#if SQLITE_SHELL_IS_UTF8
2307523219
int SQLITE_CDECL main(int argc, char **argv){
@@ -23079,11 +23223,11 @@
2307923223
#endif
2308023224
#ifdef SQLITE_DEBUG
2308123225
sqlite3_int64 mem_main_enter = sqlite3_memory_used();
2308223226
#endif
2308323227
char *zErrMsg = 0;
23084
-#ifdef SQLITE_SHELL_WASM_MODE
23228
+#ifdef SQLITE_SHELL_FIDDLE
2308523229
# define data shellState
2308623230
#else
2308723231
ShellState data;
2308823232
#endif
2308923233
const char *zInitFile = 0;
@@ -23099,11 +23243,11 @@
2309923243
int argcToFree = 0;
2310023244
#endif
2310123245
2310223246
setBinaryMode(stdin, 0);
2310323247
setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
23104
-#ifdef SQLITE_SHELL_WASM_MODE
23248
+#ifdef SQLITE_SHELL_FIDDLE
2310523249
stdin_is_interactive = 0;
2310623250
stdout_is_console = 1;
2310723251
#else
2310823252
stdin_is_interactive = isatty(0);
2310923253
stdout_is_console = isatty(1);
@@ -23361,11 +23505,11 @@
2336123505
utf8_printf(stderr,"%s: Error: no database filename specified\n", Argv0);
2336223506
return 1;
2336323507
#endif
2336423508
}
2336523509
data.out = stdout;
23366
-#ifndef SQLITE_SHELL_WASM_MODE
23510
+#ifndef SQLITE_SHELL_FIDDLE
2336723511
sqlite3_appendvfs_init(0,0,0);
2336823512
#endif
2336923513
2337023514
/* Go ahead and open the database file if it already exists. If the
2337123515
** file does not exist, delay opening it. This prevents empty database
@@ -23629,11 +23773,11 @@
2362923773
}else{
2363023774
data.in = stdin;
2363123775
rc = process_input(&data);
2363223776
}
2363323777
}
23634
-#ifndef SQLITE_SHELL_WASM_MODE
23778
+#ifndef SQLITE_SHELL_FIDDLE
2363523779
/* In WASM mode we have to leave the db state in place so that
2363623780
** client code can "push" SQL into it after this call returns. */
2363723781
free(azCmd);
2363823782
set_table_name(&data, 0);
2363923783
if( data.db ){
@@ -23664,16 +23808,16 @@
2366423808
if( sqlite3_memory_used()>mem_main_enter ){
2366523809
utf8_printf(stderr, "Memory leaked: %u bytes\n",
2366623810
(unsigned int)(sqlite3_memory_used()-mem_main_enter));
2366723811
}
2366823812
#endif
23669
-#endif /* !SQLITE_SHELL_WASM_MODE */
23813
+#endif /* !SQLITE_SHELL_FIDDLE */
2367023814
return rc;
2367123815
}
2367223816
2367323817
23674
-#ifdef SQLITE_SHELL_WASM_MODE
23818
+#ifdef SQLITE_SHELL_FIDDLE
2367523819
/* Only for emcc experimentation purposes. */
2367623820
int fiddle_experiment(int a,int b){
2367723821
return a + b;
2367823822
}
2367923823
@@ -23790,6 +23934,6 @@
2379023934
shellState.wasm.zPos = zSql;
2379123935
process_input(&shellState);
2379223936
memset(&shellState.wasm, 0, sizeof(shellState.wasm));
2379323937
}
2379423938
}
23795
-#endif /* SQLITE_SHELL_WASM_MODE */
23939
+#endif /* SQLITE_SHELL_FIDDLE */
2379623940
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -53,10 +53,19 @@
53 */
54 #if !defined(SQLITE_OS_WINRT)
55 # define SQLITE_OS_WINRT 0
56 #endif
57
 
 
 
 
 
 
 
 
 
58 /*
59 ** Warning pragmas copied from msvc.h in the core.
60 */
61 #if defined(_MSC_VER)
62 #pragma warning(disable : 4054)
@@ -245,21 +254,10 @@
245 #else
246 # define setBinaryMode(X,Y)
247 # define setTextMode(X,Y)
248 #endif
249
250 /*
251 ** When compiling with emcc (a.k.a. emscripten), we're building a
252 ** WebAssembly (WASM) bundle and need to disable and rewire a few
253 ** things.
254 */
255 #ifdef __EMSCRIPTEN__
256 #define SQLITE_SHELL_WASM_MODE
257 #else
258 #undef SQLITE_SHELL_WASM_MODE
259 #endif
260
261 /* True if the timer is enabled */
262 static int enableTimer = 0;
263
264 /* Return the current wall-clock time */
265 static sqlite3_int64 timeOfDay(void){
@@ -717,11 +715,11 @@
717 **
718 ** The result is stored in space obtained from malloc() and must either
719 ** be freed by the caller or else passed back into this routine via the
720 ** zPrior argument for reuse.
721 */
722 #ifndef SQLITE_SHELL_WASM_MODE
723 static char *one_input_line(FILE *in, char *zPrior, int isContinuation){
724 char *zPrompt;
725 char *zResult;
726 if( in!=0 ){
727 zResult = local_getline(zPrior, in);
@@ -737,11 +735,11 @@
737 if( zResult && *zResult ) shell_add_history(zResult);
738 #endif
739 }
740 return zResult;
741 }
742 #endif /* !SQLITE_SHELL_WASM_MODE */
743
744 /*
745 ** Return the value of a hexadecimal digit. Return -1 if the input
746 ** is not a hex digit.
747 */
@@ -3794,10 +3792,11 @@
3794 #define re_compile sqlite3re_compile
3795 #define re_free sqlite3re_free
3796
3797 /* The end-of-input character */
3798 #define RE_EOF 0 /* End of input */
 
3799
3800 /* The NFA is implemented as sequence of opcodes taken from the following
3801 ** set. Each opcode has a single integer argument.
3802 */
3803 #define RE_OP_MATCH 1 /* Match the one character in the argument */
@@ -3815,10 +3814,37 @@
3815 #define RE_OP_DIGIT 13 /* digit: [0-9] */
3816 #define RE_OP_NOTDIGIT 14 /* Not a digit */
3817 #define RE_OP_SPACE 15 /* space: [ \t\n\r\v\f] */
3818 #define RE_OP_NOTSPACE 16 /* Not a digit */
3819 #define RE_OP_BOUNDARY 17 /* Boundary between word and non-word */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3820
3821 /* Each opcode is a "state" in the NFA */
3822 typedef unsigned short ReStateNumber;
3823
3824 /* Because this is an NFA and not a DFA, multiple states can be active at
@@ -3849,11 +3875,11 @@
3849 const char *zErr; /* Error message to return */
3850 char *aOp; /* Operators for the virtual machine */
3851 int *aArg; /* Arguments to each operator */
3852 unsigned (*xNextChar)(ReInput*); /* Next character function */
3853 unsigned char zInit[12]; /* Initial text to match */
3854 int nInit; /* Number of characters in zInit */
3855 unsigned nState; /* Number of entries in aOp[] and aArg[] */
3856 unsigned nAlloc; /* Slots allocated for aOp[] and aArg[] */
3857 };
3858
3859 /* Add a state to the given state set if it is not already there */
@@ -3922,11 +3948,11 @@
3922 ReStateSet aStateSet[2], *pThis, *pNext;
3923 ReStateNumber aSpace[100];
3924 ReStateNumber *pToFree;
3925 unsigned int i = 0;
3926 unsigned int iSwap = 0;
3927 int c = RE_EOF+1;
3928 int cPrev = 0;
3929 int rc = 0;
3930 ReInput in;
3931
3932 in.z = zIn;
@@ -3941,10 +3967,11 @@
3941 strncmp((const char*)zIn+in.i, (const char*)pRe->zInit, pRe->nInit)!=0)
3942 ){
3943 in.i++;
3944 }
3945 if( in.i+pRe->nInit>in.mx ) return 0;
 
3946 }
3947
3948 if( pRe->nState<=(sizeof(aSpace)/(sizeof(aSpace[0])*2)) ){
3949 pToFree = 0;
3950 aStateSet[0].aState = aSpace;
@@ -3968,10 +3995,14 @@
3968 int x = pThis->aState[i];
3969 switch( pRe->aOp[x] ){
3970 case RE_OP_MATCH: {
3971 if( pRe->aArg[x]==c ) re_add_state(pNext, x+1);
3972 break;
 
 
 
 
3973 }
3974 case RE_OP_ANY: {
3975 if( c!=0 ) re_add_state(pNext, x+1);
3976 break;
3977 }
@@ -4050,11 +4081,13 @@
4050 }
4051 }
4052 }
4053 }
4054 for(i=0; i<pNext->nState; i++){
4055 if( pRe->aOp[pNext->aState[i]]==RE_OP_ACCEPT ){ rc = 1; break; }
 
 
4056 }
4057 re_match_end:
4058 sqlite3_free(pToFree);
4059 return rc;
4060 }
@@ -4205,11 +4238,10 @@
4205 const char *zErr;
4206 while( (c = p->xNextChar(&p->sIn))!=0 ){
4207 iStart = p->nState;
4208 switch( c ){
4209 case '|':
4210 case '$':
4211 case ')': {
4212 p->sIn.i--;
4213 return 0;
4214 }
4215 case '(': {
@@ -4241,10 +4273,18 @@
4241 }
4242 case '?': {
4243 if( iPrev<0 ) return "'?' without operand";
4244 re_insert(p, iPrev, RE_OP_FORK, p->nState - iPrev+1);
4245 break;
 
 
 
 
 
 
 
 
4246 }
4247 case '{': {
4248 int m = 0, n = 0;
4249 int sz, j;
4250 if( iPrev<0 ) return "'{m,n}' without operand";
@@ -4260,10 +4300,11 @@
4260 p->sIn.i++;
4261 sz = p->nState - iPrev;
4262 if( m==0 ){
4263 if( n==0 ) return "both m and n are zero in '{m,n}'";
4264 re_insert(p, iPrev, RE_OP_FORK, sz+1);
 
4265 n--;
4266 }else{
4267 for(j=1; j<m; j++) re_copy(p, iPrev, sz);
4268 }
4269 for(j=m; j<n; j++){
@@ -4378,15 +4419,11 @@
4378 zErr = re_subcompile_re(pRe);
4379 if( zErr ){
4380 re_free(pRe);
4381 return zErr;
4382 }
4383 if( rePeek(pRe)=='$' && pRe->sIn.i+1>=pRe->sIn.mx ){
4384 re_append(pRe, RE_OP_MATCH, RE_EOF);
4385 re_append(pRe, RE_OP_ACCEPT, 0);
4386 *ppRe = pRe;
4387 }else if( pRe->sIn.i>=pRe->sIn.mx ){
4388 re_append(pRe, RE_OP_ACCEPT, 0);
4389 *ppRe = pRe;
4390 }else{
4391 re_free(pRe);
4392 return "unrecognized character";
@@ -4465,10 +4502,71 @@
4465 }
4466 if( setAux ){
4467 sqlite3_set_auxdata(context, 0, pRe, (void(*)(void*))re_free);
4468 }
4469 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4470
4471 /*
4472 ** Invoke this routine to register the regexp() function with the
4473 ** SQLite database connection.
4474 */
@@ -4490,16 +4588,23 @@
4490 /* The regexpi(PATTERN,STRING) function is a case-insensitive version
4491 ** of regexp(PATTERN,STRING). */
4492 rc = sqlite3_create_function(db, "regexpi", 2,
4493 SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
4494 (void*)db, re_sql_func, 0, 0);
 
 
 
 
 
 
 
4495 }
4496 return rc;
4497 }
4498
4499 /************************* End ../ext/misc/regexp.c ********************/
4500 #ifndef SQLITE_SHELL_WASM_MODE
4501 /************************* Begin ../ext/misc/fileio.c ******************/
4502 /*
4503 ** 2014-06-13
4504 **
4505 ** The author disclaims copyright to this source code. In place of
@@ -10047,10 +10152,14 @@
10047 ** Return true if zId must be quoted in order to use it as an SQL
10048 ** identifier, or false otherwise.
10049 */
10050 static int idxIdentifierRequiresQuotes(const char *zId){
10051 int i;
 
 
 
 
10052 for(i=0; zId[i]; i++){
10053 if( !(zId[i]=='_')
10054 && !(zId[i]>='0' && zId[i]<='9')
10055 && !(zId[i]>='a' && zId[i]<='z')
10056 && !(zId[i]>='A' && zId[i]<='Z')
@@ -12248,19 +12357,19 @@
12248 int nIndent; /* Size of array aiIndent[] */
12249 int iIndent; /* Index of current op in aiIndent[] */
12250 char *zNonce; /* Nonce for temporary safe-mode excapes */
12251 EQPGraph sGraph; /* Information for the graphical EXPLAIN QUERY PLAN */
12252 ExpertInfo expert; /* Valid if previous command was ".expert OPT..." */
12253 #ifdef SQLITE_SHELL_WASM_MODE
12254 struct {
12255 const char * zInput; /* Input string from wasm/JS proxy */
12256 const char * zPos; /* Cursor pos into zInput */
12257 } wasm;
12258 #endif
12259 };
12260
12261 #ifdef SQLITE_SHELL_WASM_MODE
12262 static ShellState shellState;
12263 #endif
12264
12265
12266 /* Allowed values for ShellState.autoEQP
@@ -12588,14 +12697,27 @@
12588 /*
12589 ** Output the given string as a hex-encoded blob (eg. X'1234' )
12590 */
12591 static void output_hex_blob(FILE *out, const void *pBlob, int nBlob){
12592 int i;
12593 char *zBlob = (char *)pBlob;
12594 raw_printf(out,"X'");
12595 for(i=0; i<nBlob; i++){ raw_printf(out,"%02x",zBlob[i]&0xff); }
12596 raw_printf(out,"'");
 
 
 
 
 
 
 
 
 
 
 
 
 
12597 }
12598
12599 /*
12600 ** Find a string that is not found anywhere in z[]. Return a pointer
12601 ** to that string.
@@ -12924,11 +13046,11 @@
12924 UNUSED_PARAMETER(zA2);
12925 UNUSED_PARAMETER(zA3);
12926 UNUSED_PARAMETER(zA4);
12927 switch( op ){
12928 case SQLITE_ATTACH: {
12929 #ifndef SQLITE_SHELL_WASM_MODE
12930 /* In WASM builds the filesystem is a virtual sandbox, so
12931 ** there's no harm in using ATTACH. */
12932 failIfSafeMode(p, "cannot run ATTACH in safe mode");
12933 #endif
12934 break;
@@ -12997,19 +13119,41 @@
12997 /*
12998 ** Print a schema statement. Part of MODE_Semi and MODE_Pretty output.
12999 **
13000 ** This routine converts some CREATE TABLE statements for shadow tables
13001 ** in FTS3/4/5 into CREATE TABLE IF NOT EXISTS statements.
 
 
 
 
13002 */
13003 static void printSchemaLine(FILE *out, const char *z, const char *zTail){
 
13004 if( z==0 ) return;
13005 if( zTail==0 ) return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13006 if( sqlite3_strglob("CREATE TABLE ['\"]*", z)==0 ){
13007 utf8_printf(out, "CREATE TABLE IF NOT EXISTS %s%s", z+13, zTail);
13008 }else{
13009 utf8_printf(out, "%s%s", z, zTail);
13010 }
 
13011 }
13012 static void printSchemaLineN(FILE *out, char *z, int n, const char *zTail){
13013 char c = z[n];
13014 z[n] = 0;
13015 printSchemaLine(out, z, zTail);
@@ -15338,11 +15482,11 @@
15338 ** There must be two or more spaces between the end of the command and the
15339 ** start of the description of what that command does.
15340 */
15341 static const char *(azHelp[]) = {
15342 #if defined(SQLITE_HAVE_ZLIB) && !defined(SQLITE_OMIT_VIRTUALTABLE) \
15343 && !defined(SQLITE_SHELL_WASM_MODE)
15344 ".archive ... Manage SQL archives",
15345 " Each command must have exactly one of the following options:",
15346 " -c, --create Create a new archive",
15347 " -u, --update Add or update files with changed mtime",
15348 " -i, --insert Like -u but always add even if unchanged",
@@ -15364,23 +15508,23 @@
15364 " http://sqlite.org/cli.html#sqlite_archive_support",
15365 #endif
15366 #ifndef SQLITE_OMIT_AUTHORIZATION
15367 ".auth ON|OFF Show authorizer callbacks",
15368 #endif
15369 #ifndef SQLITE_SHELL_WASM_MODE
15370 ".backup ?DB? FILE Backup DB (default \"main\") to FILE",
15371 " Options:",
15372 " --append Use the appendvfs",
15373 " --async Write to FILE without journal and fsync()",
15374 #endif
15375 ".bail on|off Stop after hitting an error. Default OFF",
15376 ".binary on|off Turn binary output on or off. Default OFF",
15377 #ifndef SQLITE_SHELL_WASM_MODE
15378 ".cd DIRECTORY Change the working directory to DIRECTORY",
15379 #endif
15380 ".changes on|off Show number of rows changed by SQL",
15381 #ifndef SQLITE_SHELL_WASM_MODE
15382 ".check GLOB Fail if output since .testcase does not match",
15383 ".clone NEWDB Clone data into NEWDB from the existing database",
15384 #endif
15385 ".connection [close] [#] Open or close an auxiliary database connection",
15386 ".databases List names and files of attached databases",
@@ -15402,15 +15546,15 @@
15402 #ifdef SQLITE_DEBUG
15403 " test Show raw EXPLAIN QUERY PLAN output",
15404 " trace Like \"full\" but enable \"PRAGMA vdbe_trace\"",
15405 #endif
15406 " trigger Like \"full\" but also show trigger bytecode",
15407 #ifndef SQLITE_SHELL_WASM_MODE
15408 ".excel Display the output of next command in spreadsheet",
15409 " --bom Put a UTF8 byte-order mark on intermediate file",
15410 #endif
15411 #ifndef SQLITE_SHELL_WASM_MODE
15412 ".exit ?CODE? Exit this program with return-code CODE",
15413 #endif
15414 ".expert EXPERIMENTAL. Suggest indexes for queries",
15415 ".explain ?on|off|auto? Change the EXPLAIN formatting mode. Default: auto",
15416 ".filectrl CMD ... Run various sqlite3_file_control() operations",
@@ -15417,11 +15561,11 @@
15417 " --schema SCHEMA Use SCHEMA instead of \"main\"",
15418 " --help Show CMD details",
15419 ".fullschema ?--indent? Show schema and the content of sqlite_stat tables",
15420 ".headers on|off Turn display of headers on or off",
15421 ".help ?-all? ?PATTERN? Show help text for PATTERN",
15422 #ifndef SQLITE_SHELL_WASM_MODE
15423 ".import FILE TABLE Import data from FILE into TABLE",
15424 " Options:",
15425 " --ascii Use \\037 and \\036 as column and row separators",
15426 " --csv Use , and \\n as column and row separators",
15427 " --skip N Skip the first N rows of input",
@@ -15446,14 +15590,14 @@
15446 #endif
15447 ".limit ?LIMIT? ?VAL? Display or change the value of an SQLITE_LIMIT",
15448 ".lint OPTIONS Report potential schema issues.",
15449 " Options:",
15450 " fkey-indexes Find missing foreign key indexes",
15451 #if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_WASM_MODE)
15452 ".load FILE ?ENTRY? Load an extension library",
15453 #endif
15454 #ifndef SQLITE_SHELL_WASM_MODE
15455 ".log FILE|off Turn logging on or off. FILE can be stderr/stdout",
15456 #endif
15457 ".mode MODE ?OPTIONS? Set output mode",
15458 " MODE is one of:",
15459 " ascii Columns/rows delimited by 0x1F and 0x1E",
@@ -15476,15 +15620,15 @@
15476 " --wordwrap B Wrap or not at word boundaries per B (on/off)",
15477 " --ww Shorthand for \"--wordwrap 1\"",
15478 " --quote Quote output text as SQL literals",
15479 " --noquote Do not quote output text",
15480 " TABLE The name of SQL table used for \"insert\" mode",
15481 #ifndef SQLITE_SHELL_WASM_MODE
15482 ".nonce STRING Suspend safe mode for one command if nonce matches",
15483 #endif
15484 ".nullvalue STRING Use STRING in place of NULL values",
15485 #ifndef SQLITE_SHELL_WASM_MODE
15486 ".once ?OPTIONS? ?FILE? Output for the next SQL command only to FILE",
15487 " If FILE begins with '|' then open as a pipe",
15488 " --bom Put a UTF8 byte-order mark at the beginning",
15489 " -e Send output to the system text editor",
15490 " -x Send output as CSV to a spreadsheet (same as \".excel\")",
@@ -15502,11 +15646,11 @@
15502 #endif
15503 " --new Initialize FILE to an empty database",
15504 " --nofollow Do not follow symbolic links",
15505 " --readonly Open FILE readonly",
15506 " --zip FILE is a ZIP archive",
15507 #ifndef SQLITE_SHELL_WASM_MODE
15508 ".output ?FILE? Send output to FILE or stdout if FILE is omitted",
15509 " If FILE begins with '|' then open it as a pipe.",
15510 " Options:",
15511 " --bom Prefix output with a UTF8 byte-order mark",
15512 " -e Send output to the system text editor",
@@ -15526,11 +15670,11 @@
15526 " --once Do no more than one progress interrupt",
15527 " --quiet|-q No output except at interrupts",
15528 " --reset Reset the count for each input and interrupt",
15529 #endif
15530 ".prompt MAIN CONTINUE Replace the standard prompts",
15531 #ifndef SQLITE_SHELL_WASM_MODE
15532 ".quit Exit this program",
15533 ".read FILE Read input from FILE or command output",
15534 " If FILE begins with \"|\", it is a command that generates the input.",
15535 #endif
15536 #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
@@ -15539,11 +15683,11 @@
15539 " --recovery-db NAME Store recovery metadata in database file NAME",
15540 " --lost-and-found TABLE Alternative name for the lost-and-found table",
15541 " --no-rowids Do not attempt to recover rowid values",
15542 " that are not also INTEGER PRIMARY KEYs",
15543 #endif
15544 #ifndef SQLITE_SHELL_WASM_MODE
15545 ".restore ?DB? FILE Restore content of DB (default \"main\") from FILE",
15546 ".save ?OPTIONS? FILE Write database to FILE (an alias for .backup ...)",
15547 #endif
15548 ".scanstats on|off Turn sqlite3_stmt_scanstatus() metrics on or off",
15549 ".schema ?PATTERN? Show the CREATE statements matching PATTERN",
@@ -15576,24 +15720,24 @@
15576 " --sha3-224 Use the sha3-224 algorithm",
15577 " --sha3-256 Use the sha3-256 algorithm (default)",
15578 " --sha3-384 Use the sha3-384 algorithm",
15579 " --sha3-512 Use the sha3-512 algorithm",
15580 " Any other argument is a LIKE pattern for tables to hash",
15581 #if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_WASM_MODE)
15582 ".shell CMD ARGS... Run CMD ARGS... in a system shell",
15583 #endif
15584 ".show Show the current values for various settings",
15585 ".stats ?ARG? Show stats or turn stats on or off",
15586 " off Turn off automatic stat display",
15587 " on Turn on automatic stat display",
15588 " stmt Show statement stats",
15589 " vmstep Show the virtual machine step count only",
15590 #if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_WASM_MODE)
15591 ".system CMD ARGS... Run CMD ARGS... in a system shell",
15592 #endif
15593 ".tables ?TABLE? List names of tables matching LIKE pattern TABLE",
15594 #ifndef SQLITE_SHELL_WASM_MODE
15595 ".testcase NAME Begin redirecting output to 'testcase-out.txt'",
15596 #endif
15597 ".testctrl CMD ... Run various sqlite3_test_control() operations",
15598 " Run \".testctrl\" with no arguments for details",
15599 ".timeout MS Try opening locked tables for MS milliseconds",
@@ -16142,11 +16286,11 @@
16142 sqlite3_uint_init(p->db, 0, 0);
16143 sqlite3_decimal_init(p->db, 0, 0);
16144 sqlite3_regexp_init(p->db, 0, 0);
16145 sqlite3_ieee_init(p->db, 0, 0);
16146 sqlite3_series_init(p->db, 0, 0);
16147 #ifndef SQLITE_SHELL_WASM_MODE
16148 sqlite3_fileio_init(p->db, 0, 0);
16149 sqlite3_completion_init(p->db, 0, 0);
16150 #endif
16151 #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
16152 sqlite3_dbdata_init(p->db, 0, 0);
@@ -19272,19 +19416,19 @@
19272 }
19273 }else
19274 #endif
19275
19276 #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) \
19277 && !defined(SQLITE_SHELL_WASM_MODE)
19278 if( c=='a' && strncmp(azArg[0], "archive", n)==0 ){
19279 open_db(p, 0);
19280 failIfSafeMode(p, "cannot run .archive in safe mode");
19281 rc = arDotCommand(p, 0, azArg, nArg);
19282 }else
19283 #endif
19284
19285 #ifndef SQLITE_SHELL_WASM_MODE
19286 if( (c=='b' && n>=3 && strncmp(azArg[0], "backup", n)==0)
19287 || (c=='s' && n>=3 && strncmp(azArg[0], "save", n)==0)
19288 ){
19289 const char *zDestFile = 0;
19290 const char *zDb = 0;
@@ -19349,11 +19493,11 @@
19349 utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(pDest));
19350 rc = 1;
19351 }
19352 close_db(pDest);
19353 }else
19354 #endif /* !defined(SQLITE_SHELL_WASM_MODE) */
19355
19356 if( c=='b' && n>=3 && strncmp(azArg[0], "bail", n)==0 ){
19357 if( nArg==2 ){
19358 bail_on_error = booleanValue(azArg[1]);
19359 }else{
@@ -19380,11 +19524,11 @@
19380 */
19381 if( c=='b' && n>=3 && strncmp(azArg[0], "breakpoint", n)==0 ){
19382 test_breakpoint();
19383 }else
19384
19385 #ifndef SQLITE_SHELL_WASM_MODE
19386 if( c=='c' && strcmp(azArg[0],"cd")==0 ){
19387 failIfSafeMode(p, "cannot run .cd in safe mode");
19388 if( nArg==2 ){
19389 #if defined(_WIN32) || defined(WIN32)
19390 wchar_t *z = sqlite3_win32_utf8_to_unicode(azArg[1]);
@@ -19400,11 +19544,11 @@
19400 }else{
19401 raw_printf(stderr, "Usage: .cd DIRECTORY\n");
19402 rc = 1;
19403 }
19404 }else
19405 #endif /* !defined(SQLITE_SHELL_WASM_MODE) */
19406
19407 if( c=='c' && n>=3 && strncmp(azArg[0], "changes", n)==0 ){
19408 if( nArg==2 ){
19409 setOrClearFlag(p, SHFLG_CountChanges, azArg[1]);
19410 }else{
@@ -19411,11 +19555,11 @@
19411 raw_printf(stderr, "Usage: .changes on|off\n");
19412 rc = 1;
19413 }
19414 }else
19415
19416 #ifndef SQLITE_SHELL_WASM_MODE
19417 /* Cancel output redirection, if it is currently set (by .testcase)
19418 ** Then read the content of the testcase-out.txt file and compare against
19419 ** azArg[1]. If there are differences, report an error and exit.
19420 */
19421 if( c=='c' && n>=3 && strncmp(azArg[0], "check", n)==0 ){
@@ -19436,23 +19580,23 @@
19436 utf8_printf(stdout, "testcase-%s ok\n", p->zTestcase);
19437 p->nCheck++;
19438 }
19439 sqlite3_free(zRes);
19440 }else
19441 #endif /* !defined(SQLITE_SHELL_WASM_MODE) */
19442
19443 #ifndef SQLITE_SHELL_WASM_MODE
19444 if( c=='c' && strncmp(azArg[0], "clone", n)==0 ){
19445 failIfSafeMode(p, "cannot run .clone in safe mode");
19446 if( nArg==2 ){
19447 tryToClone(p, azArg[1]);
19448 }else{
19449 raw_printf(stderr, "Usage: .clone FILENAME\n");
19450 rc = 1;
19451 }
19452 }else
19453 #endif /* !defined(SQLITE_SHELL_WASM_MODE) */
19454
19455 if( c=='c' && strncmp(azArg[0], "connection", n)==0 ){
19456 if( nArg==1 ){
19457 /* List available connections */
19458 int i;
@@ -19737,11 +19881,11 @@
19737 raw_printf(stderr, "Usage: .eqp off|on|trace|trigger|full\n");
19738 rc = 1;
19739 }
19740 }else
19741
19742 #ifndef SQLITE_SHELL_WASM_MODE
19743 if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){
19744 if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc);
19745 rc = 2;
19746 }else
19747 #endif
@@ -19997,11 +20141,11 @@
19997 }else{
19998 showHelp(p->out, 0);
19999 }
20000 }else
20001
20002 #ifndef SQLITE_SHELL_WASM_MODE
20003 if( c=='i' && strncmp(azArg[0], "import", n)==0 ){
20004 char *zTable = 0; /* Insert data into this table */
20005 char *zSchema = 0; /* within this schema (may default to "main") */
20006 char *zFile = 0; /* Name of file to extra content from */
20007 sqlite3_stmt *pStmt = NULL; /* A statement */
@@ -20288,11 +20432,11 @@
20288 utf8_printf(p->out,
20289 "Added %d rows with %d errors using %d lines of input\n",
20290 sCtx.nRow, sCtx.nErr, sCtx.nLine-1);
20291 }
20292 }else
20293 #endif /* !defined(SQLITE_SHELL_WASM_MODE) */
20294
20295 #ifndef SQLITE_UNTESTABLE
20296 if( c=='i' && strncmp(azArg[0], "imposter", n)==0 ){
20297 char *zSql;
20298 char *zCollist = 0;
@@ -20478,11 +20622,11 @@
20478 if( c=='l' && n>2 && strncmp(azArg[0], "lint", n)==0 ){
20479 open_db(p, 0);
20480 lintDotCommand(p, azArg, nArg);
20481 }else
20482
20483 #if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_WASM_MODE)
20484 if( c=='l' && strncmp(azArg[0], "load", n)==0 ){
20485 const char *zFile, *zProc;
20486 char *zErrMsg = 0;
20487 failIfSafeMode(p, "cannot run .load in safe mode");
20488 if( nArg<2 ){
@@ -20500,11 +20644,11 @@
20500 rc = 1;
20501 }
20502 }else
20503 #endif
20504
20505 #ifndef SQLITE_SHELL_WASM_MODE
20506 if( c=='l' && strncmp(azArg[0], "log", n)==0 ){
20507 failIfSafeMode(p, "cannot run .log in safe mode");
20508 if( nArg!=2 ){
20509 raw_printf(stderr, "Usage: .log FILENAME\n");
20510 rc = 1;
@@ -20637,11 +20781,11 @@
20637 rc = 1;
20638 }
20639 p->cMode = p->mode;
20640 }else
20641
20642 #ifndef SQLITE_SHELL_WASM_MODE
20643 if( c=='n' && strcmp(azArg[0], "nonce")==0 ){
20644 if( nArg!=2 ){
20645 raw_printf(stderr, "Usage: .nonce NONCE\n");
20646 rc = 1;
20647 }else if( p->zNonce==0 || strcmp(azArg[1],p->zNonce)!=0 ){
@@ -20652,11 +20796,11 @@
20652 p->bSafeMode = 0;
20653 return 0; /* Return immediately to bypass the safe mode reset
20654 ** at the end of this procedure */
20655 }
20656 }else
20657 #endif /* !defined(SQLITE_SHELL_WASM_MODE) */
20658
20659 if( c=='n' && strncmp(azArg[0], "nullvalue", n)==0 ){
20660 if( nArg==2 ){
20661 sqlite3_snprintf(sizeof(p->nullValue), p->nullValue,
20662 "%.*s", (int)ArraySize(p->nullValue)-1, azArg[1]);
@@ -20674,11 +20818,11 @@
20674 int openMode = SHELL_OPEN_UNSPEC;
20675
20676 /* Check for command-line arguments */
20677 for(iName=1; iName<nArg; iName++){
20678 const char *z = azArg[iName];
20679 #ifndef SQLITE_SHELL_WASM_MODE
20680 if( optionMatch(z,"new") ){
20681 newFlag = 1;
20682 #ifdef SQLITE_HAVE_ZLIB
20683 }else if( optionMatch(z, "zip") ){
20684 openMode = SHELL_OPEN_ZIPFILE;
@@ -20696,11 +20840,11 @@
20696 openMode = SHELL_OPEN_HEXDB;
20697 }else if( optionMatch(z, "maxsize") && iName+1<nArg ){
20698 p->szMax = integerValue(azArg[++iName]);
20699 #endif /* SQLITE_OMIT_DESERIALIZE */
20700 }else
20701 #endif /* !SQLITE_SHELL_WASM_MODE */
20702 if( z[0]=='-' ){
20703 utf8_printf(stderr, "unknown option: %s\n", z);
20704 rc = 1;
20705 goto meta_command_exit;
20706 }else if( zFN ){
@@ -20724,11 +20868,11 @@
20724 p->szMax = 0;
20725
20726 /* If a filename is specified, try to open it first */
20727 if( zFN || p->openMode==SHELL_OPEN_HEXDB ){
20728 if( newFlag && zFN && !p->bSafeMode ) shellDeleteFile(zFN);
20729 #ifndef SQLITE_SHELL_WASM_MODE
20730 if( p->bSafeMode
20731 && p->openMode!=SHELL_OPEN_HEXDB
20732 && zFN
20733 && strcmp(zFN,":memory:")!=0
20734 ){
@@ -20757,11 +20901,11 @@
20757 p->pAuxDb->zDbFilename = 0;
20758 open_db(p, 0);
20759 }
20760 }else
20761
20762 #ifndef SQLITE_SHELL_WASM_MODE
20763 if( (c=='o'
20764 && (strncmp(azArg[0], "output", n)==0||strncmp(azArg[0], "once", n)==0))
20765 || (c=='e' && n==5 && strcmp(azArg[0],"excel")==0)
20766 ){
20767 char *zFile = 0;
@@ -20873,11 +21017,11 @@
20873 sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", zFile);
20874 }
20875 }
20876 sqlite3_free(zFile);
20877 }else
20878 #endif /* !defined(SQLITE_SHELL_WASM_MODE) */
20879
20880 if( c=='p' && n>=3 && strncmp(azArg[0], "parameter", n)==0 ){
20881 open_db(p,0);
20882 if( nArg<=1 ) goto parameter_syntax_error;
20883
@@ -21043,17 +21187,17 @@
21043 if( nArg >= 3) {
21044 strncpy(continuePrompt,azArg[2],(int)ArraySize(continuePrompt)-1);
21045 }
21046 }else
21047
21048 #ifndef SQLITE_SHELL_WASM_MODE
21049 if( c=='q' && strncmp(azArg[0], "quit", n)==0 ){
21050 rc = 2;
21051 }else
21052 #endif
21053
21054 #ifndef SQLITE_SHELL_WASM_MODE
21055 if( c=='r' && n>=3 && strncmp(azArg[0], "read", n)==0 ){
21056 FILE *inSaved = p->in;
21057 int savedLineno = p->lineno;
21058 failIfSafeMode(p, "cannot run .read in safe mode");
21059 if( nArg!=2 ){
@@ -21084,13 +21228,13 @@
21084 fclose(p->in);
21085 }
21086 p->in = inSaved;
21087 p->lineno = savedLineno;
21088 }else
21089 #endif /* !defined(SQLITE_SHELL_WASM_MODE) */
21090
21091 #ifndef SQLITE_SHELL_WASM_MODE
21092 if( c=='r' && n>=3 && strncmp(azArg[0], "restore", n)==0 ){
21093 const char *zSrcFile;
21094 const char *zDb;
21095 sqlite3 *pSrc;
21096 sqlite3_backup *pBackup;
@@ -21138,11 +21282,11 @@
21138 utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(p->db));
21139 rc = 1;
21140 }
21141 close_db(pSrc);
21142 }else
21143 #endif /* !defined(SQLITE_SHELL_WASM_MODE) */
21144
21145 if( c=='s' && strncmp(azArg[0], "scanstats", n)==0 ){
21146 if( nArg==2 ){
21147 p->scanstatsOn = (u8)booleanValue(azArg[1]);
21148 #ifndef SQLITE_ENABLE_STMT_SCANSTATUS
@@ -21764,11 +21908,11 @@
21764 shell_exec(p, zSql, 0);
21765 }
21766 sqlite3_free(zSql);
21767 }else
21768
21769 #if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_WASM_MODE)
21770 if( c=='s'
21771 && (strncmp(azArg[0], "shell", n)==0 || strncmp(azArg[0],"system",n)==0)
21772 ){
21773 char *zCmd;
21774 int i, x;
@@ -21785,11 +21929,11 @@
21785 }
21786 x = zCmd!=0 ? system(zCmd) : 1;
21787 sqlite3_free(zCmd);
21788 if( x ) raw_printf(stderr, "System command returns %d\n", x);
21789 }else
21790 #endif /* !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_WASM_MODE) */
21791
21792 if( c=='s' && strncmp(azArg[0], "show", n)==0 ){
21793 static const char *azBool[] = { "off", "on", "trigger", "full"};
21794 const char *zOut;
21795 int i;
@@ -21965,11 +22109,11 @@
21965
21966 for(ii=0; ii<nRow; ii++) sqlite3_free(azResult[ii]);
21967 sqlite3_free(azResult);
21968 }else
21969
21970 #ifndef SQLITE_SHELL_WASM_MODE
21971 /* Begin redirecting output to the file "testcase-out.txt" */
21972 if( c=='t' && strcmp(azArg[0],"testcase")==0 ){
21973 output_reset(p);
21974 p->out = output_file_open("testcase-out.txt", 0);
21975 if( p->out==0 ){
@@ -21979,11 +22123,11 @@
21979 sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "%s", azArg[1]);
21980 }else{
21981 sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "?");
21982 }
21983 }else
21984 #endif /* !defined(SQLITE_SHELL_WASM_MODE) */
21985
21986 #ifndef SQLITE_UNTESTABLE
21987 if( c=='t' && n>=8 && strncmp(azArg[0], "testctrl", n)==0 ){
21988 static const struct {
21989 const char *zCtrlName; /* Name of a test-control option */
@@ -22651,11 +22795,11 @@
22651
22652 static void echo_group_input(ShellState *p, const char *zDo){
22653 if( ShellHasFlag(p, SHFLG_Echo) ) utf8_printf(p->out, "%s\n", zDo);
22654 }
22655
22656 #ifdef SQLITE_SHELL_WASM_MODE
22657 /*
22658 ** Alternate one_input_line() impl for wasm mode. This is not in the primary impl
22659 ** because we need the global shellState and cannot access it from that function
22660 ** without moving lots of code around (creating a larger/messier diff).
22661 */
@@ -22682,11 +22826,11 @@
22682 shell_check_oom(zLine);
22683 memcpy(zLine, zBegin, (size_t)nZ);
22684 zLine[nZ] = 0;
22685 return zLine;
22686 }
22687 #endif /* SQLITE_SHELL_WASM_MODE */
22688
22689 /*
22690 ** Read input from *in and process it. If *in==0 then input
22691 ** is interactive - the user is typing it it. Otherwise, input
22692 ** is coming from a file or device. A prompt is issued and history
@@ -23065,11 +23209,11 @@
23065 # else
23066 # define SQLITE_SHELL_IS_UTF8 (1)
23067 # endif
23068 #endif
23069
23070 #ifdef SQLITE_SHELL_WASM_MODE
23071 # define main fiddle_main
23072 #endif
23073
23074 #if SQLITE_SHELL_IS_UTF8
23075 int SQLITE_CDECL main(int argc, char **argv){
@@ -23079,11 +23223,11 @@
23079 #endif
23080 #ifdef SQLITE_DEBUG
23081 sqlite3_int64 mem_main_enter = sqlite3_memory_used();
23082 #endif
23083 char *zErrMsg = 0;
23084 #ifdef SQLITE_SHELL_WASM_MODE
23085 # define data shellState
23086 #else
23087 ShellState data;
23088 #endif
23089 const char *zInitFile = 0;
@@ -23099,11 +23243,11 @@
23099 int argcToFree = 0;
23100 #endif
23101
23102 setBinaryMode(stdin, 0);
23103 setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
23104 #ifdef SQLITE_SHELL_WASM_MODE
23105 stdin_is_interactive = 0;
23106 stdout_is_console = 1;
23107 #else
23108 stdin_is_interactive = isatty(0);
23109 stdout_is_console = isatty(1);
@@ -23361,11 +23505,11 @@
23361 utf8_printf(stderr,"%s: Error: no database filename specified\n", Argv0);
23362 return 1;
23363 #endif
23364 }
23365 data.out = stdout;
23366 #ifndef SQLITE_SHELL_WASM_MODE
23367 sqlite3_appendvfs_init(0,0,0);
23368 #endif
23369
23370 /* Go ahead and open the database file if it already exists. If the
23371 ** file does not exist, delay opening it. This prevents empty database
@@ -23629,11 +23773,11 @@
23629 }else{
23630 data.in = stdin;
23631 rc = process_input(&data);
23632 }
23633 }
23634 #ifndef SQLITE_SHELL_WASM_MODE
23635 /* In WASM mode we have to leave the db state in place so that
23636 ** client code can "push" SQL into it after this call returns. */
23637 free(azCmd);
23638 set_table_name(&data, 0);
23639 if( data.db ){
@@ -23664,16 +23808,16 @@
23664 if( sqlite3_memory_used()>mem_main_enter ){
23665 utf8_printf(stderr, "Memory leaked: %u bytes\n",
23666 (unsigned int)(sqlite3_memory_used()-mem_main_enter));
23667 }
23668 #endif
23669 #endif /* !SQLITE_SHELL_WASM_MODE */
23670 return rc;
23671 }
23672
23673
23674 #ifdef SQLITE_SHELL_WASM_MODE
23675 /* Only for emcc experimentation purposes. */
23676 int fiddle_experiment(int a,int b){
23677 return a + b;
23678 }
23679
@@ -23790,6 +23934,6 @@
23790 shellState.wasm.zPos = zSql;
23791 process_input(&shellState);
23792 memset(&shellState.wasm, 0, sizeof(shellState.wasm));
23793 }
23794 }
23795 #endif /* SQLITE_SHELL_WASM_MODE */
23796
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -53,10 +53,19 @@
53 */
54 #if !defined(SQLITE_OS_WINRT)
55 # define SQLITE_OS_WINRT 0
56 #endif
57
58 /*
59 ** If SQLITE_SHELL_FIDDLE is defined then the shell is modified
60 ** somewhat for use as a WASM module in a web browser. This flag
61 ** should only be used when building the "fiddle" web application, as
62 ** the browser-mode build has much different user input requirements
63 ** and this build mode rewires the user input subsystem to account for
64 ** that.
65 */
66
67 /*
68 ** Warning pragmas copied from msvc.h in the core.
69 */
70 #if defined(_MSC_VER)
71 #pragma warning(disable : 4054)
@@ -245,21 +254,10 @@
254 #else
255 # define setBinaryMode(X,Y)
256 # define setTextMode(X,Y)
257 #endif
258
 
 
 
 
 
 
 
 
 
 
 
259 /* True if the timer is enabled */
260 static int enableTimer = 0;
261
262 /* Return the current wall-clock time */
263 static sqlite3_int64 timeOfDay(void){
@@ -717,11 +715,11 @@
715 **
716 ** The result is stored in space obtained from malloc() and must either
717 ** be freed by the caller or else passed back into this routine via the
718 ** zPrior argument for reuse.
719 */
720 #ifndef SQLITE_SHELL_FIDDLE
721 static char *one_input_line(FILE *in, char *zPrior, int isContinuation){
722 char *zPrompt;
723 char *zResult;
724 if( in!=0 ){
725 zResult = local_getline(zPrior, in);
@@ -737,11 +735,11 @@
735 if( zResult && *zResult ) shell_add_history(zResult);
736 #endif
737 }
738 return zResult;
739 }
740 #endif /* !SQLITE_SHELL_FIDDLE */
741
742 /*
743 ** Return the value of a hexadecimal digit. Return -1 if the input
744 ** is not a hex digit.
745 */
@@ -3794,10 +3792,11 @@
3792 #define re_compile sqlite3re_compile
3793 #define re_free sqlite3re_free
3794
3795 /* The end-of-input character */
3796 #define RE_EOF 0 /* End of input */
3797 #define RE_START 0xfffffff /* Start of input - larger than an UTF-8 */
3798
3799 /* The NFA is implemented as sequence of opcodes taken from the following
3800 ** set. Each opcode has a single integer argument.
3801 */
3802 #define RE_OP_MATCH 1 /* Match the one character in the argument */
@@ -3815,10 +3814,37 @@
3814 #define RE_OP_DIGIT 13 /* digit: [0-9] */
3815 #define RE_OP_NOTDIGIT 14 /* Not a digit */
3816 #define RE_OP_SPACE 15 /* space: [ \t\n\r\v\f] */
3817 #define RE_OP_NOTSPACE 16 /* Not a digit */
3818 #define RE_OP_BOUNDARY 17 /* Boundary between word and non-word */
3819 #define RE_OP_ATSTART 18 /* Currently at the start of the string */
3820
3821 #if defined(SQLITE_DEBUG)
3822 /* Opcode names used for symbolic debugging */
3823 static const char *ReOpName[] = {
3824 "EOF",
3825 "MATCH",
3826 "ANY",
3827 "ANYSTAR",
3828 "FORK",
3829 "GOTO",
3830 "ACCEPT",
3831 "CC_INC",
3832 "CC_EXC",
3833 "CC_VALUE",
3834 "CC_RANGE",
3835 "WORD",
3836 "NOTWORD",
3837 "DIGIT",
3838 "NOTDIGIT",
3839 "SPACE",
3840 "NOTSPACE",
3841 "BOUNDARY",
3842 "ATSTART",
3843 };
3844 #endif /* SQLITE_DEBUG */
3845
3846
3847 /* Each opcode is a "state" in the NFA */
3848 typedef unsigned short ReStateNumber;
3849
3850 /* Because this is an NFA and not a DFA, multiple states can be active at
@@ -3849,11 +3875,11 @@
3875 const char *zErr; /* Error message to return */
3876 char *aOp; /* Operators for the virtual machine */
3877 int *aArg; /* Arguments to each operator */
3878 unsigned (*xNextChar)(ReInput*); /* Next character function */
3879 unsigned char zInit[12]; /* Initial text to match */
3880 int nInit; /* Number of bytes in zInit */
3881 unsigned nState; /* Number of entries in aOp[] and aArg[] */
3882 unsigned nAlloc; /* Slots allocated for aOp[] and aArg[] */
3883 };
3884
3885 /* Add a state to the given state set if it is not already there */
@@ -3922,11 +3948,11 @@
3948 ReStateSet aStateSet[2], *pThis, *pNext;
3949 ReStateNumber aSpace[100];
3950 ReStateNumber *pToFree;
3951 unsigned int i = 0;
3952 unsigned int iSwap = 0;
3953 int c = RE_START;
3954 int cPrev = 0;
3955 int rc = 0;
3956 ReInput in;
3957
3958 in.z = zIn;
@@ -3941,10 +3967,11 @@
3967 strncmp((const char*)zIn+in.i, (const char*)pRe->zInit, pRe->nInit)!=0)
3968 ){
3969 in.i++;
3970 }
3971 if( in.i+pRe->nInit>in.mx ) return 0;
3972 c = RE_START-1;
3973 }
3974
3975 if( pRe->nState<=(sizeof(aSpace)/(sizeof(aSpace[0])*2)) ){
3976 pToFree = 0;
3977 aStateSet[0].aState = aSpace;
@@ -3968,10 +3995,14 @@
3995 int x = pThis->aState[i];
3996 switch( pRe->aOp[x] ){
3997 case RE_OP_MATCH: {
3998 if( pRe->aArg[x]==c ) re_add_state(pNext, x+1);
3999 break;
4000 }
4001 case RE_OP_ATSTART: {
4002 if( cPrev==RE_START ) re_add_state(pThis, x+1);
4003 break;
4004 }
4005 case RE_OP_ANY: {
4006 if( c!=0 ) re_add_state(pNext, x+1);
4007 break;
4008 }
@@ -4050,11 +4081,13 @@
4081 }
4082 }
4083 }
4084 }
4085 for(i=0; i<pNext->nState; i++){
4086 int x = pNext->aState[i];
4087 while( pRe->aOp[x]==RE_OP_GOTO ) x += pRe->aArg[x];
4088 if( pRe->aOp[x]==RE_OP_ACCEPT ){ rc = 1; break; }
4089 }
4090 re_match_end:
4091 sqlite3_free(pToFree);
4092 return rc;
4093 }
@@ -4205,11 +4238,10 @@
4238 const char *zErr;
4239 while( (c = p->xNextChar(&p->sIn))!=0 ){
4240 iStart = p->nState;
4241 switch( c ){
4242 case '|':
 
4243 case ')': {
4244 p->sIn.i--;
4245 return 0;
4246 }
4247 case '(': {
@@ -4241,10 +4273,18 @@
4273 }
4274 case '?': {
4275 if( iPrev<0 ) return "'?' without operand";
4276 re_insert(p, iPrev, RE_OP_FORK, p->nState - iPrev+1);
4277 break;
4278 }
4279 case '$': {
4280 re_append(p, RE_OP_MATCH, RE_EOF);
4281 break;
4282 }
4283 case '^': {
4284 re_append(p, RE_OP_ATSTART, 0);
4285 break;
4286 }
4287 case '{': {
4288 int m = 0, n = 0;
4289 int sz, j;
4290 if( iPrev<0 ) return "'{m,n}' without operand";
@@ -4260,10 +4300,11 @@
4300 p->sIn.i++;
4301 sz = p->nState - iPrev;
4302 if( m==0 ){
4303 if( n==0 ) return "both m and n are zero in '{m,n}'";
4304 re_insert(p, iPrev, RE_OP_FORK, sz+1);
4305 iPrev++;
4306 n--;
4307 }else{
4308 for(j=1; j<m; j++) re_copy(p, iPrev, sz);
4309 }
4310 for(j=m; j<n; j++){
@@ -4378,15 +4419,11 @@
4419 zErr = re_subcompile_re(pRe);
4420 if( zErr ){
4421 re_free(pRe);
4422 return zErr;
4423 }
4424 if( pRe->sIn.i>=pRe->sIn.mx ){
 
 
 
 
4425 re_append(pRe, RE_OP_ACCEPT, 0);
4426 *ppRe = pRe;
4427 }else{
4428 re_free(pRe);
4429 return "unrecognized character";
@@ -4465,10 +4502,71 @@
4502 }
4503 if( setAux ){
4504 sqlite3_set_auxdata(context, 0, pRe, (void(*)(void*))re_free);
4505 }
4506 }
4507
4508 #if defined(SQLITE_DEBUG)
4509 /*
4510 ** This function is used for testing and debugging only. It is only available
4511 ** if the SQLITE_DEBUG compile-time option is used.
4512 **
4513 ** Compile a regular expression and then convert the compiled expression into
4514 ** text and return that text.
4515 */
4516 static void re_bytecode_func(
4517 sqlite3_context *context,
4518 int argc,
4519 sqlite3_value **argv
4520 ){
4521 const char *zPattern;
4522 const char *zErr;
4523 ReCompiled *pRe;
4524 sqlite3_str *pStr;
4525 int i;
4526 int n;
4527 char *z;
4528
4529 zPattern = (const char*)sqlite3_value_text(argv[0]);
4530 if( zPattern==0 ) return;
4531 zErr = re_compile(&pRe, zPattern, sqlite3_user_data(context)!=0);
4532 if( zErr ){
4533 re_free(pRe);
4534 sqlite3_result_error(context, zErr, -1);
4535 return;
4536 }
4537 if( pRe==0 ){
4538 sqlite3_result_error_nomem(context);
4539 return;
4540 }
4541 pStr = sqlite3_str_new(0);
4542 if( pStr==0 ) goto re_bytecode_func_err;
4543 if( pRe->nInit>0 ){
4544 sqlite3_str_appendf(pStr, "INIT ");
4545 for(i=0; i<pRe->nInit; i++){
4546 sqlite3_str_appendf(pStr, "%02x", pRe->zInit[i]);
4547 }
4548 sqlite3_str_appendf(pStr, "\n");
4549 }
4550 for(i=0; (unsigned)i<pRe->nState; i++){
4551 sqlite3_str_appendf(pStr, "%-8s %4d\n",
4552 ReOpName[(unsigned char)pRe->aOp[i]], pRe->aArg[i]);
4553 }
4554 n = sqlite3_str_length(pStr);
4555 z = sqlite3_str_finish(pStr);
4556 if( n==0 ){
4557 sqlite3_free(z);
4558 }else{
4559 sqlite3_result_text(context, z, n-1, sqlite3_free);
4560 }
4561
4562 re_bytecode_func_err:
4563 re_free(pRe);
4564 }
4565
4566 #endif /* SQLITE_DEBUG */
4567
4568
4569 /*
4570 ** Invoke this routine to register the regexp() function with the
4571 ** SQLite database connection.
4572 */
@@ -4490,16 +4588,23 @@
4588 /* The regexpi(PATTERN,STRING) function is a case-insensitive version
4589 ** of regexp(PATTERN,STRING). */
4590 rc = sqlite3_create_function(db, "regexpi", 2,
4591 SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
4592 (void*)db, re_sql_func, 0, 0);
4593 #if defined(SQLITE_DEBUG)
4594 if( rc==SQLITE_OK ){
4595 rc = sqlite3_create_function(db, "regexp_bytecode", 1,
4596 SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
4597 0, re_bytecode_func, 0, 0);
4598 }
4599 #endif /* SQLITE_DEBUG */
4600 }
4601 return rc;
4602 }
4603
4604 /************************* End ../ext/misc/regexp.c ********************/
4605 #ifndef SQLITE_SHELL_FIDDLE
4606 /************************* Begin ../ext/misc/fileio.c ******************/
4607 /*
4608 ** 2014-06-13
4609 **
4610 ** The author disclaims copyright to this source code. In place of
@@ -10047,10 +10152,14 @@
10152 ** Return true if zId must be quoted in order to use it as an SQL
10153 ** identifier, or false otherwise.
10154 */
10155 static int idxIdentifierRequiresQuotes(const char *zId){
10156 int i;
10157 int nId = STRLEN(zId);
10158
10159 if( sqlite3_keyword_check(zId, nId) ) return 1;
10160
10161 for(i=0; zId[i]; i++){
10162 if( !(zId[i]=='_')
10163 && !(zId[i]>='0' && zId[i]<='9')
10164 && !(zId[i]>='a' && zId[i]<='z')
10165 && !(zId[i]>='A' && zId[i]<='Z')
@@ -12248,19 +12357,19 @@
12357 int nIndent; /* Size of array aiIndent[] */
12358 int iIndent; /* Index of current op in aiIndent[] */
12359 char *zNonce; /* Nonce for temporary safe-mode excapes */
12360 EQPGraph sGraph; /* Information for the graphical EXPLAIN QUERY PLAN */
12361 ExpertInfo expert; /* Valid if previous command was ".expert OPT..." */
12362 #ifdef SQLITE_SHELL_FIDDLE
12363 struct {
12364 const char * zInput; /* Input string from wasm/JS proxy */
12365 const char * zPos; /* Cursor pos into zInput */
12366 } wasm;
12367 #endif
12368 };
12369
12370 #ifdef SQLITE_SHELL_FIDDLE
12371 static ShellState shellState;
12372 #endif
12373
12374
12375 /* Allowed values for ShellState.autoEQP
@@ -12588,14 +12697,27 @@
12697 /*
12698 ** Output the given string as a hex-encoded blob (eg. X'1234' )
12699 */
12700 static void output_hex_blob(FILE *out, const void *pBlob, int nBlob){
12701 int i;
12702 unsigned char *aBlob = (unsigned char*)pBlob;
12703
12704 char *zStr = sqlite3_malloc(nBlob*2 + 1);
12705 shell_check_oom(zStr);
12706
12707 for(i=0; i<nBlob; i++){
12708 static const char aHex[] = {
12709 '0', '1', '2', '3', '4', '5', '6', '7',
12710 '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
12711 };
12712 zStr[i*2] = aHex[ (aBlob[i] >> 4) ];
12713 zStr[i*2+1] = aHex[ (aBlob[i] & 0x0F) ];
12714 }
12715 zStr[i*2] = '\0';
12716
12717 raw_printf(out,"X'%s'", zStr);
12718 sqlite3_free(zStr);
12719 }
12720
12721 /*
12722 ** Find a string that is not found anywhere in z[]. Return a pointer
12723 ** to that string.
@@ -12924,11 +13046,11 @@
13046 UNUSED_PARAMETER(zA2);
13047 UNUSED_PARAMETER(zA3);
13048 UNUSED_PARAMETER(zA4);
13049 switch( op ){
13050 case SQLITE_ATTACH: {
13051 #ifndef SQLITE_SHELL_FIDDLE
13052 /* In WASM builds the filesystem is a virtual sandbox, so
13053 ** there's no harm in using ATTACH. */
13054 failIfSafeMode(p, "cannot run ATTACH in safe mode");
13055 #endif
13056 break;
@@ -12997,19 +13119,41 @@
13119 /*
13120 ** Print a schema statement. Part of MODE_Semi and MODE_Pretty output.
13121 **
13122 ** This routine converts some CREATE TABLE statements for shadow tables
13123 ** in FTS3/4/5 into CREATE TABLE IF NOT EXISTS statements.
13124 **
13125 ** If the schema statement in z[] contains a start-of-comment and if
13126 ** sqlite3_complete() returns false, try to terminate the comment before
13127 ** printing the result. https://sqlite.org/forum/forumpost/d7be961c5c
13128 */
13129 static void printSchemaLine(FILE *out, const char *z, const char *zTail){
13130 char *zToFree = 0;
13131 if( z==0 ) return;
13132 if( zTail==0 ) return;
13133 if( zTail[0]==';' && (strstr(z, "/*")!=0 || strstr(z,"--")!=0) ){
13134 const char *zOrig = z;
13135 static const char *azTerm[] = { "", "*/", "\n" };
13136 int i;
13137 for(i=0; i<ArraySize(azTerm); i++){
13138 char *zNew = sqlite3_mprintf("%s%s;", zOrig, azTerm[i]);
13139 if( sqlite3_complete(zNew) ){
13140 size_t n = strlen(zNew);
13141 zNew[n-1] = 0;
13142 zToFree = zNew;
13143 z = zNew;
13144 break;
13145 }
13146 sqlite3_free(zNew);
13147 }
13148 }
13149 if( sqlite3_strglob("CREATE TABLE ['\"]*", z)==0 ){
13150 utf8_printf(out, "CREATE TABLE IF NOT EXISTS %s%s", z+13, zTail);
13151 }else{
13152 utf8_printf(out, "%s%s", z, zTail);
13153 }
13154 sqlite3_free(zToFree);
13155 }
13156 static void printSchemaLineN(FILE *out, char *z, int n, const char *zTail){
13157 char c = z[n];
13158 z[n] = 0;
13159 printSchemaLine(out, z, zTail);
@@ -15338,11 +15482,11 @@
15482 ** There must be two or more spaces between the end of the command and the
15483 ** start of the description of what that command does.
15484 */
15485 static const char *(azHelp[]) = {
15486 #if defined(SQLITE_HAVE_ZLIB) && !defined(SQLITE_OMIT_VIRTUALTABLE) \
15487 && !defined(SQLITE_SHELL_FIDDLE)
15488 ".archive ... Manage SQL archives",
15489 " Each command must have exactly one of the following options:",
15490 " -c, --create Create a new archive",
15491 " -u, --update Add or update files with changed mtime",
15492 " -i, --insert Like -u but always add even if unchanged",
@@ -15364,23 +15508,23 @@
15508 " http://sqlite.org/cli.html#sqlite_archive_support",
15509 #endif
15510 #ifndef SQLITE_OMIT_AUTHORIZATION
15511 ".auth ON|OFF Show authorizer callbacks",
15512 #endif
15513 #ifndef SQLITE_SHELL_FIDDLE
15514 ".backup ?DB? FILE Backup DB (default \"main\") to FILE",
15515 " Options:",
15516 " --append Use the appendvfs",
15517 " --async Write to FILE without journal and fsync()",
15518 #endif
15519 ".bail on|off Stop after hitting an error. Default OFF",
15520 ".binary on|off Turn binary output on or off. Default OFF",
15521 #ifndef SQLITE_SHELL_FIDDLE
15522 ".cd DIRECTORY Change the working directory to DIRECTORY",
15523 #endif
15524 ".changes on|off Show number of rows changed by SQL",
15525 #ifndef SQLITE_SHELL_FIDDLE
15526 ".check GLOB Fail if output since .testcase does not match",
15527 ".clone NEWDB Clone data into NEWDB from the existing database",
15528 #endif
15529 ".connection [close] [#] Open or close an auxiliary database connection",
15530 ".databases List names and files of attached databases",
@@ -15402,15 +15546,15 @@
15546 #ifdef SQLITE_DEBUG
15547 " test Show raw EXPLAIN QUERY PLAN output",
15548 " trace Like \"full\" but enable \"PRAGMA vdbe_trace\"",
15549 #endif
15550 " trigger Like \"full\" but also show trigger bytecode",
15551 #ifndef SQLITE_SHELL_FIDDLE
15552 ".excel Display the output of next command in spreadsheet",
15553 " --bom Put a UTF8 byte-order mark on intermediate file",
15554 #endif
15555 #ifndef SQLITE_SHELL_FIDDLE
15556 ".exit ?CODE? Exit this program with return-code CODE",
15557 #endif
15558 ".expert EXPERIMENTAL. Suggest indexes for queries",
15559 ".explain ?on|off|auto? Change the EXPLAIN formatting mode. Default: auto",
15560 ".filectrl CMD ... Run various sqlite3_file_control() operations",
@@ -15417,11 +15561,11 @@
15561 " --schema SCHEMA Use SCHEMA instead of \"main\"",
15562 " --help Show CMD details",
15563 ".fullschema ?--indent? Show schema and the content of sqlite_stat tables",
15564 ".headers on|off Turn display of headers on or off",
15565 ".help ?-all? ?PATTERN? Show help text for PATTERN",
15566 #ifndef SQLITE_SHELL_FIDDLE
15567 ".import FILE TABLE Import data from FILE into TABLE",
15568 " Options:",
15569 " --ascii Use \\037 and \\036 as column and row separators",
15570 " --csv Use , and \\n as column and row separators",
15571 " --skip N Skip the first N rows of input",
@@ -15446,14 +15590,14 @@
15590 #endif
15591 ".limit ?LIMIT? ?VAL? Display or change the value of an SQLITE_LIMIT",
15592 ".lint OPTIONS Report potential schema issues.",
15593 " Options:",
15594 " fkey-indexes Find missing foreign key indexes",
15595 #if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_FIDDLE)
15596 ".load FILE ?ENTRY? Load an extension library",
15597 #endif
15598 #ifndef SQLITE_SHELL_FIDDLE
15599 ".log FILE|off Turn logging on or off. FILE can be stderr/stdout",
15600 #endif
15601 ".mode MODE ?OPTIONS? Set output mode",
15602 " MODE is one of:",
15603 " ascii Columns/rows delimited by 0x1F and 0x1E",
@@ -15476,15 +15620,15 @@
15620 " --wordwrap B Wrap or not at word boundaries per B (on/off)",
15621 " --ww Shorthand for \"--wordwrap 1\"",
15622 " --quote Quote output text as SQL literals",
15623 " --noquote Do not quote output text",
15624 " TABLE The name of SQL table used for \"insert\" mode",
15625 #ifndef SQLITE_SHELL_FIDDLE
15626 ".nonce STRING Suspend safe mode for one command if nonce matches",
15627 #endif
15628 ".nullvalue STRING Use STRING in place of NULL values",
15629 #ifndef SQLITE_SHELL_FIDDLE
15630 ".once ?OPTIONS? ?FILE? Output for the next SQL command only to FILE",
15631 " If FILE begins with '|' then open as a pipe",
15632 " --bom Put a UTF8 byte-order mark at the beginning",
15633 " -e Send output to the system text editor",
15634 " -x Send output as CSV to a spreadsheet (same as \".excel\")",
@@ -15502,11 +15646,11 @@
15646 #endif
15647 " --new Initialize FILE to an empty database",
15648 " --nofollow Do not follow symbolic links",
15649 " --readonly Open FILE readonly",
15650 " --zip FILE is a ZIP archive",
15651 #ifndef SQLITE_SHELL_FIDDLE
15652 ".output ?FILE? Send output to FILE or stdout if FILE is omitted",
15653 " If FILE begins with '|' then open it as a pipe.",
15654 " Options:",
15655 " --bom Prefix output with a UTF8 byte-order mark",
15656 " -e Send output to the system text editor",
@@ -15526,11 +15670,11 @@
15670 " --once Do no more than one progress interrupt",
15671 " --quiet|-q No output except at interrupts",
15672 " --reset Reset the count for each input and interrupt",
15673 #endif
15674 ".prompt MAIN CONTINUE Replace the standard prompts",
15675 #ifndef SQLITE_SHELL_FIDDLE
15676 ".quit Exit this program",
15677 ".read FILE Read input from FILE or command output",
15678 " If FILE begins with \"|\", it is a command that generates the input.",
15679 #endif
15680 #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
@@ -15539,11 +15683,11 @@
15683 " --recovery-db NAME Store recovery metadata in database file NAME",
15684 " --lost-and-found TABLE Alternative name for the lost-and-found table",
15685 " --no-rowids Do not attempt to recover rowid values",
15686 " that are not also INTEGER PRIMARY KEYs",
15687 #endif
15688 #ifndef SQLITE_SHELL_FIDDLE
15689 ".restore ?DB? FILE Restore content of DB (default \"main\") from FILE",
15690 ".save ?OPTIONS? FILE Write database to FILE (an alias for .backup ...)",
15691 #endif
15692 ".scanstats on|off Turn sqlite3_stmt_scanstatus() metrics on or off",
15693 ".schema ?PATTERN? Show the CREATE statements matching PATTERN",
@@ -15576,24 +15720,24 @@
15720 " --sha3-224 Use the sha3-224 algorithm",
15721 " --sha3-256 Use the sha3-256 algorithm (default)",
15722 " --sha3-384 Use the sha3-384 algorithm",
15723 " --sha3-512 Use the sha3-512 algorithm",
15724 " Any other argument is a LIKE pattern for tables to hash",
15725 #if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_FIDDLE)
15726 ".shell CMD ARGS... Run CMD ARGS... in a system shell",
15727 #endif
15728 ".show Show the current values for various settings",
15729 ".stats ?ARG? Show stats or turn stats on or off",
15730 " off Turn off automatic stat display",
15731 " on Turn on automatic stat display",
15732 " stmt Show statement stats",
15733 " vmstep Show the virtual machine step count only",
15734 #if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_FIDDLE)
15735 ".system CMD ARGS... Run CMD ARGS... in a system shell",
15736 #endif
15737 ".tables ?TABLE? List names of tables matching LIKE pattern TABLE",
15738 #ifndef SQLITE_SHELL_FIDDLE
15739 ".testcase NAME Begin redirecting output to 'testcase-out.txt'",
15740 #endif
15741 ".testctrl CMD ... Run various sqlite3_test_control() operations",
15742 " Run \".testctrl\" with no arguments for details",
15743 ".timeout MS Try opening locked tables for MS milliseconds",
@@ -16142,11 +16286,11 @@
16286 sqlite3_uint_init(p->db, 0, 0);
16287 sqlite3_decimal_init(p->db, 0, 0);
16288 sqlite3_regexp_init(p->db, 0, 0);
16289 sqlite3_ieee_init(p->db, 0, 0);
16290 sqlite3_series_init(p->db, 0, 0);
16291 #ifndef SQLITE_SHELL_FIDDLE
16292 sqlite3_fileio_init(p->db, 0, 0);
16293 sqlite3_completion_init(p->db, 0, 0);
16294 #endif
16295 #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
16296 sqlite3_dbdata_init(p->db, 0, 0);
@@ -19272,19 +19416,19 @@
19416 }
19417 }else
19418 #endif
19419
19420 #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) \
19421 && !defined(SQLITE_SHELL_FIDDLE)
19422 if( c=='a' && strncmp(azArg[0], "archive", n)==0 ){
19423 open_db(p, 0);
19424 failIfSafeMode(p, "cannot run .archive in safe mode");
19425 rc = arDotCommand(p, 0, azArg, nArg);
19426 }else
19427 #endif
19428
19429 #ifndef SQLITE_SHELL_FIDDLE
19430 if( (c=='b' && n>=3 && strncmp(azArg[0], "backup", n)==0)
19431 || (c=='s' && n>=3 && strncmp(azArg[0], "save", n)==0)
19432 ){
19433 const char *zDestFile = 0;
19434 const char *zDb = 0;
@@ -19349,11 +19493,11 @@
19493 utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(pDest));
19494 rc = 1;
19495 }
19496 close_db(pDest);
19497 }else
19498 #endif /* !defined(SQLITE_SHELL_FIDDLE) */
19499
19500 if( c=='b' && n>=3 && strncmp(azArg[0], "bail", n)==0 ){
19501 if( nArg==2 ){
19502 bail_on_error = booleanValue(azArg[1]);
19503 }else{
@@ -19380,11 +19524,11 @@
19524 */
19525 if( c=='b' && n>=3 && strncmp(azArg[0], "breakpoint", n)==0 ){
19526 test_breakpoint();
19527 }else
19528
19529 #ifndef SQLITE_SHELL_FIDDLE
19530 if( c=='c' && strcmp(azArg[0],"cd")==0 ){
19531 failIfSafeMode(p, "cannot run .cd in safe mode");
19532 if( nArg==2 ){
19533 #if defined(_WIN32) || defined(WIN32)
19534 wchar_t *z = sqlite3_win32_utf8_to_unicode(azArg[1]);
@@ -19400,11 +19544,11 @@
19544 }else{
19545 raw_printf(stderr, "Usage: .cd DIRECTORY\n");
19546 rc = 1;
19547 }
19548 }else
19549 #endif /* !defined(SQLITE_SHELL_FIDDLE) */
19550
19551 if( c=='c' && n>=3 && strncmp(azArg[0], "changes", n)==0 ){
19552 if( nArg==2 ){
19553 setOrClearFlag(p, SHFLG_CountChanges, azArg[1]);
19554 }else{
@@ -19411,11 +19555,11 @@
19555 raw_printf(stderr, "Usage: .changes on|off\n");
19556 rc = 1;
19557 }
19558 }else
19559
19560 #ifndef SQLITE_SHELL_FIDDLE
19561 /* Cancel output redirection, if it is currently set (by .testcase)
19562 ** Then read the content of the testcase-out.txt file and compare against
19563 ** azArg[1]. If there are differences, report an error and exit.
19564 */
19565 if( c=='c' && n>=3 && strncmp(azArg[0], "check", n)==0 ){
@@ -19436,23 +19580,23 @@
19580 utf8_printf(stdout, "testcase-%s ok\n", p->zTestcase);
19581 p->nCheck++;
19582 }
19583 sqlite3_free(zRes);
19584 }else
19585 #endif /* !defined(SQLITE_SHELL_FIDDLE) */
19586
19587 #ifndef SQLITE_SHELL_FIDDLE
19588 if( c=='c' && strncmp(azArg[0], "clone", n)==0 ){
19589 failIfSafeMode(p, "cannot run .clone in safe mode");
19590 if( nArg==2 ){
19591 tryToClone(p, azArg[1]);
19592 }else{
19593 raw_printf(stderr, "Usage: .clone FILENAME\n");
19594 rc = 1;
19595 }
19596 }else
19597 #endif /* !defined(SQLITE_SHELL_FIDDLE) */
19598
19599 if( c=='c' && strncmp(azArg[0], "connection", n)==0 ){
19600 if( nArg==1 ){
19601 /* List available connections */
19602 int i;
@@ -19737,11 +19881,11 @@
19881 raw_printf(stderr, "Usage: .eqp off|on|trace|trigger|full\n");
19882 rc = 1;
19883 }
19884 }else
19885
19886 #ifndef SQLITE_SHELL_FIDDLE
19887 if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){
19888 if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc);
19889 rc = 2;
19890 }else
19891 #endif
@@ -19997,11 +20141,11 @@
20141 }else{
20142 showHelp(p->out, 0);
20143 }
20144 }else
20145
20146 #ifndef SQLITE_SHELL_FIDDLE
20147 if( c=='i' && strncmp(azArg[0], "import", n)==0 ){
20148 char *zTable = 0; /* Insert data into this table */
20149 char *zSchema = 0; /* within this schema (may default to "main") */
20150 char *zFile = 0; /* Name of file to extra content from */
20151 sqlite3_stmt *pStmt = NULL; /* A statement */
@@ -20288,11 +20432,11 @@
20432 utf8_printf(p->out,
20433 "Added %d rows with %d errors using %d lines of input\n",
20434 sCtx.nRow, sCtx.nErr, sCtx.nLine-1);
20435 }
20436 }else
20437 #endif /* !defined(SQLITE_SHELL_FIDDLE) */
20438
20439 #ifndef SQLITE_UNTESTABLE
20440 if( c=='i' && strncmp(azArg[0], "imposter", n)==0 ){
20441 char *zSql;
20442 char *zCollist = 0;
@@ -20478,11 +20622,11 @@
20622 if( c=='l' && n>2 && strncmp(azArg[0], "lint", n)==0 ){
20623 open_db(p, 0);
20624 lintDotCommand(p, azArg, nArg);
20625 }else
20626
20627 #if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_FIDDLE)
20628 if( c=='l' && strncmp(azArg[0], "load", n)==0 ){
20629 const char *zFile, *zProc;
20630 char *zErrMsg = 0;
20631 failIfSafeMode(p, "cannot run .load in safe mode");
20632 if( nArg<2 ){
@@ -20500,11 +20644,11 @@
20644 rc = 1;
20645 }
20646 }else
20647 #endif
20648
20649 #ifndef SQLITE_SHELL_FIDDLE
20650 if( c=='l' && strncmp(azArg[0], "log", n)==0 ){
20651 failIfSafeMode(p, "cannot run .log in safe mode");
20652 if( nArg!=2 ){
20653 raw_printf(stderr, "Usage: .log FILENAME\n");
20654 rc = 1;
@@ -20637,11 +20781,11 @@
20781 rc = 1;
20782 }
20783 p->cMode = p->mode;
20784 }else
20785
20786 #ifndef SQLITE_SHELL_FIDDLE
20787 if( c=='n' && strcmp(azArg[0], "nonce")==0 ){
20788 if( nArg!=2 ){
20789 raw_printf(stderr, "Usage: .nonce NONCE\n");
20790 rc = 1;
20791 }else if( p->zNonce==0 || strcmp(azArg[1],p->zNonce)!=0 ){
@@ -20652,11 +20796,11 @@
20796 p->bSafeMode = 0;
20797 return 0; /* Return immediately to bypass the safe mode reset
20798 ** at the end of this procedure */
20799 }
20800 }else
20801 #endif /* !defined(SQLITE_SHELL_FIDDLE) */
20802
20803 if( c=='n' && strncmp(azArg[0], "nullvalue", n)==0 ){
20804 if( nArg==2 ){
20805 sqlite3_snprintf(sizeof(p->nullValue), p->nullValue,
20806 "%.*s", (int)ArraySize(p->nullValue)-1, azArg[1]);
@@ -20674,11 +20818,11 @@
20818 int openMode = SHELL_OPEN_UNSPEC;
20819
20820 /* Check for command-line arguments */
20821 for(iName=1; iName<nArg; iName++){
20822 const char *z = azArg[iName];
20823 #ifndef SQLITE_SHELL_FIDDLE
20824 if( optionMatch(z,"new") ){
20825 newFlag = 1;
20826 #ifdef SQLITE_HAVE_ZLIB
20827 }else if( optionMatch(z, "zip") ){
20828 openMode = SHELL_OPEN_ZIPFILE;
@@ -20696,11 +20840,11 @@
20840 openMode = SHELL_OPEN_HEXDB;
20841 }else if( optionMatch(z, "maxsize") && iName+1<nArg ){
20842 p->szMax = integerValue(azArg[++iName]);
20843 #endif /* SQLITE_OMIT_DESERIALIZE */
20844 }else
20845 #endif /* !SQLITE_SHELL_FIDDLE */
20846 if( z[0]=='-' ){
20847 utf8_printf(stderr, "unknown option: %s\n", z);
20848 rc = 1;
20849 goto meta_command_exit;
20850 }else if( zFN ){
@@ -20724,11 +20868,11 @@
20868 p->szMax = 0;
20869
20870 /* If a filename is specified, try to open it first */
20871 if( zFN || p->openMode==SHELL_OPEN_HEXDB ){
20872 if( newFlag && zFN && !p->bSafeMode ) shellDeleteFile(zFN);
20873 #ifndef SQLITE_SHELL_FIDDLE
20874 if( p->bSafeMode
20875 && p->openMode!=SHELL_OPEN_HEXDB
20876 && zFN
20877 && strcmp(zFN,":memory:")!=0
20878 ){
@@ -20757,11 +20901,11 @@
20901 p->pAuxDb->zDbFilename = 0;
20902 open_db(p, 0);
20903 }
20904 }else
20905
20906 #ifndef SQLITE_SHELL_FIDDLE
20907 if( (c=='o'
20908 && (strncmp(azArg[0], "output", n)==0||strncmp(azArg[0], "once", n)==0))
20909 || (c=='e' && n==5 && strcmp(azArg[0],"excel")==0)
20910 ){
20911 char *zFile = 0;
@@ -20873,11 +21017,11 @@
21017 sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", zFile);
21018 }
21019 }
21020 sqlite3_free(zFile);
21021 }else
21022 #endif /* !defined(SQLITE_SHELL_FIDDLE) */
21023
21024 if( c=='p' && n>=3 && strncmp(azArg[0], "parameter", n)==0 ){
21025 open_db(p,0);
21026 if( nArg<=1 ) goto parameter_syntax_error;
21027
@@ -21043,17 +21187,17 @@
21187 if( nArg >= 3) {
21188 strncpy(continuePrompt,azArg[2],(int)ArraySize(continuePrompt)-1);
21189 }
21190 }else
21191
21192 #ifndef SQLITE_SHELL_FIDDLE
21193 if( c=='q' && strncmp(azArg[0], "quit", n)==0 ){
21194 rc = 2;
21195 }else
21196 #endif
21197
21198 #ifndef SQLITE_SHELL_FIDDLE
21199 if( c=='r' && n>=3 && strncmp(azArg[0], "read", n)==0 ){
21200 FILE *inSaved = p->in;
21201 int savedLineno = p->lineno;
21202 failIfSafeMode(p, "cannot run .read in safe mode");
21203 if( nArg!=2 ){
@@ -21084,13 +21228,13 @@
21228 fclose(p->in);
21229 }
21230 p->in = inSaved;
21231 p->lineno = savedLineno;
21232 }else
21233 #endif /* !defined(SQLITE_SHELL_FIDDLE) */
21234
21235 #ifndef SQLITE_SHELL_FIDDLE
21236 if( c=='r' && n>=3 && strncmp(azArg[0], "restore", n)==0 ){
21237 const char *zSrcFile;
21238 const char *zDb;
21239 sqlite3 *pSrc;
21240 sqlite3_backup *pBackup;
@@ -21138,11 +21282,11 @@
21282 utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(p->db));
21283 rc = 1;
21284 }
21285 close_db(pSrc);
21286 }else
21287 #endif /* !defined(SQLITE_SHELL_FIDDLE) */
21288
21289 if( c=='s' && strncmp(azArg[0], "scanstats", n)==0 ){
21290 if( nArg==2 ){
21291 p->scanstatsOn = (u8)booleanValue(azArg[1]);
21292 #ifndef SQLITE_ENABLE_STMT_SCANSTATUS
@@ -21764,11 +21908,11 @@
21908 shell_exec(p, zSql, 0);
21909 }
21910 sqlite3_free(zSql);
21911 }else
21912
21913 #if !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_FIDDLE)
21914 if( c=='s'
21915 && (strncmp(azArg[0], "shell", n)==0 || strncmp(azArg[0],"system",n)==0)
21916 ){
21917 char *zCmd;
21918 int i, x;
@@ -21785,11 +21929,11 @@
21929 }
21930 x = zCmd!=0 ? system(zCmd) : 1;
21931 sqlite3_free(zCmd);
21932 if( x ) raw_printf(stderr, "System command returns %d\n", x);
21933 }else
21934 #endif /* !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_FIDDLE) */
21935
21936 if( c=='s' && strncmp(azArg[0], "show", n)==0 ){
21937 static const char *azBool[] = { "off", "on", "trigger", "full"};
21938 const char *zOut;
21939 int i;
@@ -21965,11 +22109,11 @@
22109
22110 for(ii=0; ii<nRow; ii++) sqlite3_free(azResult[ii]);
22111 sqlite3_free(azResult);
22112 }else
22113
22114 #ifndef SQLITE_SHELL_FIDDLE
22115 /* Begin redirecting output to the file "testcase-out.txt" */
22116 if( c=='t' && strcmp(azArg[0],"testcase")==0 ){
22117 output_reset(p);
22118 p->out = output_file_open("testcase-out.txt", 0);
22119 if( p->out==0 ){
@@ -21979,11 +22123,11 @@
22123 sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "%s", azArg[1]);
22124 }else{
22125 sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "?");
22126 }
22127 }else
22128 #endif /* !defined(SQLITE_SHELL_FIDDLE) */
22129
22130 #ifndef SQLITE_UNTESTABLE
22131 if( c=='t' && n>=8 && strncmp(azArg[0], "testctrl", n)==0 ){
22132 static const struct {
22133 const char *zCtrlName; /* Name of a test-control option */
@@ -22651,11 +22795,11 @@
22795
22796 static void echo_group_input(ShellState *p, const char *zDo){
22797 if( ShellHasFlag(p, SHFLG_Echo) ) utf8_printf(p->out, "%s\n", zDo);
22798 }
22799
22800 #ifdef SQLITE_SHELL_FIDDLE
22801 /*
22802 ** Alternate one_input_line() impl for wasm mode. This is not in the primary impl
22803 ** because we need the global shellState and cannot access it from that function
22804 ** without moving lots of code around (creating a larger/messier diff).
22805 */
@@ -22682,11 +22826,11 @@
22826 shell_check_oom(zLine);
22827 memcpy(zLine, zBegin, (size_t)nZ);
22828 zLine[nZ] = 0;
22829 return zLine;
22830 }
22831 #endif /* SQLITE_SHELL_FIDDLE */
22832
22833 /*
22834 ** Read input from *in and process it. If *in==0 then input
22835 ** is interactive - the user is typing it it. Otherwise, input
22836 ** is coming from a file or device. A prompt is issued and history
@@ -23065,11 +23209,11 @@
23209 # else
23210 # define SQLITE_SHELL_IS_UTF8 (1)
23211 # endif
23212 #endif
23213
23214 #ifdef SQLITE_SHELL_FIDDLE
23215 # define main fiddle_main
23216 #endif
23217
23218 #if SQLITE_SHELL_IS_UTF8
23219 int SQLITE_CDECL main(int argc, char **argv){
@@ -23079,11 +23223,11 @@
23223 #endif
23224 #ifdef SQLITE_DEBUG
23225 sqlite3_int64 mem_main_enter = sqlite3_memory_used();
23226 #endif
23227 char *zErrMsg = 0;
23228 #ifdef SQLITE_SHELL_FIDDLE
23229 # define data shellState
23230 #else
23231 ShellState data;
23232 #endif
23233 const char *zInitFile = 0;
@@ -23099,11 +23243,11 @@
23243 int argcToFree = 0;
23244 #endif
23245
23246 setBinaryMode(stdin, 0);
23247 setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
23248 #ifdef SQLITE_SHELL_FIDDLE
23249 stdin_is_interactive = 0;
23250 stdout_is_console = 1;
23251 #else
23252 stdin_is_interactive = isatty(0);
23253 stdout_is_console = isatty(1);
@@ -23361,11 +23505,11 @@
23505 utf8_printf(stderr,"%s: Error: no database filename specified\n", Argv0);
23506 return 1;
23507 #endif
23508 }
23509 data.out = stdout;
23510 #ifndef SQLITE_SHELL_FIDDLE
23511 sqlite3_appendvfs_init(0,0,0);
23512 #endif
23513
23514 /* Go ahead and open the database file if it already exists. If the
23515 ** file does not exist, delay opening it. This prevents empty database
@@ -23629,11 +23773,11 @@
23773 }else{
23774 data.in = stdin;
23775 rc = process_input(&data);
23776 }
23777 }
23778 #ifndef SQLITE_SHELL_FIDDLE
23779 /* In WASM mode we have to leave the db state in place so that
23780 ** client code can "push" SQL into it after this call returns. */
23781 free(azCmd);
23782 set_table_name(&data, 0);
23783 if( data.db ){
@@ -23664,16 +23808,16 @@
23808 if( sqlite3_memory_used()>mem_main_enter ){
23809 utf8_printf(stderr, "Memory leaked: %u bytes\n",
23810 (unsigned int)(sqlite3_memory_used()-mem_main_enter));
23811 }
23812 #endif
23813 #endif /* !SQLITE_SHELL_FIDDLE */
23814 return rc;
23815 }
23816
23817
23818 #ifdef SQLITE_SHELL_FIDDLE
23819 /* Only for emcc experimentation purposes. */
23820 int fiddle_experiment(int a,int b){
23821 return a + b;
23822 }
23823
@@ -23790,6 +23934,6 @@
23934 shellState.wasm.zPos = zSql;
23935 process_input(&shellState);
23936 memset(&shellState.wasm, 0, sizeof(shellState.wasm));
23937 }
23938 }
23939 #endif /* SQLITE_SHELL_FIDDLE */
23940
+1008 -640
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -1,8 +1,8 @@
11
/******************************************************************************
22
** This file is an amalgamation of many separate C source files from SQLite
3
-** version 3.39.2. By combining all the individual C code files into this
3
+** version 3.40.0. By combining all the individual C code files into this
44
** single large file, the entire code can be compiled as a single translation
55
** unit. This allows many compilers to do optimizations that would not be
66
** possible if the files were compiled separately. Performance improvements
77
** of 5% or more are commonly seen when SQLite is compiled as a single
88
** translation unit.
@@ -450,13 +450,13 @@
450450
**
451451
** See also: [sqlite3_libversion()],
452452
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453453
** [sqlite_version()] and [sqlite_source_id()].
454454
*/
455
-#define SQLITE_VERSION "3.39.2"
456
-#define SQLITE_VERSION_NUMBER 3039002
457
-#define SQLITE_SOURCE_ID "2022-07-21 12:26:01 9141e873c575b049ce7aeaf313d05966f1966087caf33a6c80d2416a28571a21"
455
+#define SQLITE_VERSION "3.40.0"
456
+#define SQLITE_VERSION_NUMBER 3040000
457
+#define SQLITE_SOURCE_ID "2022-09-02 21:19:24 da7af290960ab8a04a1f55cdc5eeac36b47fa194edf67f0a05daa4b7f2a4071c"
458458
459459
/*
460460
** CAPI3REF: Run-Time Library Version Numbers
461461
** KEYWORDS: sqlite3_version sqlite3_sourceid
462462
**
@@ -3728,10 +3728,13 @@
37283728
**
37293729
** ^(<dt>[SQLITE_OPEN_SHAREDCACHE]</dt>
37303730
** <dd>The database is opened [shared cache] enabled, overriding
37313731
** the default shared cache setting provided by
37323732
** [sqlite3_enable_shared_cache()].)^
3733
+** The [use of shared cache mode is discouraged] and hence shared cache
3734
+** capabilities may be omitted from many builds of SQLite. In such cases,
3735
+** this option is a no-op.
37333736
**
37343737
** ^(<dt>[SQLITE_OPEN_PRIVATECACHE]</dt>
37353738
** <dd>The database is opened [shared cache] disabled, overriding
37363739
** the default shared cache setting provided by
37373740
** [sqlite3_enable_shared_cache()].)^
@@ -3743,11 +3746,11 @@
37433746
** connection as soon as the connection is created. In addition to setting
37443747
** the extended result code mode, this flag also causes [sqlite3_open_v2()]
37453748
** to return an extended result code.</dd>
37463749
**
37473750
** [[OPEN_NOFOLLOW]] ^(<dt>[SQLITE_OPEN_NOFOLLOW]</dt>
3748
-** <dd>The database filename is not allowed to be a symbolic link</dd>
3751
+** <dd>The database filename is not allowed to contain a symbolic link</dd>
37493752
** </dl>)^
37503753
**
37513754
** If the 3rd parameter to sqlite3_open_v2() is not one of the
37523755
** required combinations shown above optionally combined with other
37533756
** [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits]
@@ -6769,11 +6772,11 @@
67696772
**
67706773
** ^The sqlite3_autovacuum_pages(D,C,P,X) interface registers a callback
67716774
** function C that is invoked prior to each autovacuum of the database
67726775
** file. ^The callback is passed a copy of the generic data pointer (P),
67736776
** the schema-name of the attached database that is being autovacuumed,
6774
-** the the size of the database file in pages, the number of free pages,
6777
+** the size of the database file in pages, the number of free pages,
67756778
** and the number of bytes per page, respectively. The callback should
67766779
** return the number of free pages that should be removed by the
67776780
** autovacuum. ^If the callback returns zero, then no autovacuum happens.
67786781
** ^If the value returned is greater than or equal to the number of
67796782
** free pages, then a complete autovacuum happens.
@@ -6889,10 +6892,15 @@
68896892
**
68906893
** ^(This routine enables or disables the sharing of the database cache
68916894
** and schema data structures between [database connection | connections]
68926895
** to the same database. Sharing is enabled if the argument is true
68936896
** and disabled if the argument is false.)^
6897
+**
6898
+** This interface is omitted if SQLite is compiled with
6899
+** [-DSQLITE_OMIT_SHARED_CACHE]. The [-DSQLITE_OMIT_SHARED_CACHE]
6900
+** compile-time option is recommended because the
6901
+** [use of shared cache mode is discouraged].
68946902
**
68956903
** ^Cache sharing is enabled and disabled for an entire process.
68966904
** This is a change as of SQLite [version 3.5.0] ([dateof:3.5.0]).
68976905
** In prior versions of SQLite,
68986906
** sharing was enabled or disabled for each thread separately.
@@ -6988,11 +6996,11 @@
69886996
** ^Setting the heap limits to zero disables the heap limiter mechanism.
69896997
**
69906998
** ^The soft heap limit may not be greater than the hard heap limit.
69916999
** ^If the hard heap limit is enabled and if sqlite3_soft_heap_limit(N)
69927000
** is invoked with a value of N that is greater than the hard heap limit,
6993
-** the the soft heap limit is set to the value of the hard heap limit.
7001
+** the soft heap limit is set to the value of the hard heap limit.
69947002
** ^The soft heap limit is automatically enabled whenever the hard heap
69957003
** limit is enabled. ^When sqlite3_hard_heap_limit64(N) is invoked and
69967004
** the soft heap limit is outside the range of 1..N, then the soft heap
69977005
** limit is set to N. ^Invoking sqlite3_soft_heap_limit64(0) when the
69987006
** hard heap limit is enabled makes the soft heap limit equal to the
@@ -9283,11 +9291,11 @@
92839291
** sqlite3_backup_init() is called and before the corresponding call to
92849292
** sqlite3_backup_finish(). SQLite does not currently check to see
92859293
** if the application incorrectly accesses the destination [database connection]
92869294
** and so no error code is reported, but the operations may malfunction
92879295
** nevertheless. Use of the destination database connection while a
9288
-** backup is in progress might also also cause a mutex deadlock.
9296
+** backup is in progress might also cause a mutex deadlock.
92899297
**
92909298
** If running in [shared cache mode], the application must
92919299
** guarantee that the shared cache used by the destination database
92929300
** is not accessed while the backup is running. In practice this means
92939301
** that the application must guarantee that the disk file being
@@ -9711,11 +9719,11 @@
97119719
** See the [sqlite3_wal_checkpoint_v2()] documentation for details on the
97129720
** meaning of each of these checkpoint modes.
97139721
*/
97149722
#define SQLITE_CHECKPOINT_PASSIVE 0 /* Do as much as possible w/o blocking */
97159723
#define SQLITE_CHECKPOINT_FULL 1 /* Wait for writers, then checkpoint */
9716
-#define SQLITE_CHECKPOINT_RESTART 2 /* Like FULL but wait for for readers */
9724
+#define SQLITE_CHECKPOINT_RESTART 2 /* Like FULL but wait for readers */
97179725
#define SQLITE_CHECKPOINT_TRUNCATE 3 /* Like RESTART but also truncate WAL */
97189726
97199727
/*
97209728
** CAPI3REF: Virtual Table Interface Configuration
97219729
**
@@ -13142,10 +13150,15 @@
1314213150
/******** End of fts5.h *********/
1314313151
1314413152
/************** End of sqlite3.h *********************************************/
1314513153
/************** Continuing where we left off in sqliteInt.h ******************/
1314613154
13155
+/*
13156
+** Reuse the STATIC_LRU for mutex access to sqlite3_temp_directory.
13157
+*/
13158
+#define SQLITE_MUTEX_STATIC_TEMPDIR SQLITE_MUTEX_STATIC_VFS1
13159
+
1314713160
/*
1314813161
** Include the configuration header output by 'configure' if we're using the
1314913162
** autoconf-based build
1315013163
*/
1315113164
#if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H)
@@ -15553,67 +15566,67 @@
1555315566
#define OP_Checkpoint 3
1555415567
#define OP_JournalMode 4
1555515568
#define OP_Vacuum 5
1555615569
#define OP_VFilter 6 /* jump, synopsis: iplan=r[P3] zplan='P4' */
1555715570
#define OP_VUpdate 7 /* synopsis: data=r[P3@P2] */
15558
-#define OP_Goto 8 /* jump */
15559
-#define OP_Gosub 9 /* jump */
15560
-#define OP_InitCoroutine 10 /* jump */
15561
-#define OP_Yield 11 /* jump */
15562
-#define OP_MustBeInt 12 /* jump */
15563
-#define OP_Jump 13 /* jump */
15564
-#define OP_Once 14 /* jump */
15565
-#define OP_If 15 /* jump */
15566
-#define OP_IfNot 16 /* jump */
15567
-#define OP_IsNullOrType 17 /* jump, synopsis: if typeof(r[P1]) IN (P3,5) goto P2 */
15568
-#define OP_IfNullRow 18 /* jump, synopsis: if P1.nullRow then r[P3]=NULL, goto P2 */
15571
+#define OP_Init 8 /* jump, synopsis: Start at P2 */
15572
+#define OP_Goto 9 /* jump */
15573
+#define OP_Gosub 10 /* jump */
15574
+#define OP_InitCoroutine 11 /* jump */
15575
+#define OP_Yield 12 /* jump */
15576
+#define OP_MustBeInt 13 /* jump */
15577
+#define OP_Jump 14 /* jump */
15578
+#define OP_Once 15 /* jump */
15579
+#define OP_If 16 /* jump */
15580
+#define OP_IfNot 17 /* jump */
15581
+#define OP_IsNullOrType 18 /* jump, synopsis: if typeof(r[P1]) IN (P3,5) goto P2 */
1556915582
#define OP_Not 19 /* same as TK_NOT, synopsis: r[P2]= !r[P1] */
15570
-#define OP_SeekLT 20 /* jump, synopsis: key=r[P3@P4] */
15571
-#define OP_SeekLE 21 /* jump, synopsis: key=r[P3@P4] */
15572
-#define OP_SeekGE 22 /* jump, synopsis: key=r[P3@P4] */
15573
-#define OP_SeekGT 23 /* jump, synopsis: key=r[P3@P4] */
15574
-#define OP_IfNotOpen 24 /* jump, synopsis: if( !csr[P1] ) goto P2 */
15575
-#define OP_IfNoHope 25 /* jump, synopsis: key=r[P3@P4] */
15576
-#define OP_NoConflict 26 /* jump, synopsis: key=r[P3@P4] */
15577
-#define OP_NotFound 27 /* jump, synopsis: key=r[P3@P4] */
15578
-#define OP_Found 28 /* jump, synopsis: key=r[P3@P4] */
15579
-#define OP_SeekRowid 29 /* jump, synopsis: intkey=r[P3] */
15580
-#define OP_NotExists 30 /* jump, synopsis: intkey=r[P3] */
15581
-#define OP_Last 31 /* jump */
15582
-#define OP_IfSmaller 32 /* jump */
15583
-#define OP_SorterSort 33 /* jump */
15584
-#define OP_Sort 34 /* jump */
15585
-#define OP_Rewind 35 /* jump */
15586
-#define OP_SorterNext 36 /* jump */
15587
-#define OP_Prev 37 /* jump */
15588
-#define OP_Next 38 /* jump */
15589
-#define OP_IdxLE 39 /* jump, synopsis: key=r[P3@P4] */
15590
-#define OP_IdxGT 40 /* jump, synopsis: key=r[P3@P4] */
15591
-#define OP_IdxLT 41 /* jump, synopsis: key=r[P3@P4] */
15592
-#define OP_IdxGE 42 /* jump, synopsis: key=r[P3@P4] */
15583
+#define OP_IfNullRow 20 /* jump, synopsis: if P1.nullRow then r[P3]=NULL, goto P2 */
15584
+#define OP_SeekLT 21 /* jump, synopsis: key=r[P3@P4] */
15585
+#define OP_SeekLE 22 /* jump, synopsis: key=r[P3@P4] */
15586
+#define OP_SeekGE 23 /* jump, synopsis: key=r[P3@P4] */
15587
+#define OP_SeekGT 24 /* jump, synopsis: key=r[P3@P4] */
15588
+#define OP_IfNotOpen 25 /* jump, synopsis: if( !csr[P1] ) goto P2 */
15589
+#define OP_IfNoHope 26 /* jump, synopsis: key=r[P3@P4] */
15590
+#define OP_NoConflict 27 /* jump, synopsis: key=r[P3@P4] */
15591
+#define OP_NotFound 28 /* jump, synopsis: key=r[P3@P4] */
15592
+#define OP_Found 29 /* jump, synopsis: key=r[P3@P4] */
15593
+#define OP_SeekRowid 30 /* jump, synopsis: intkey=r[P3] */
15594
+#define OP_NotExists 31 /* jump, synopsis: intkey=r[P3] */
15595
+#define OP_Last 32 /* jump */
15596
+#define OP_IfSmaller 33 /* jump */
15597
+#define OP_SorterSort 34 /* jump */
15598
+#define OP_Sort 35 /* jump */
15599
+#define OP_Rewind 36 /* jump */
15600
+#define OP_SorterNext 37 /* jump */
15601
+#define OP_Prev 38 /* jump */
15602
+#define OP_Next 39 /* jump */
15603
+#define OP_IdxLE 40 /* jump, synopsis: key=r[P3@P4] */
15604
+#define OP_IdxGT 41 /* jump, synopsis: key=r[P3@P4] */
15605
+#define OP_IdxLT 42 /* jump, synopsis: key=r[P3@P4] */
1559315606
#define OP_Or 43 /* same as TK_OR, synopsis: r[P3]=(r[P1] || r[P2]) */
1559415607
#define OP_And 44 /* same as TK_AND, synopsis: r[P3]=(r[P1] && r[P2]) */
15595
-#define OP_RowSetRead 45 /* jump, synopsis: r[P3]=rowset(P1) */
15596
-#define OP_RowSetTest 46 /* jump, synopsis: if r[P3] in rowset(P1) goto P2 */
15597
-#define OP_Program 47 /* jump */
15598
-#define OP_FkIfZero 48 /* jump, synopsis: if fkctr[P1]==0 goto P2 */
15599
-#define OP_IfPos 49 /* jump, synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */
15608
+#define OP_IdxGE 45 /* jump, synopsis: key=r[P3@P4] */
15609
+#define OP_RowSetRead 46 /* jump, synopsis: r[P3]=rowset(P1) */
15610
+#define OP_RowSetTest 47 /* jump, synopsis: if r[P3] in rowset(P1) goto P2 */
15611
+#define OP_Program 48 /* jump */
15612
+#define OP_FkIfZero 49 /* jump, synopsis: if fkctr[P1]==0 goto P2 */
1560015613
#define OP_IsNull 50 /* jump, same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */
1560115614
#define OP_NotNull 51 /* jump, same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */
1560215615
#define OP_Ne 52 /* jump, same as TK_NE, synopsis: IF r[P3]!=r[P1] */
1560315616
#define OP_Eq 53 /* jump, same as TK_EQ, synopsis: IF r[P3]==r[P1] */
1560415617
#define OP_Gt 54 /* jump, same as TK_GT, synopsis: IF r[P3]>r[P1] */
1560515618
#define OP_Le 55 /* jump, same as TK_LE, synopsis: IF r[P3]<=r[P1] */
1560615619
#define OP_Lt 56 /* jump, same as TK_LT, synopsis: IF r[P3]<r[P1] */
1560715620
#define OP_Ge 57 /* jump, same as TK_GE, synopsis: IF r[P3]>=r[P1] */
1560815621
#define OP_ElseEq 58 /* jump, same as TK_ESCAPE */
15609
-#define OP_IfNotZero 59 /* jump, synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
15610
-#define OP_DecrJumpZero 60 /* jump, synopsis: if (--r[P1])==0 goto P2 */
15611
-#define OP_IncrVacuum 61 /* jump */
15612
-#define OP_VNext 62 /* jump */
15613
-#define OP_Filter 63 /* jump, synopsis: if key(P3@P4) not in filter(P1) goto P2 */
15614
-#define OP_Init 64 /* jump, synopsis: Start at P2 */
15622
+#define OP_IfPos 59 /* jump, synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */
15623
+#define OP_IfNotZero 60 /* jump, synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
15624
+#define OP_DecrJumpZero 61 /* jump, synopsis: if (--r[P1])==0 goto P2 */
15625
+#define OP_IncrVacuum 62 /* jump */
15626
+#define OP_VNext 63 /* jump */
15627
+#define OP_Filter 64 /* jump, synopsis: if key(P3@P4) not in filter(P1) goto P2 */
1561515628
#define OP_PureFunc 65 /* synopsis: r[P3]=func(r[P2@NP]) */
1561615629
#define OP_Function 66 /* synopsis: r[P3]=func(r[P2@NP]) */
1561715630
#define OP_Return 67
1561815631
#define OP_EndCoroutine 68
1561915632
#define OP_HaltIfNull 69 /* synopsis: if r[P3]=null halt */
@@ -15745,17 +15758,17 @@
1574515758
#define OPFLG_IN3 0x08 /* in3: P3 is an input */
1574615759
#define OPFLG_OUT2 0x10 /* out2: P2 is an output */
1574715760
#define OPFLG_OUT3 0x20 /* out3: P3 is an output */
1574815761
#define OPFLG_INITIALIZER {\
1574915762
/* 0 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00,\
15750
-/* 8 */ 0x01, 0x01, 0x01, 0x03, 0x03, 0x01, 0x01, 0x03,\
15751
-/* 16 */ 0x03, 0x03, 0x01, 0x12, 0x09, 0x09, 0x09, 0x09,\
15752
-/* 24 */ 0x01, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x01,\
15763
+/* 8 */ 0x01, 0x01, 0x01, 0x01, 0x03, 0x03, 0x01, 0x01,\
15764
+/* 16 */ 0x03, 0x03, 0x03, 0x12, 0x01, 0x09, 0x09, 0x09,\
15765
+/* 24 */ 0x09, 0x01, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,\
1575315766
/* 32 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\
15754
-/* 40 */ 0x01, 0x01, 0x01, 0x26, 0x26, 0x23, 0x0b, 0x01,\
15755
-/* 48 */ 0x01, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\
15756
-/* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x03, 0x01, 0x01, 0x01,\
15767
+/* 40 */ 0x01, 0x01, 0x01, 0x26, 0x26, 0x01, 0x23, 0x0b,\
15768
+/* 48 */ 0x01, 0x01, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\
15769
+/* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x03, 0x03, 0x01, 0x01,\
1575715770
/* 64 */ 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x00, 0x10,\
1575815771
/* 72 */ 0x10, 0x10, 0x00, 0x10, 0x00, 0x10, 0x10, 0x00,\
1575915772
/* 80 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x02, 0x02,\
1576015773
/* 88 */ 0x02, 0x00, 0x00, 0x12, 0x1e, 0x20, 0x00, 0x00,\
1576115774
/* 96 */ 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x26, 0x26,\
@@ -15857,10 +15870,11 @@
1585715870
SQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe*, int addr, const char *zP4, int N);
1585815871
SQLITE_PRIVATE void sqlite3VdbeAppendP4(Vdbe*, void *pP4, int p4type);
1585915872
SQLITE_PRIVATE void sqlite3VdbeSetP4KeyInfo(Parse*, Index*);
1586015873
SQLITE_PRIVATE void sqlite3VdbeUsesBtree(Vdbe*, int);
1586115874
SQLITE_PRIVATE VdbeOp *sqlite3VdbeGetOp(Vdbe*, int);
15875
+SQLITE_PRIVATE VdbeOp *sqlite3VdbeGetLastOp(Vdbe*);
1586215876
SQLITE_PRIVATE int sqlite3VdbeMakeLabel(Parse*);
1586315877
SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe*);
1586415878
SQLITE_PRIVATE void sqlite3VdbeReusable(Vdbe*);
1586515879
SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe*);
1586615880
SQLITE_PRIVATE void sqlite3VdbeMakeReady(Vdbe*,Parse*);
@@ -16741,10 +16755,11 @@
1674116755
void *pMiddle; /* First byte past end of full-size buffers and
1674216756
** the first byte of LOOKASIDE_SMALL buffers */
1674316757
#endif /* SQLITE_OMIT_TWOSIZE_LOOKASIDE */
1674416758
void *pStart; /* First byte of available memory space */
1674516759
void *pEnd; /* First byte past end of available space */
16760
+ void *pTrueEnd; /* True value of pEnd, when db->pnBytesFreed!=0 */
1674616761
};
1674716762
struct LookasideSlot {
1674816763
LookasideSlot *pNext; /* Next buffer in the list of free buffers */
1674916764
};
1675016765
@@ -18189,11 +18204,11 @@
1818918204
#define EP_xIsSelect 0x001000 /* x.pSelect is valid (otherwise x.pList is) */
1819018205
#define EP_Skip 0x002000 /* Operator does not contribute to affinity */
1819118206
#define EP_Reduced 0x004000 /* Expr struct EXPR_REDUCEDSIZE bytes only */
1819218207
#define EP_Win 0x008000 /* Contains window functions */
1819318208
#define EP_TokenOnly 0x010000 /* Expr struct EXPR_TOKENONLYSIZE bytes only */
18194
-#define EP_MemToken 0x020000 /* Need to sqlite3DbFree() Expr.zToken */
18209
+ /* 0x020000 // Available for reuse */
1819518210
#define EP_IfNullRow 0x040000 /* The TK_IF_NULL_ROW opcode */
1819618211
#define EP_Unlikely 0x080000 /* unlikely() or likelihood() function */
1819718212
#define EP_ConstFunc 0x100000 /* A SQLITE_FUNC_CONSTANT or _SLOCHNG function */
1819818213
#define EP_CanBeNull 0x200000 /* Can be null despite NOT NULL constraint */
1819918214
#define EP_Subquery 0x400000 /* Tree contains a TK_SELECT operator */
@@ -19667,10 +19682,11 @@
1966719682
SQLITE_PRIVATE void *sqlite3Realloc(void*, u64);
1966819683
SQLITE_PRIVATE void *sqlite3DbReallocOrFree(sqlite3 *, void *, u64);
1966919684
SQLITE_PRIVATE void *sqlite3DbRealloc(sqlite3 *, void *, u64);
1967019685
SQLITE_PRIVATE void sqlite3DbFree(sqlite3*, void*);
1967119686
SQLITE_PRIVATE void sqlite3DbFreeNN(sqlite3*, void*);
19687
+SQLITE_PRIVATE void sqlite3DbNNFreeNN(sqlite3*, void*);
1967219688
SQLITE_PRIVATE int sqlite3MallocSize(const void*);
1967319689
SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3*, const void*);
1967419690
SQLITE_PRIVATE void *sqlite3PageMalloc(int);
1967519691
SQLITE_PRIVATE void sqlite3PageFree(void*);
1967619692
SQLITE_PRIVATE void sqlite3MemSetDefault(void);
@@ -20191,10 +20207,11 @@
2019120207
SQLITE_PRIVATE int sqlite3FixSrcList(DbFixer*, SrcList*);
2019220208
SQLITE_PRIVATE int sqlite3FixSelect(DbFixer*, Select*);
2019320209
SQLITE_PRIVATE int sqlite3FixExpr(DbFixer*, Expr*);
2019420210
SQLITE_PRIVATE int sqlite3FixTriggerStep(DbFixer*, TriggerStep*);
2019520211
SQLITE_PRIVATE int sqlite3RealSameAsInt(double,sqlite3_int64);
20212
+SQLITE_PRIVATE i64 sqlite3RealToI64(double);
2019620213
SQLITE_PRIVATE void sqlite3Int64ToText(i64,char*);
2019720214
SQLITE_PRIVATE int sqlite3AtoF(const char *z, double*, int, u8);
2019820215
SQLITE_PRIVATE int sqlite3GetInt32(const char *, int*);
2019920216
SQLITE_PRIVATE int sqlite3GetUInt32(const char*, u32*);
2020020217
SQLITE_PRIVATE int sqlite3Atoi(const char*);
@@ -21637,13 +21654,10 @@
2163721654
"OMIT_WSD",
2163821655
#endif
2163921656
#ifdef SQLITE_OMIT_XFER_OPT
2164021657
"OMIT_XFER_OPT",
2164121658
#endif
21642
-#ifdef SQLITE_PCACHE_SEPARATE_HEADER
21643
- "PCACHE_SEPARATE_HEADER",
21644
-#endif
2164521659
#ifdef SQLITE_PERFORMANCE_TRACE
2164621660
"PERFORMANCE_TRACE",
2164721661
#endif
2164821662
#ifdef SQLITE_POWERSAFE_OVERWRITE
2164921663
# if SQLITE_POWERSAFE_OVERWRITE != 1
@@ -22592,11 +22606,11 @@
2259222606
** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare()
2259322607
** is really a pointer to an instance of this structure.
2259422608
*/
2259522609
struct Vdbe {
2259622610
sqlite3 *db; /* The database connection that owns this statement */
22597
- Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */
22611
+ Vdbe **ppVPrev,*pVNext; /* Linked list of VDBEs with the same Vdbe.db */
2259822612
Parse *pParse; /* Parsing context used to create this Vdbe */
2259922613
ynVar nVar; /* Number of entries in aVar[] */
2260022614
int nMem; /* Number of memory locations currently allocated */
2260122615
int nCursor; /* Number of slots in apCsr[] */
2260222616
u32 cacheCtr; /* VdbeCursor row cache generation counter */
@@ -23150,10 +23164,12 @@
2315023164
int i; /* Used to iterate through schemas */
2315123165
int nByte = 0; /* Used to accumulate return value */
2315223166
2315323167
sqlite3BtreeEnterAll(db);
2315423168
db->pnBytesFreed = &nByte;
23169
+ assert( db->lookaside.pEnd==db->lookaside.pTrueEnd );
23170
+ db->lookaside.pEnd = db->lookaside.pStart;
2315523171
for(i=0; i<db->nDb; i++){
2315623172
Schema *pSchema = db->aDb[i].pSchema;
2315723173
if( ALWAYS(pSchema!=0) ){
2315823174
HashElem *p;
2315923175
@@ -23175,10 +23191,11 @@
2317523191
sqlite3DeleteTable(db, (Table *)sqliteHashData(p));
2317623192
}
2317723193
}
2317823194
}
2317923195
db->pnBytesFreed = 0;
23196
+ db->lookaside.pEnd = db->lookaside.pTrueEnd;
2318023197
sqlite3BtreeLeaveAll(db);
2318123198
2318223199
*pHighwater = 0;
2318323200
*pCurrent = nByte;
2318423201
break;
@@ -23192,13 +23209,16 @@
2319223209
case SQLITE_DBSTATUS_STMT_USED: {
2319323210
struct Vdbe *pVdbe; /* Used to iterate through VMs */
2319423211
int nByte = 0; /* Used to accumulate return value */
2319523212
2319623213
db->pnBytesFreed = &nByte;
23197
- for(pVdbe=db->pVdbe; pVdbe; pVdbe=pVdbe->pNext){
23214
+ assert( db->lookaside.pEnd==db->lookaside.pTrueEnd );
23215
+ db->lookaside.pEnd = db->lookaside.pStart;
23216
+ for(pVdbe=db->pVdbe; pVdbe; pVdbe=pVdbe->pVNext){
2319823217
sqlite3VdbeDelete(pVdbe);
2319923218
}
23219
+ db->lookaside.pEnd = db->lookaside.pTrueEnd;
2320023220
db->pnBytesFreed = 0;
2320123221
2320223222
*pHighwater = 0; /* IMP: R-64479-57858 */
2320323223
*pCurrent = nByte;
2320423224
@@ -23530,11 +23550,11 @@
2353023550
X1 = 36525*(Y+4716)/100;
2353123551
X2 = 306001*(M+1)/10000;
2353223552
p->iJD = (sqlite3_int64)((X1 + X2 + D + B - 1524.5 ) * 86400000);
2353323553
p->validJD = 1;
2353423554
if( p->validHMS ){
23535
- p->iJD += p->h*3600000 + p->m*60000 + (sqlite3_int64)(p->s*1000);
23555
+ p->iJD += p->h*3600000 + p->m*60000 + (sqlite3_int64)(p->s*1000 + 0.5);
2353623556
if( p->validTZ ){
2353723557
p->iJD -= p->tz*60000;
2353823558
p->validYMD = 0;
2353923559
p->validHMS = 0;
2354023560
p->validTZ = 0;
@@ -24039,11 +24059,11 @@
2403924059
** weekday N where 0==Sunday, 1==Monday, and so forth. If the
2404024060
** date is already on the appropriate weekday, this is a no-op.
2404124061
*/
2404224062
if( sqlite3_strnicmp(z, "weekday ", 8)==0
2404324063
&& sqlite3AtoF(&z[8], &r, sqlite3Strlen30(&z[8]), SQLITE_UTF8)>0
24044
- && (n=(int)r)==r && n>=0 && r<7 ){
24064
+ && r>=0.0 && r<7.0 && (n=(int)r)==r ){
2404524065
sqlite3_int64 Z;
2404624066
computeYMD_HMS(p);
2404724067
p->validTZ = 0;
2404824068
p->validJD = 0;
2404924069
computeJD(p);
@@ -24837,10 +24857,11 @@
2483724857
DO_OS_MALLOC_TEST(0);
2483824858
/* 0x87f7f is a mask of SQLITE_OPEN_ flags that are valid to be passed
2483924859
** down into the VFS layer. Some SQLITE_OPEN_ flags (for example,
2484024860
** SQLITE_OPEN_FULLMUTEX or SQLITE_OPEN_SHAREDCACHE) are blocked before
2484124861
** reaching the VFS. */
24862
+ assert( zPath || (flags & SQLITE_OPEN_EXCLUSIVE) );
2484224863
rc = pVfs->xOpen(pVfs, zPath, pFile, flags & 0x1087f7f, pFlagsOut);
2484324864
assert( rc==SQLITE_OK || pFile->pMethods==0 );
2484424865
return rc;
2484524866
}
2484624867
SQLITE_PRIVATE int sqlite3OsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
@@ -29102,11 +29123,11 @@
2910229123
/*
2910329124
** TRUE if p is a lookaside memory allocation from db
2910429125
*/
2910529126
#ifndef SQLITE_OMIT_LOOKASIDE
2910629127
static int isLookaside(sqlite3 *db, const void *p){
29107
- return SQLITE_WITHIN(p, db->lookaside.pStart, db->lookaside.pEnd);
29128
+ return SQLITE_WITHIN(p, db->lookaside.pStart, db->lookaside.pTrueEnd);
2910829129
}
2910929130
#else
2911029131
#define isLookaside(A,B) 0
2911129132
#endif
2911229133
@@ -29126,22 +29147,20 @@
2912629147
#endif
2912729148
}
2912829149
SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3 *db, const void *p){
2912929150
assert( p!=0 );
2913029151
#ifdef SQLITE_DEBUG
29131
- if( db==0 || !isLookaside(db,p) ){
29132
- if( db==0 ){
29133
- assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) );
29134
- assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );
29135
- }else{
29136
- assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );
29137
- assert( sqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );
29138
- }
29152
+ if( db==0 ){
29153
+ assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) );
29154
+ assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );
29155
+ }else if( !isLookaside(db,p) ){
29156
+ assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );
29157
+ assert( sqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );
2913929158
}
2914029159
#endif
2914129160
if( db ){
29142
- if( ((uptr)p)<(uptr)(db->lookaside.pEnd) ){
29161
+ if( ((uptr)p)<(uptr)(db->lookaside.pTrueEnd) ){
2914329162
#ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
2914429163
if( ((uptr)p)>=(uptr)(db->lookaside.pMiddle) ){
2914529164
assert( sqlite3_mutex_held(db->mutex) );
2914629165
return LOOKASIDE_SMALL;
2914729166
}
@@ -29193,18 +29212,15 @@
2919329212
*/
2919429213
SQLITE_PRIVATE void sqlite3DbFreeNN(sqlite3 *db, void *p){
2919529214
assert( db==0 || sqlite3_mutex_held(db->mutex) );
2919629215
assert( p!=0 );
2919729216
if( db ){
29198
- if( db->pnBytesFreed ){
29199
- measureAllocationSize(db, p);
29200
- return;
29201
- }
2920229217
if( ((uptr)p)<(uptr)(db->lookaside.pEnd) ){
2920329218
#ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
2920429219
if( ((uptr)p)>=(uptr)(db->lookaside.pMiddle) ){
2920529220
LookasideSlot *pBuf = (LookasideSlot*)p;
29221
+ assert( db->pnBytesFreed==0 );
2920629222
#ifdef SQLITE_DEBUG
2920729223
memset(p, 0xaa, LOOKASIDE_SMALL); /* Trash freed content */
2920829224
#endif
2920929225
pBuf->pNext = db->lookaside.pSmallFree;
2921029226
db->lookaside.pSmallFree = pBuf;
@@ -29211,24 +29227,66 @@
2921129227
return;
2921229228
}
2921329229
#endif /* SQLITE_OMIT_TWOSIZE_LOOKASIDE */
2921429230
if( ((uptr)p)>=(uptr)(db->lookaside.pStart) ){
2921529231
LookasideSlot *pBuf = (LookasideSlot*)p;
29232
+ assert( db->pnBytesFreed==0 );
2921629233
#ifdef SQLITE_DEBUG
2921729234
memset(p, 0xaa, db->lookaside.szTrue); /* Trash freed content */
2921829235
#endif
2921929236
pBuf->pNext = db->lookaside.pFree;
2922029237
db->lookaside.pFree = pBuf;
2922129238
return;
2922229239
}
2922329240
}
29241
+ if( db->pnBytesFreed ){
29242
+ measureAllocationSize(db, p);
29243
+ return;
29244
+ }
2922429245
}
2922529246
assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );
2922629247
assert( sqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );
2922729248
assert( db!=0 || sqlite3MemdebugNoType(p, MEMTYPE_LOOKASIDE) );
2922829249
sqlite3MemdebugSetType(p, MEMTYPE_HEAP);
2922929250
sqlite3_free(p);
29251
+}
29252
+SQLITE_PRIVATE void sqlite3DbNNFreeNN(sqlite3 *db, void *p){
29253
+ assert( db!=0 );
29254
+ assert( sqlite3_mutex_held(db->mutex) );
29255
+ assert( p!=0 );
29256
+ if( ((uptr)p)<(uptr)(db->lookaside.pEnd) ){
29257
+#ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE
29258
+ if( ((uptr)p)>=(uptr)(db->lookaside.pMiddle) ){
29259
+ LookasideSlot *pBuf = (LookasideSlot*)p;
29260
+ assert( db->pnBytesFreed==0 );
29261
+#ifdef SQLITE_DEBUG
29262
+ memset(p, 0xaa, LOOKASIDE_SMALL); /* Trash freed content */
29263
+#endif
29264
+ pBuf->pNext = db->lookaside.pSmallFree;
29265
+ db->lookaside.pSmallFree = pBuf;
29266
+ return;
29267
+ }
29268
+#endif /* SQLITE_OMIT_TWOSIZE_LOOKASIDE */
29269
+ if( ((uptr)p)>=(uptr)(db->lookaside.pStart) ){
29270
+ LookasideSlot *pBuf = (LookasideSlot*)p;
29271
+ assert( db->pnBytesFreed==0 );
29272
+#ifdef SQLITE_DEBUG
29273
+ memset(p, 0xaa, db->lookaside.szTrue); /* Trash freed content */
29274
+#endif
29275
+ pBuf->pNext = db->lookaside.pFree;
29276
+ db->lookaside.pFree = pBuf;
29277
+ return;
29278
+ }
29279
+ }
29280
+ if( db->pnBytesFreed ){
29281
+ measureAllocationSize(db, p);
29282
+ return;
29283
+ }
29284
+ assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );
29285
+ assert( sqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );
29286
+ sqlite3MemdebugSetType(p, MEMTYPE_HEAP);
29287
+ sqlite3_free(p);
2923029288
}
2923129289
SQLITE_PRIVATE void sqlite3DbFree(sqlite3 *db, void *p){
2923229290
assert( db==0 || sqlite3_mutex_held(db->mutex) );
2923329291
if( p ) sqlite3DbFreeNN(db, p);
2923429292
}
@@ -29561,12 +29619,17 @@
2956129619
if( db->nVdbeExec>0 ){
2956229620
AtomicStore(&db->u1.isInterrupted, 1);
2956329621
}
2956429622
DisableLookaside;
2956529623
if( db->pParse ){
29624
+ Parse *pParse;
2956629625
sqlite3ErrorMsg(db->pParse, "out of memory");
2956729626
db->pParse->rc = SQLITE_NOMEM_BKPT;
29627
+ for(pParse=db->pParse->pOuterParse; pParse; pParse = pParse->pOuterParse){
29628
+ pParse->nErr++;
29629
+ pParse->rc = SQLITE_NOMEM;
29630
+ }
2956829631
}
2956929632
}
2957029633
return 0;
2957129634
}
2957229635
@@ -32332,20 +32395,45 @@
3233232395
3233332396
/* All threads share a single random number generator.
3233432397
** This structure is the current state of the generator.
3233532398
*/
3233632399
static SQLITE_WSD struct sqlite3PrngType {
32337
- unsigned char isInit; /* True if initialized */
32338
- unsigned char i, j; /* State variables */
32339
- unsigned char s[256]; /* State variables */
32400
+ u32 s[16]; /* 64 bytes of chacha20 state */
32401
+ u8 out[64]; /* Output bytes */
32402
+ u8 n; /* Output bytes remaining */
3234032403
} sqlite3Prng;
3234132404
32405
+
32406
+/* The RFC-7539 ChaCha20 block function
32407
+*/
32408
+#define ROTL(a,b) (((a) << (b)) | ((a) >> (32 - (b))))
32409
+#define QR(a, b, c, d) ( \
32410
+ a += b, d ^= a, d = ROTL(d,16), \
32411
+ c += d, b ^= c, b = ROTL(b,12), \
32412
+ a += b, d ^= a, d = ROTL(d, 8), \
32413
+ c += d, b ^= c, b = ROTL(b, 7))
32414
+static void chacha_block(u32 *out, const u32 *in){
32415
+ int i;
32416
+ u32 x[16];
32417
+ memcpy(x, in, 64);
32418
+ for(i=0; i<10; i++){
32419
+ QR(x[0], x[4], x[ 8], x[12]);
32420
+ QR(x[1], x[5], x[ 9], x[13]);
32421
+ QR(x[2], x[6], x[10], x[14]);
32422
+ QR(x[3], x[7], x[11], x[15]);
32423
+ QR(x[0], x[5], x[10], x[15]);
32424
+ QR(x[1], x[6], x[11], x[12]);
32425
+ QR(x[2], x[7], x[ 8], x[13]);
32426
+ QR(x[3], x[4], x[ 9], x[14]);
32427
+ }
32428
+ for(i=0; i<16; i++) out[i] = x[i]+in[i];
32429
+}
32430
+
3234232431
/*
3234332432
** Return N random bytes.
3234432433
*/
3234532434
SQLITE_API void sqlite3_randomness(int N, void *pBuf){
32346
- unsigned char t;
3234732435
unsigned char *zBuf = pBuf;
3234832436
3234932437
/* The "wsdPrng" macro will resolve to the pseudo-random number generator
3235032438
** state vector. If writable static data is unsupported on the target,
3235132439
** we have to locate the state vector at run-time. In the more common
@@ -32371,57 +32459,50 @@
3237132459
mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PRNG);
3237232460
#endif
3237332461
3237432462
sqlite3_mutex_enter(mutex);
3237532463
if( N<=0 || pBuf==0 ){
32376
- wsdPrng.isInit = 0;
32464
+ wsdPrng.s[0] = 0;
3237732465
sqlite3_mutex_leave(mutex);
3237832466
return;
3237932467
}
3238032468
3238132469
/* Initialize the state of the random number generator once,
32382
- ** the first time this routine is called. The seed value does
32383
- ** not need to contain a lot of randomness since we are not
32384
- ** trying to do secure encryption or anything like that...
32385
- **
32386
- ** Nothing in this file or anywhere else in SQLite does any kind of
32387
- ** encryption. The RC4 algorithm is being used as a PRNG (pseudo-random
32388
- ** number generator) not as an encryption device.
32470
+ ** the first time this routine is called.
3238932471
*/
32390
- if( !wsdPrng.isInit ){
32472
+ if( wsdPrng.s[0]==0 ){
3239132473
sqlite3_vfs *pVfs = sqlite3_vfs_find(0);
32392
- int i;
32393
- char k[256];
32394
- wsdPrng.j = 0;
32395
- wsdPrng.i = 0;
32474
+ static const u32 chacha20_init[] = {
32475
+ 0x61707865, 0x3320646e, 0x79622d32, 0x6b206574
32476
+ };
32477
+ memcpy(&wsdPrng.s[0], chacha20_init, 16);
3239632478
if( NEVER(pVfs==0) ){
32397
- memset(k, 0, sizeof(k));
32479
+ memset(&wsdPrng.s[4], 0, 44);
3239832480
}else{
32399
- sqlite3OsRandomness(pVfs, 256, k);
32400
- }
32401
- for(i=0; i<256; i++){
32402
- wsdPrng.s[i] = (u8)i;
32403
- }
32404
- for(i=0; i<256; i++){
32405
- wsdPrng.j += wsdPrng.s[i] + k[i];
32406
- t = wsdPrng.s[wsdPrng.j];
32407
- wsdPrng.s[wsdPrng.j] = wsdPrng.s[i];
32408
- wsdPrng.s[i] = t;
32409
- }
32410
- wsdPrng.isInit = 1;
32481
+ sqlite3OsRandomness(pVfs, 44, (char*)&wsdPrng.s[4]);
32482
+ }
32483
+ wsdPrng.s[15] = wsdPrng.s[12];
32484
+ wsdPrng.s[12] = 0;
32485
+ wsdPrng.n = 0;
3241132486
}
3241232487
3241332488
assert( N>0 );
32414
- do{
32415
- wsdPrng.i++;
32416
- t = wsdPrng.s[wsdPrng.i];
32417
- wsdPrng.j += t;
32418
- wsdPrng.s[wsdPrng.i] = wsdPrng.s[wsdPrng.j];
32419
- wsdPrng.s[wsdPrng.j] = t;
32420
- t += wsdPrng.s[wsdPrng.i];
32421
- *(zBuf++) = wsdPrng.s[t];
32422
- }while( --N );
32489
+ while( 1 /* exit by break */ ){
32490
+ if( N<=wsdPrng.n ){
32491
+ memcpy(zBuf, &wsdPrng.out[wsdPrng.n-N], N);
32492
+ wsdPrng.n -= N;
32493
+ break;
32494
+ }
32495
+ if( wsdPrng.n>0 ){
32496
+ memcpy(zBuf, wsdPrng.out, wsdPrng.n);
32497
+ N -= wsdPrng.n;
32498
+ zBuf += wsdPrng.n;
32499
+ }
32500
+ wsdPrng.s[12]++;
32501
+ chacha_block((u32*)wsdPrng.out, wsdPrng.s);
32502
+ wsdPrng.n = 64;
32503
+ }
3242332504
sqlite3_mutex_leave(mutex);
3242432505
}
3242532506
3242632507
#ifndef SQLITE_UNTESTABLE
3242732508
/*
@@ -33457,11 +33538,11 @@
3345733538
SQLITE_PRIVATE void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){
3345833539
char *zMsg;
3345933540
va_list ap;
3346033541
sqlite3 *db = pParse->db;
3346133542
assert( db!=0 );
33462
- assert( db->pParse==pParse );
33543
+ assert( db->pParse==pParse || db->pParse->pToplevel==pParse );
3346333544
db->errByteOffset = -2;
3346433545
va_start(ap, zFormat);
3346533546
zMsg = sqlite3VMPrintf(db, zFormat, ap);
3346633547
va_end(ap);
3346733548
if( db->errByteOffset<-1 ) db->errByteOffset = -1;
@@ -35275,67 +35356,67 @@
3527535356
/* 3 */ "Checkpoint" OpHelp(""),
3527635357
/* 4 */ "JournalMode" OpHelp(""),
3527735358
/* 5 */ "Vacuum" OpHelp(""),
3527835359
/* 6 */ "VFilter" OpHelp("iplan=r[P3] zplan='P4'"),
3527935360
/* 7 */ "VUpdate" OpHelp("data=r[P3@P2]"),
35280
- /* 8 */ "Goto" OpHelp(""),
35281
- /* 9 */ "Gosub" OpHelp(""),
35282
- /* 10 */ "InitCoroutine" OpHelp(""),
35283
- /* 11 */ "Yield" OpHelp(""),
35284
- /* 12 */ "MustBeInt" OpHelp(""),
35285
- /* 13 */ "Jump" OpHelp(""),
35286
- /* 14 */ "Once" OpHelp(""),
35287
- /* 15 */ "If" OpHelp(""),
35288
- /* 16 */ "IfNot" OpHelp(""),
35289
- /* 17 */ "IsNullOrType" OpHelp("if typeof(r[P1]) IN (P3,5) goto P2"),
35290
- /* 18 */ "IfNullRow" OpHelp("if P1.nullRow then r[P3]=NULL, goto P2"),
35361
+ /* 8 */ "Init" OpHelp("Start at P2"),
35362
+ /* 9 */ "Goto" OpHelp(""),
35363
+ /* 10 */ "Gosub" OpHelp(""),
35364
+ /* 11 */ "InitCoroutine" OpHelp(""),
35365
+ /* 12 */ "Yield" OpHelp(""),
35366
+ /* 13 */ "MustBeInt" OpHelp(""),
35367
+ /* 14 */ "Jump" OpHelp(""),
35368
+ /* 15 */ "Once" OpHelp(""),
35369
+ /* 16 */ "If" OpHelp(""),
35370
+ /* 17 */ "IfNot" OpHelp(""),
35371
+ /* 18 */ "IsNullOrType" OpHelp("if typeof(r[P1]) IN (P3,5) goto P2"),
3529135372
/* 19 */ "Not" OpHelp("r[P2]= !r[P1]"),
35292
- /* 20 */ "SeekLT" OpHelp("key=r[P3@P4]"),
35293
- /* 21 */ "SeekLE" OpHelp("key=r[P3@P4]"),
35294
- /* 22 */ "SeekGE" OpHelp("key=r[P3@P4]"),
35295
- /* 23 */ "SeekGT" OpHelp("key=r[P3@P4]"),
35296
- /* 24 */ "IfNotOpen" OpHelp("if( !csr[P1] ) goto P2"),
35297
- /* 25 */ "IfNoHope" OpHelp("key=r[P3@P4]"),
35298
- /* 26 */ "NoConflict" OpHelp("key=r[P3@P4]"),
35299
- /* 27 */ "NotFound" OpHelp("key=r[P3@P4]"),
35300
- /* 28 */ "Found" OpHelp("key=r[P3@P4]"),
35301
- /* 29 */ "SeekRowid" OpHelp("intkey=r[P3]"),
35302
- /* 30 */ "NotExists" OpHelp("intkey=r[P3]"),
35303
- /* 31 */ "Last" OpHelp(""),
35304
- /* 32 */ "IfSmaller" OpHelp(""),
35305
- /* 33 */ "SorterSort" OpHelp(""),
35306
- /* 34 */ "Sort" OpHelp(""),
35307
- /* 35 */ "Rewind" OpHelp(""),
35308
- /* 36 */ "SorterNext" OpHelp(""),
35309
- /* 37 */ "Prev" OpHelp(""),
35310
- /* 38 */ "Next" OpHelp(""),
35311
- /* 39 */ "IdxLE" OpHelp("key=r[P3@P4]"),
35312
- /* 40 */ "IdxGT" OpHelp("key=r[P3@P4]"),
35313
- /* 41 */ "IdxLT" OpHelp("key=r[P3@P4]"),
35314
- /* 42 */ "IdxGE" OpHelp("key=r[P3@P4]"),
35373
+ /* 20 */ "IfNullRow" OpHelp("if P1.nullRow then r[P3]=NULL, goto P2"),
35374
+ /* 21 */ "SeekLT" OpHelp("key=r[P3@P4]"),
35375
+ /* 22 */ "SeekLE" OpHelp("key=r[P3@P4]"),
35376
+ /* 23 */ "SeekGE" OpHelp("key=r[P3@P4]"),
35377
+ /* 24 */ "SeekGT" OpHelp("key=r[P3@P4]"),
35378
+ /* 25 */ "IfNotOpen" OpHelp("if( !csr[P1] ) goto P2"),
35379
+ /* 26 */ "IfNoHope" OpHelp("key=r[P3@P4]"),
35380
+ /* 27 */ "NoConflict" OpHelp("key=r[P3@P4]"),
35381
+ /* 28 */ "NotFound" OpHelp("key=r[P3@P4]"),
35382
+ /* 29 */ "Found" OpHelp("key=r[P3@P4]"),
35383
+ /* 30 */ "SeekRowid" OpHelp("intkey=r[P3]"),
35384
+ /* 31 */ "NotExists" OpHelp("intkey=r[P3]"),
35385
+ /* 32 */ "Last" OpHelp(""),
35386
+ /* 33 */ "IfSmaller" OpHelp(""),
35387
+ /* 34 */ "SorterSort" OpHelp(""),
35388
+ /* 35 */ "Sort" OpHelp(""),
35389
+ /* 36 */ "Rewind" OpHelp(""),
35390
+ /* 37 */ "SorterNext" OpHelp(""),
35391
+ /* 38 */ "Prev" OpHelp(""),
35392
+ /* 39 */ "Next" OpHelp(""),
35393
+ /* 40 */ "IdxLE" OpHelp("key=r[P3@P4]"),
35394
+ /* 41 */ "IdxGT" OpHelp("key=r[P3@P4]"),
35395
+ /* 42 */ "IdxLT" OpHelp("key=r[P3@P4]"),
3531535396
/* 43 */ "Or" OpHelp("r[P3]=(r[P1] || r[P2])"),
3531635397
/* 44 */ "And" OpHelp("r[P3]=(r[P1] && r[P2])"),
35317
- /* 45 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"),
35318
- /* 46 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"),
35319
- /* 47 */ "Program" OpHelp(""),
35320
- /* 48 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"),
35321
- /* 49 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"),
35398
+ /* 45 */ "IdxGE" OpHelp("key=r[P3@P4]"),
35399
+ /* 46 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"),
35400
+ /* 47 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"),
35401
+ /* 48 */ "Program" OpHelp(""),
35402
+ /* 49 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"),
3532235403
/* 50 */ "IsNull" OpHelp("if r[P1]==NULL goto P2"),
3532335404
/* 51 */ "NotNull" OpHelp("if r[P1]!=NULL goto P2"),
3532435405
/* 52 */ "Ne" OpHelp("IF r[P3]!=r[P1]"),
3532535406
/* 53 */ "Eq" OpHelp("IF r[P3]==r[P1]"),
3532635407
/* 54 */ "Gt" OpHelp("IF r[P3]>r[P1]"),
3532735408
/* 55 */ "Le" OpHelp("IF r[P3]<=r[P1]"),
3532835409
/* 56 */ "Lt" OpHelp("IF r[P3]<r[P1]"),
3532935410
/* 57 */ "Ge" OpHelp("IF r[P3]>=r[P1]"),
3533035411
/* 58 */ "ElseEq" OpHelp(""),
35331
- /* 59 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"),
35332
- /* 60 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
35333
- /* 61 */ "IncrVacuum" OpHelp(""),
35334
- /* 62 */ "VNext" OpHelp(""),
35335
- /* 63 */ "Filter" OpHelp("if key(P3@P4) not in filter(P1) goto P2"),
35336
- /* 64 */ "Init" OpHelp("Start at P2"),
35412
+ /* 59 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"),
35413
+ /* 60 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"),
35414
+ /* 61 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
35415
+ /* 62 */ "IncrVacuum" OpHelp(""),
35416
+ /* 63 */ "VNext" OpHelp(""),
35417
+ /* 64 */ "Filter" OpHelp("if key(P3@P4) not in filter(P1) goto P2"),
3533735418
/* 65 */ "PureFunc" OpHelp("r[P3]=func(r[P2@NP])"),
3533835419
/* 66 */ "Function" OpHelp("r[P3]=func(r[P2@NP])"),
3533935420
/* 67 */ "Return" OpHelp(""),
3534035421
/* 68 */ "EndCoroutine" OpHelp(""),
3534135422
/* 69 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
@@ -41318,30 +41399,39 @@
4131841399
** pVfs->mxPathname bytes.
4131941400
*/
4132041401
static int unixGetTempname(int nBuf, char *zBuf){
4132141402
const char *zDir;
4132241403
int iLimit = 0;
41404
+ int rc = SQLITE_OK;
4132341405
4132441406
/* It's odd to simulate an io-error here, but really this is just
4132541407
** using the io-error infrastructure to test that SQLite handles this
4132641408
** function failing.
4132741409
*/
4132841410
zBuf[0] = 0;
4132941411
SimulateIOError( return SQLITE_IOERR );
4133041412
41413
+ sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
4133141414
zDir = unixTempFileDir();
41332
- if( zDir==0 ) return SQLITE_IOERR_GETTEMPPATH;
41333
- do{
41334
- u64 r;
41335
- sqlite3_randomness(sizeof(r), &r);
41336
- assert( nBuf>2 );
41337
- zBuf[nBuf-2] = 0;
41338
- sqlite3_snprintf(nBuf, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX"%llx%c",
41339
- zDir, r, 0);
41340
- if( zBuf[nBuf-2]!=0 || (iLimit++)>10 ) return SQLITE_ERROR;
41341
- }while( osAccess(zBuf,0)==0 );
41342
- return SQLITE_OK;
41415
+ if( zDir==0 ){
41416
+ rc = SQLITE_IOERR_GETTEMPPATH;
41417
+ }else{
41418
+ do{
41419
+ u64 r;
41420
+ sqlite3_randomness(sizeof(r), &r);
41421
+ assert( nBuf>2 );
41422
+ zBuf[nBuf-2] = 0;
41423
+ sqlite3_snprintf(nBuf, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX"%llx%c",
41424
+ zDir, r, 0);
41425
+ if( zBuf[nBuf-2]!=0 || (iLimit++)>10 ){
41426
+ rc = SQLITE_ERROR;
41427
+ break;
41428
+ }
41429
+ }while( osAccess(zBuf,0)==0 );
41430
+ }
41431
+ sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
41432
+ return rc;
4134341433
}
4134441434
4134541435
#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
4134641436
/*
4134741437
** Routine to transform a unixFile into a proxy-locking unixFile.
@@ -43512,11 +43602,16 @@
4351243602
** correctly. See ticket [bb3a86e890c8e96ab] */
4351343603
assert( ArraySize(aSyscall)==29 );
4351443604
4351543605
/* Register all VFSes defined in the aVfs[] array */
4351643606
for(i=0; i<(sizeof(aVfs)/sizeof(sqlite3_vfs)); i++){
43607
+#ifdef SQLITE_DEFAULT_UNIX_VFS
43608
+ sqlite3_vfs_register(&aVfs[i],
43609
+ 0==strcmp(aVfs[i].zName,SQLITE_DEFAULT_UNIX_VFS));
43610
+#else
4351743611
sqlite3_vfs_register(&aVfs[i], i==0);
43612
+#endif
4351843613
}
4351943614
unixBigLock = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1);
4352043615
4352143616
#ifndef SQLITE_OMIT_WAL
4352243617
/* Validate lock assumptions */
@@ -45480,10 +45575,11 @@
4548045575
char **ppDirectory = 0;
4548145576
#ifndef SQLITE_OMIT_AUTOINIT
4548245577
int rc = sqlite3_initialize();
4548345578
if( rc ) return rc;
4548445579
#endif
45580
+ sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
4548545581
if( type==SQLITE_WIN32_DATA_DIRECTORY_TYPE ){
4548645582
ppDirectory = &sqlite3_data_directory;
4548745583
}else if( type==SQLITE_WIN32_TEMP_DIRECTORY_TYPE ){
4548845584
ppDirectory = &sqlite3_temp_directory;
4548945585
}
@@ -45494,18 +45590,23 @@
4549445590
if( ppDirectory ){
4549545591
char *zCopy = 0;
4549645592
if( zValue && zValue[0] ){
4549745593
zCopy = sqlite3_mprintf("%s", zValue);
4549845594
if ( zCopy==0 ){
45499
- return SQLITE_NOMEM_BKPT;
45595
+ rc = SQLITE_NOMEM_BKPT;
45596
+ goto set_directory8_done;
4550045597
}
4550145598
}
4550245599
sqlite3_free(*ppDirectory);
4550345600
*ppDirectory = zCopy;
45504
- return SQLITE_OK;
45601
+ rc = SQLITE_OK;
45602
+ }else{
45603
+ rc = SQLITE_ERROR;
4550545604
}
45506
- return SQLITE_ERROR;
45605
+set_directory8_done:
45606
+ sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
45607
+ return rc;
4550745608
}
4550845609
4550945610
/*
4551045611
** This function is the same as sqlite3_win32_set_directory (below); however,
4551145612
** it accepts a UTF-16 string.
@@ -48274,10 +48375,22 @@
4827448375
}
4827548376
}
4827648377
}
4827748378
return 0;
4827848379
}
48380
+
48381
+/*
48382
+** If sqlite3_temp_directory is not, take the mutex and return true.
48383
+**
48384
+** If sqlite3_temp_directory is NULL, omit the mutex and return false.
48385
+*/
48386
+static int winTempDirDefined(void){
48387
+ sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
48388
+ if( sqlite3_temp_directory!=0 ) return 1;
48389
+ sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
48390
+ return 0;
48391
+}
4827948392
4828048393
/*
4828148394
** Create a temporary file name and store the resulting pointer into pzBuf.
4828248395
** The pointer returned in pzBuf must be freed via sqlite3_free().
4828348396
*/
@@ -48311,24 +48424,27 @@
4831148424
** has been explicitly set by the application; otherwise, use the one
4831248425
** configured by the operating system.
4831348426
*/
4831448427
nDir = nMax - (nPre + 15);
4831548428
assert( nDir>0 );
48316
- if( sqlite3_temp_directory ){
48429
+ if( winTempDirDefined() ){
4831748430
int nDirLen = sqlite3Strlen30(sqlite3_temp_directory);
4831848431
if( nDirLen>0 ){
4831948432
if( !winIsDirSep(sqlite3_temp_directory[nDirLen-1]) ){
4832048433
nDirLen++;
4832148434
}
4832248435
if( nDirLen>nDir ){
48436
+ sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
4832348437
sqlite3_free(zBuf);
4832448438
OSTRACE(("TEMP-FILENAME rc=SQLITE_ERROR\n"));
4832548439
return winLogError(SQLITE_ERROR, 0, "winGetTempname1", 0);
4832648440
}
4832748441
sqlite3_snprintf(nMax, zBuf, "%s", sqlite3_temp_directory);
4832848442
}
48443
+ sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
4832948444
}
48445
+
4833048446
#if defined(__CYGWIN__)
4833148447
else{
4833248448
static const char *azDirs[] = {
4833348449
0, /* getenv("SQLITE_TMPDIR") */
4833448450
0, /* getenv("TMPDIR") */
@@ -49113,11 +49229,11 @@
4911349229
/*
4911449230
** Turn a relative pathname into a full pathname. Write the full
4911549231
** pathname into zOut[]. zOut[] will be at least pVfs->mxPathname
4911649232
** bytes in size.
4911749233
*/
49118
-static int winFullPathname(
49234
+static int winFullPathnameNoMutex(
4911949235
sqlite3_vfs *pVfs, /* Pointer to vfs object */
4912049236
const char *zRelative, /* Possibly relative input path */
4912149237
int nFull, /* Size of output buffer in bytes */
4912249238
char *zFull /* Output buffer */
4912349239
){
@@ -49291,10 +49407,23 @@
4929149407
return SQLITE_OK;
4929249408
}else{
4929349409
return SQLITE_IOERR_NOMEM_BKPT;
4929449410
}
4929549411
#endif
49412
+}
49413
+static int winFullPathname(
49414
+ sqlite3_vfs *pVfs, /* Pointer to vfs object */
49415
+ const char *zRelative, /* Possibly relative input path */
49416
+ int nFull, /* Size of output buffer in bytes */
49417
+ char *zFull /* Output buffer */
49418
+){
49419
+ int rc;
49420
+ sqlite3_mutex *pMutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR);
49421
+ sqlite3_mutex_enter(pMutex);
49422
+ rc = winFullPathnameNoMutex(pVfs, zRelative, nFull, zFull);
49423
+ sqlite3_mutex_leave(pMutex);
49424
+ return rc;
4929649425
}
4929749426
4929849427
#ifndef SQLITE_OMIT_LOAD_EXTENSION
4929949428
/*
4930049429
** Interfaces for opening a shared library, finding entry points
@@ -51080,39 +51209,58 @@
5108051209
*/
5108151210
#if defined(SQLITE_DEBUG) && 0
5108251211
int sqlite3PcacheTrace = 2; /* 0: off 1: simple 2: cache dumps */
5108351212
int sqlite3PcacheMxDump = 9999; /* Max cache entries for pcacheDump() */
5108451213
# define pcacheTrace(X) if(sqlite3PcacheTrace){sqlite3DebugPrintf X;}
51085
- void pcacheDump(PCache *pCache){
51086
- int N;
51087
- int i, j;
51088
- sqlite3_pcache_page *pLower;
51214
+ static void pcachePageTrace(int i, sqlite3_pcache_page *pLower){
5108951215
PgHdr *pPg;
5109051216
unsigned char *a;
51217
+ int j;
51218
+ pPg = (PgHdr*)pLower->pExtra;
51219
+ printf("%3d: nRef %2d flgs %02x data ", i, pPg->nRef, pPg->flags);
51220
+ a = (unsigned char *)pLower->pBuf;
51221
+ for(j=0; j<12; j++) printf("%02x", a[j]);
51222
+ printf(" ptr %p\n", pPg);
51223
+ }
51224
+ static void pcacheDump(PCache *pCache){
51225
+ int N;
51226
+ int i;
51227
+ sqlite3_pcache_page *pLower;
5109151228
5109251229
if( sqlite3PcacheTrace<2 ) return;
5109351230
if( pCache->pCache==0 ) return;
5109451231
N = sqlite3PcachePagecount(pCache);
5109551232
if( N>sqlite3PcacheMxDump ) N = sqlite3PcacheMxDump;
5109651233
for(i=1; i<=N; i++){
5109751234
pLower = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, i, 0);
5109851235
if( pLower==0 ) continue;
51099
- pPg = (PgHdr*)pLower->pExtra;
51100
- printf("%3d: nRef %2d flgs %02x data ", i, pPg->nRef, pPg->flags);
51101
- a = (unsigned char *)pLower->pBuf;
51102
- for(j=0; j<12; j++) printf("%02x", a[j]);
51103
- printf("\n");
51104
- if( pPg->pPage==0 ){
51236
+ pcachePageTrace(i, pLower);
51237
+ if( ((PgHdr*)pLower)->pPage==0 ){
5110551238
sqlite3GlobalConfig.pcache2.xUnpin(pCache->pCache, pLower, 0);
5110651239
}
5110751240
}
5110851241
}
51109
- #else
51242
+#else
5111051243
# define pcacheTrace(X)
51244
+# define pcachePageTrace(PGNO, X)
5111151245
# define pcacheDump(X)
5111251246
#endif
5111351247
51248
+/*
51249
+** Return 1 if pPg is on the dirty list for pCache. Return 0 if not.
51250
+** This routine runs inside of assert() statements only.
51251
+*/
51252
+#ifdef SQLITE_DEBUG
51253
+static int pageOnDirtyList(PCache *pCache, PgHdr *pPg){
51254
+ PgHdr *p;
51255
+ for(p=pCache->pDirty; p; p=p->pDirtyNext){
51256
+ if( p==pPg ) return 1;
51257
+ }
51258
+ return 0;
51259
+}
51260
+#endif
51261
+
5111451262
/*
5111551263
** Check invariants on a PgHdr entry. Return true if everything is OK.
5111651264
** Return false if any invariant is violated.
5111751265
**
5111851266
** This routine is for use inside of assert() statements only. For
@@ -51127,12 +51275,17 @@
5112751275
assert( pPg->pgno>0 || pPg->pPager==0 ); /* Page number is 1 or more */
5112851276
pCache = pPg->pCache;
5112951277
assert( pCache!=0 ); /* Every page has an associated PCache */
5113051278
if( pPg->flags & PGHDR_CLEAN ){
5113151279
assert( (pPg->flags & PGHDR_DIRTY)==0 );/* Cannot be both CLEAN and DIRTY */
51132
- assert( pCache->pDirty!=pPg ); /* CLEAN pages not on dirty list */
51133
- assert( pCache->pDirtyTail!=pPg );
51280
+ assert( !pageOnDirtyList(pCache, pPg) );/* CLEAN pages not on dirty list */
51281
+ }else{
51282
+ assert( (pPg->flags & PGHDR_DIRTY)!=0 );/* If not CLEAN must be DIRTY */
51283
+ assert( pPg->pDirtyNext==0 || pPg->pDirtyNext->pDirtyPrev==pPg );
51284
+ assert( pPg->pDirtyPrev==0 || pPg->pDirtyPrev->pDirtyNext==pPg );
51285
+ assert( pPg->pDirtyPrev!=0 || pCache->pDirty==pPg );
51286
+ assert( pageOnDirtyList(pCache, pPg) );
5113451287
}
5113551288
/* WRITEABLE pages must also be DIRTY */
5113651289
if( pPg->flags & PGHDR_WRITEABLE ){
5113751290
assert( pPg->flags & PGHDR_DIRTY ); /* WRITEABLE implies DIRTY */
5113851291
}
@@ -51402,12 +51555,13 @@
5140251555
eCreate = createFlag & pCache->eCreate;
5140351556
assert( eCreate==0 || eCreate==1 || eCreate==2 );
5140451557
assert( createFlag==0 || pCache->eCreate==eCreate );
5140551558
assert( createFlag==0 || eCreate==1+(!pCache->bPurgeable||!pCache->pDirty) );
5140651559
pRes = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, pgno, eCreate);
51407
- pcacheTrace(("%p.FETCH %d%s (result: %p)\n",pCache,pgno,
51560
+ pcacheTrace(("%p.FETCH %d%s (result: %p) ",pCache,pgno,
5140851561
createFlag?" create":"",pRes));
51562
+ pcachePageTrace(pgno, pRes);
5140951563
return pRes;
5141051564
}
5141151565
5141251566
/*
5141351567
** If the sqlite3PcacheFetch() routine is unable to allocate a new
@@ -51531,10 +51685,11 @@
5153151685
if( (--p->nRef)==0 ){
5153251686
if( p->flags&PGHDR_CLEAN ){
5153351687
pcacheUnpin(p);
5153451688
}else{
5153551689
pcacheManageDirtyList(p, PCACHE_DIRTYLIST_FRONT);
51690
+ assert( sqlite3PcachePageSanity(p) );
5153651691
}
5153751692
}
5153851693
}
5153951694
5154051695
/*
@@ -51574,10 +51729,11 @@
5157451729
if( p->flags & PGHDR_CLEAN ){
5157551730
p->flags ^= (PGHDR_DIRTY|PGHDR_CLEAN);
5157651731
pcacheTrace(("%p.DIRTY %d\n",p->pCache,p->pgno));
5157751732
assert( (p->flags & (PGHDR_DIRTY|PGHDR_CLEAN))==PGHDR_DIRTY );
5157851733
pcacheManageDirtyList(p, PCACHE_DIRTYLIST_ADD);
51734
+ assert( sqlite3PcachePageSanity(p) );
5157951735
}
5158051736
assert( sqlite3PcachePageSanity(p) );
5158151737
}
5158251738
}
5158351739
@@ -51636,18 +51792,28 @@
5163651792
/*
5163751793
** Change the page number of page p to newPgno.
5163851794
*/
5163951795
SQLITE_PRIVATE void sqlite3PcacheMove(PgHdr *p, Pgno newPgno){
5164051796
PCache *pCache = p->pCache;
51797
+ sqlite3_pcache_page *pOther;
5164151798
assert( p->nRef>0 );
5164251799
assert( newPgno>0 );
5164351800
assert( sqlite3PcachePageSanity(p) );
5164451801
pcacheTrace(("%p.MOVE %d -> %d\n",pCache,p->pgno,newPgno));
51802
+ pOther = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, newPgno, 0);
5164551803
sqlite3GlobalConfig.pcache2.xRekey(pCache->pCache, p->pPage, p->pgno,newPgno);
51804
+ if( pOther ){
51805
+ PgHdr *pPg = (PgHdr*)pOther->pExtra;
51806
+ pPg->pgno = p->pgno;
51807
+ if( pPg->pPage==0 ){
51808
+ sqlite3GlobalConfig.pcache2.xUnpin(pCache->pCache, pOther, 0);
51809
+ }
51810
+ }
5164651811
p->pgno = newPgno;
5164751812
if( (p->flags&PGHDR_DIRTY) && (p->flags&PGHDR_NEED_SYNC) ){
5164851813
pcacheManageDirtyList(p, PCACHE_DIRTYLIST_FRONT);
51814
+ assert( sqlite3PcachePageSanity(p) );
5164951815
}
5165051816
}
5165151817
5165251818
/*
5165351819
** Drop every cache entry whose page number is greater than "pgno". The
@@ -51941,16 +52107,17 @@
5194152107
** runtime using sqlite3_config(SQLITE_CONFIG_PCACHE_HDRSZ, &size). The
5194252108
** sizes of the extensions sum to 272 bytes on x64 for 3.8.10, but this
5194352109
** size can vary according to architecture, compile-time options, and
5194452110
** SQLite library version number.
5194552111
**
51946
-** If SQLITE_PCACHE_SEPARATE_HEADER is defined, then the extension is obtained
51947
-** using a separate memory allocation from the database page content. This
51948
-** seeks to overcome the "clownshoe" problem (also called "internal
51949
-** fragmentation" in academic literature) of allocating a few bytes more
51950
-** than a power of two with the memory allocator rounding up to the next
51951
-** power of two, and leaving the rounded-up space unused.
52112
+** Historical note: It used to be that if the SQLITE_PCACHE_SEPARATE_HEADER
52113
+** was defined, then the page content would be held in a separate memory
52114
+** allocation from the PgHdr1. This was intended to avoid clownshoe memory
52115
+** allocations. However, the btree layer needs a small (16-byte) overrun
52116
+** area after the page content buffer. The header serves as that overrun
52117
+** area. Therefore SQLITE_PCACHE_SEPARATE_HEADER was discontinued to avoid
52118
+** any possibility of a memory error.
5195252119
**
5195352120
** This module tracks pointers to PgHdr1 objects. Only pcache.c communicates
5195452121
** with this module. Information is passed back and forth as PgHdr1 pointers.
5195552122
**
5195652123
** The pcache.c and pager.c modules deal pointers to PgHdr objects.
@@ -51991,34 +52158,44 @@
5199152158
typedef struct PgFreeslot PgFreeslot;
5199252159
typedef struct PGroup PGroup;
5199352160
5199452161
/*
5199552162
** Each cache entry is represented by an instance of the following
51996
-** structure. Unless SQLITE_PCACHE_SEPARATE_HEADER is defined, a buffer of
51997
-** PgHdr1.pCache->szPage bytes is allocated directly before this structure
51998
-** in memory.
52163
+** structure. A buffer of PgHdr1.pCache->szPage bytes is allocated
52164
+** directly before this structure and is used to cache the page content.
5199952165
**
52000
-** Note: Variables isBulkLocal and isAnchor were once type "u8". That works,
52166
+** When reading a corrupt database file, it is possible that SQLite might
52167
+** read a few bytes (no more than 16 bytes) past the end of the page buffer.
52168
+** It will only read past the end of the page buffer, never write. This
52169
+** object is positioned immediately after the page buffer to serve as an
52170
+** overrun area, so that overreads are harmless.
52171
+**
52172
+** Variables isBulkLocal and isAnchor were once type "u8". That works,
5200152173
** but causes a 2-byte gap in the structure for most architectures (since
5200252174
** pointers must be either 4 or 8-byte aligned). As this structure is located
5200352175
** in memory directly after the associated page data, if the database is
5200452176
** corrupt, code at the b-tree layer may overread the page buffer and
5200552177
** read part of this structure before the corruption is detected. This
5200652178
** can cause a valgrind error if the unitialized gap is accessed. Using u16
52007
-** ensures there is no such gap, and therefore no bytes of unitialized memory
52008
-** in the structure.
52179
+** ensures there is no such gap, and therefore no bytes of uninitialized
52180
+** memory in the structure.
52181
+**
52182
+** The pLruNext and pLruPrev pointers form a double-linked circular list
52183
+** of all pages that are unpinned. The PGroup.lru element (which should be
52184
+** the only element on the list with PgHdr1.isAnchor set to 1) forms the
52185
+** beginning and the end of the list.
5200952186
*/
5201052187
struct PgHdr1 {
52011
- sqlite3_pcache_page page; /* Base class. Must be first. pBuf & pExtra */
52012
- unsigned int iKey; /* Key value (page number) */
52013
- u16 isBulkLocal; /* This page from bulk local storage */
52014
- u16 isAnchor; /* This is the PGroup.lru element */
52015
- PgHdr1 *pNext; /* Next in hash table chain */
52016
- PCache1 *pCache; /* Cache that currently owns this page */
52017
- PgHdr1 *pLruNext; /* Next in LRU list of unpinned pages */
52018
- PgHdr1 *pLruPrev; /* Previous in LRU list of unpinned pages */
52019
- /* NB: pLruPrev is only valid if pLruNext!=0 */
52188
+ sqlite3_pcache_page page; /* Base class. Must be first. pBuf & pExtra */
52189
+ unsigned int iKey; /* Key value (page number) */
52190
+ u16 isBulkLocal; /* This page from bulk local storage */
52191
+ u16 isAnchor; /* This is the PGroup.lru element */
52192
+ PgHdr1 *pNext; /* Next in hash table chain */
52193
+ PCache1 *pCache; /* Cache that currently owns this page */
52194
+ PgHdr1 *pLruNext; /* Next in circular LRU list of unpinned pages */
52195
+ PgHdr1 *pLruPrev; /* Previous in LRU list of unpinned pages */
52196
+ /* NB: pLruPrev is only valid if pLruNext!=0 */
5202052197
};
5202152198
5202252199
/*
5202352200
** A page is pinned if it is not on the LRU list. To be "pinned" means
5202452201
** that the page is in active use and must not be deallocated.
@@ -52340,29 +52517,17 @@
5234052517
assert( pcache1.separateCache==0 );
5234152518
assert( pCache->pGroup==&pcache1.grp );
5234252519
pcache1LeaveMutex(pCache->pGroup);
5234352520
#endif
5234452521
if( benignMalloc ){ sqlite3BeginBenignMalloc(); }
52345
-#ifdef SQLITE_PCACHE_SEPARATE_HEADER
52346
- pPg = pcache1Alloc(pCache->szPage);
52347
- p = sqlite3Malloc(sizeof(PgHdr1) + pCache->szExtra);
52348
- if( !pPg || !p ){
52349
- pcache1Free(pPg);
52350
- sqlite3_free(p);
52351
- pPg = 0;
52352
- }
52353
-#else
5235452522
pPg = pcache1Alloc(pCache->szAlloc);
52355
-#endif
5235652523
if( benignMalloc ){ sqlite3EndBenignMalloc(); }
5235752524
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
5235852525
pcache1EnterMutex(pCache->pGroup);
5235952526
#endif
5236052527
if( pPg==0 ) return 0;
52361
-#ifndef SQLITE_PCACHE_SEPARATE_HEADER
5236252528
p = (PgHdr1 *)&((u8 *)pPg)[pCache->szPage];
52363
-#endif
5236452529
p->page.pBuf = pPg;
5236552530
p->page.pExtra = &p[1];
5236652531
p->isBulkLocal = 0;
5236752532
p->isAnchor = 0;
5236852533
p->pLruPrev = 0; /* Initializing this saves a valgrind error */
@@ -52382,13 +52547,10 @@
5238252547
if( p->isBulkLocal ){
5238352548
p->pNext = pCache->pFree;
5238452549
pCache->pFree = p;
5238552550
}else{
5238652551
pcache1Free(p->page.pBuf);
52387
-#ifdef SQLITE_PCACHE_SEPARATE_HEADER
52388
- sqlite3_free(p);
52389
-#endif
5239052552
}
5239152553
(*pCache->pnPurgeable)--;
5239252554
}
5239352555
5239452556
/*
@@ -53025,27 +53187,45 @@
5302553187
unsigned int iNew
5302653188
){
5302753189
PCache1 *pCache = (PCache1 *)p;
5302853190
PgHdr1 *pPage = (PgHdr1 *)pPg;
5302953191
PgHdr1 **pp;
53030
- unsigned int h;
53192
+ unsigned int hOld, hNew;
5303153193
assert( pPage->iKey==iOld );
5303253194
assert( pPage->pCache==pCache );
53195
+ assert( iOld!=iNew ); /* The page number really is changing */
5303353196
5303453197
pcache1EnterMutex(pCache->pGroup);
5303553198
53036
- h = iOld%pCache->nHash;
53037
- pp = &pCache->apHash[h];
53199
+ assert( pcache1FetchNoMutex(p, iOld, 0)==pPage ); /* pPg really is iOld */
53200
+ hOld = iOld%pCache->nHash;
53201
+ pp = &pCache->apHash[hOld];
5303853202
while( (*pp)!=pPage ){
5303953203
pp = &(*pp)->pNext;
5304053204
}
5304153205
*pp = pPage->pNext;
5304253206
53043
- h = iNew%pCache->nHash;
53207
+ hNew = iNew%pCache->nHash;
53208
+ pp = &pCache->apHash[hNew];
53209
+ while( *pp ){
53210
+ if( (*pp)->iKey==iNew ){
53211
+ /* If there is already another pcache entry at iNew, change it to iOld,
53212
+ ** thus swapping the positions of iNew and iOld */
53213
+ PgHdr1 *pOld = *pp;
53214
+ *pp = pOld->pNext;
53215
+ pOld->pNext = pCache->apHash[hOld];
53216
+ pCache->apHash[hOld] = pOld;
53217
+ pOld->iKey = iOld;
53218
+ break;
53219
+ }else{
53220
+ pp = &(*pp)->pNext;
53221
+ }
53222
+ }
53223
+
5304453224
pPage->iKey = iNew;
53045
- pPage->pNext = pCache->apHash[h];
53046
- pCache->apHash[h] = pPage;
53225
+ pPage->pNext = pCache->apHash[hNew];
53226
+ pCache->apHash[hNew] = pPage;
5304753227
if( iNew>pCache->iMaxKey ){
5304853228
pCache->iMaxKey = iNew;
5304953229
}
5305053230
5305153231
pcache1LeaveMutex(pCache->pGroup);
@@ -53148,13 +53328,10 @@
5314853328
while( (nReq<0 || nFree<nReq)
5314953329
&& (p=pcache1.grp.lru.pLruPrev)!=0
5315053330
&& p->isAnchor==0
5315153331
){
5315253332
nFree += pcache1MemSize(p->page.pBuf);
53153
-#ifdef SQLITE_PCACHE_SEPARATE_HEADER
53154
- nFree += sqlite3MemSize(p);
53155
-#endif
5315653333
assert( PAGE_IS_UNPINNED(p) );
5315753334
pcache1PinPage(p);
5315853335
pcache1RemoveFromHash(p, 1);
5315953336
}
5316053337
pcache1LeaveMutex(&pcache1.grp);
@@ -59639,10 +59816,11 @@
5963959816
int flags = SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE;
5964059817
int nSpill;
5964159818
5964259819
if( pPager->tempFile ){
5964359820
flags |= (SQLITE_OPEN_DELETEONCLOSE|SQLITE_OPEN_TEMP_JOURNAL);
59821
+ flags |= SQLITE_OPEN_EXCLUSIVE;
5964459822
nSpill = sqlite3Config.nStmtSpill;
5964559823
}else{
5964659824
flags |= SQLITE_OPEN_MAIN_JOURNAL;
5964759825
nSpill = jrnlBufferSize(pPager);
5964859826
}
@@ -59674,10 +59852,11 @@
5967459852
}
5967559853
5967659854
if( rc!=SQLITE_OK ){
5967759855
sqlite3BitvecDestroy(pPager->pInJournal);
5967859856
pPager->pInJournal = 0;
59857
+ pPager->journalOff = 0;
5967959858
}else{
5968059859
assert( pPager->eState==PAGER_WRITER_LOCKED );
5968159860
pPager->eState = PAGER_WRITER_CACHEMOD;
5968259861
}
5968359862
@@ -66737,10 +66916,11 @@
6673766916
** db using sqlite3SchemaToIndex().
6673866917
*/
6673966918
SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3 *db, int iDb, Schema *pSchema){
6674066919
Btree *p;
6674166920
assert( db!=0 );
66921
+ if( db->pVfs==0 && db->nDb==0 ) return 1;
6674266922
if( pSchema ) iDb = sqlite3SchemaToIndex(db, pSchema);
6674366923
assert( iDb>=0 && iDb<db->nDb );
6674466924
if( !sqlite3_mutex_held(db->mutex) ) return 0;
6674566925
if( iDb==1 ) return 1;
6674666926
p = db->aDb[iDb].pBt;
@@ -68309,12 +68489,11 @@
6830968489
assert( sqlite3PagerIswriteable(pPage->pDbPage) );
6831068490
assert( pPage->pBt!=0 );
6831168491
assert( pPage->pBt->usableSize <= SQLITE_MAX_PAGE_SIZE );
6831268492
assert( pPage->nOverflow==0 );
6831368493
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
68314
- temp = 0;
68315
- src = data = pPage->aData;
68494
+ data = pPage->aData;
6831668495
hdr = pPage->hdrOffset;
6831768496
cellOffset = pPage->cellOffset;
6831868497
nCell = pPage->nCell;
6831968498
assert( nCell==get2byte(&data[hdr+3]) || CORRUPT_DB );
6832068499
iCellFirst = cellOffset + 2*nCell;
@@ -68364,43 +68543,42 @@
6836468543
}
6836568544
6836668545
cbrk = usableSize;
6836768546
iCellLast = usableSize - 4;
6836868547
iCellStart = get2byte(&data[hdr+5]);
68369
- for(i=0; i<nCell; i++){
68370
- u8 *pAddr; /* The i-th cell pointer */
68371
- pAddr = &data[cellOffset + i*2];
68372
- pc = get2byte(pAddr);
68373
- testcase( pc==iCellFirst );
68374
- testcase( pc==iCellLast );
68375
- /* These conditions have already been verified in btreeInitPage()
68376
- ** if PRAGMA cell_size_check=ON.
68377
- */
68378
- if( pc<iCellStart || pc>iCellLast ){
68379
- return SQLITE_CORRUPT_PAGE(pPage);
68380
- }
68381
- assert( pc>=iCellStart && pc<=iCellLast );
68382
- size = pPage->xCellSize(pPage, &src[pc]);
68383
- cbrk -= size;
68384
- if( cbrk<iCellStart || pc+size>usableSize ){
68385
- return SQLITE_CORRUPT_PAGE(pPage);
68386
- }
68387
- assert( cbrk+size<=usableSize && cbrk>=iCellStart );
68388
- testcase( cbrk+size==usableSize );
68389
- testcase( pc+size==usableSize );
68390
- put2byte(pAddr, cbrk);
68391
- if( temp==0 ){
68392
- if( cbrk==pc ) continue;
68393
- temp = sqlite3PagerTempSpace(pPage->pBt->pPager);
68394
- memcpy(&temp[iCellStart], &data[iCellStart], usableSize - iCellStart);
68395
- src = temp;
68396
- }
68397
- memcpy(&data[cbrk], &src[pc], size);
68548
+ if( nCell>0 ){
68549
+ temp = sqlite3PagerTempSpace(pPage->pBt->pPager);
68550
+ memcpy(&temp[iCellStart], &data[iCellStart], usableSize - iCellStart);
68551
+ src = temp;
68552
+ for(i=0; i<nCell; i++){
68553
+ u8 *pAddr; /* The i-th cell pointer */
68554
+ pAddr = &data[cellOffset + i*2];
68555
+ pc = get2byte(pAddr);
68556
+ testcase( pc==iCellFirst );
68557
+ testcase( pc==iCellLast );
68558
+ /* These conditions have already been verified in btreeInitPage()
68559
+ ** if PRAGMA cell_size_check=ON.
68560
+ */
68561
+ if( pc<iCellStart || pc>iCellLast ){
68562
+ return SQLITE_CORRUPT_PAGE(pPage);
68563
+ }
68564
+ assert( pc>=iCellStart && pc<=iCellLast );
68565
+ size = pPage->xCellSize(pPage, &src[pc]);
68566
+ cbrk -= size;
68567
+ if( cbrk<iCellStart || pc+size>usableSize ){
68568
+ return SQLITE_CORRUPT_PAGE(pPage);
68569
+ }
68570
+ assert( cbrk+size<=usableSize && cbrk>=iCellStart );
68571
+ testcase( cbrk+size==usableSize );
68572
+ testcase( pc+size==usableSize );
68573
+ put2byte(pAddr, cbrk);
68574
+ memcpy(&data[cbrk], &src[pc], size);
68575
+ }
6839868576
}
6839968577
data[hdr+7] = 0;
6840068578
68401
- defragment_out:
68579
+defragment_out:
6840268580
assert( pPage->nFree>=0 );
6840368581
if( data[hdr+7]+cbrk-iCellFirst!=pPage->nFree ){
6840468582
return SQLITE_CORRUPT_PAGE(pPage);
6840568583
}
6840668584
assert( cbrk>=iCellFirst );
@@ -68469,13 +68647,13 @@
6846968647
return &aData[pc + x];
6847068648
}
6847168649
iAddr = pc;
6847268650
pTmp = &aData[pc];
6847368651
pc = get2byte(pTmp);
68474
- if( pc<=iAddr+size ){
68652
+ if( pc<=iAddr ){
6847568653
if( pc ){
68476
- /* The next slot in the chain is not past the end of the current slot */
68654
+ /* The next slot in the chain comes before the current slot */
6847768655
*pRc = SQLITE_CORRUPT_PAGE(pPg);
6847868656
}
6847968657
return 0;
6848068658
}
6848168659
}
@@ -68623,11 +68801,11 @@
6862368801
iPtr = hdr + 1;
6862468802
if( data[iPtr+1]==0 && data[iPtr]==0 ){
6862568803
iFreeBlk = 0; /* Shortcut for the case when the freelist is empty */
6862668804
}else{
6862768805
while( (iFreeBlk = get2byte(&data[iPtr]))<iStart ){
68628
- if( iFreeBlk<iPtr+4 ){
68806
+ if( iFreeBlk<=iPtr ){
6862968807
if( iFreeBlk==0 ) break; /* TH3: corrupt082.100 */
6863068808
return SQLITE_CORRUPT_PAGE(pPage);
6863168809
}
6863268810
iPtr = iFreeBlk;
6863368811
}
@@ -69105,13 +69283,11 @@
6910569283
if( pCur ){
6910669284
pCur->iPage--;
6910769285
pCur->pPage = pCur->apPage[pCur->iPage];
6910869286
}
6910969287
testcase( pgno==0 );
69110
- assert( pgno!=0 || rc==SQLITE_CORRUPT
69111
- || rc==SQLITE_IOERR_NOMEM
69112
- || rc==SQLITE_NOMEM );
69288
+ assert( pgno!=0 || rc!=SQLITE_OK );
6911369289
return rc;
6911469290
}
6911569291
6911669292
/*
6911769293
** Release a MemPage. This should be called once for each prior
@@ -72049,12 +72225,10 @@
7204972225
** the new child page does not match the flags field of the parent (i.e.
7205072226
** if an intkey page appears to be the parent of a non-intkey page, or
7205172227
** vice-versa).
7205272228
*/
7205372229
static int moveToChild(BtCursor *pCur, u32 newPgno){
72054
- BtShared *pBt = pCur->pBt;
72055
-
7205672230
assert( cursorOwnsBtShared(pCur) );
7205772231
assert( pCur->eState==CURSOR_VALID );
7205872232
assert( pCur->iPage<BTCURSOR_MAX_DEPTH );
7205972233
assert( pCur->iPage>=0 );
7206072234
if( pCur->iPage>=(BTCURSOR_MAX_DEPTH-1) ){
@@ -72064,11 +72238,12 @@
7206472238
pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);
7206572239
pCur->aiIdx[pCur->iPage] = pCur->ix;
7206672240
pCur->apPage[pCur->iPage] = pCur->pPage;
7206772241
pCur->ix = 0;
7206872242
pCur->iPage++;
72069
- return getAndInitPage(pBt, newPgno, &pCur->pPage, pCur, pCur->curPagerFlags);
72243
+ return getAndInitPage(pCur->pBt, newPgno, &pCur->pPage, pCur,
72244
+ pCur->curPagerFlags);
7207072245
}
7207172246
7207272247
#ifdef SQLITE_DEBUG
7207372248
/*
7207472249
** Page pParent is an internal (non-leaf) tree page. This function
@@ -72170,11 +72345,11 @@
7217072345
assert( pCur->skipNext!=SQLITE_OK );
7217172346
return pCur->skipNext;
7217272347
}
7217372348
sqlite3BtreeClearCursor(pCur);
7217472349
}
72175
- rc = getAndInitPage(pCur->pBtree->pBt, pCur->pgnoRoot, &pCur->pPage,
72350
+ rc = getAndInitPage(pCur->pBt, pCur->pgnoRoot, &pCur->pPage,
7217672351
0, pCur->curPagerFlags);
7217772352
if( rc!=SQLITE_OK ){
7217872353
pCur->eState = CURSOR_INVALID;
7217972354
return rc;
7218072355
}
@@ -73811,16 +73986,10 @@
7381173986
data = pPage->aData;
7381273987
ptr = &pPage->aCellIdx[2*idx];
7381373988
assert( pPage->pBt->usableSize > (u32)(ptr-data) );
7381473989
pc = get2byte(ptr);
7381573990
hdr = pPage->hdrOffset;
73816
-#if 0 /* Not required. Omit for efficiency */
73817
- if( pc<hdr+pPage->nCell*2 ){
73818
- *pRC = SQLITE_CORRUPT_BKPT;
73819
- return;
73820
- }
73821
-#endif
7382273991
testcase( pc==(u32)get2byte(&data[hdr+5]) );
7382373992
testcase( pc+sz==pPage->pBt->usableSize );
7382473993
if( pc+sz > pPage->pBt->usableSize ){
7382573994
*pRC = SQLITE_CORRUPT_BKPT;
7382673995
return;
@@ -74700,12 +74869,10 @@
7470074869
int szNew[NB+2]; /* Combined size of cells placed on i-th page */
7470174870
u8 *aSpace1; /* Space for copies of dividers cells */
7470274871
Pgno pgno; /* Temp var to store a page number in */
7470374872
u8 abDone[NB+2]; /* True after i'th new page is populated */
7470474873
Pgno aPgno[NB+2]; /* Page numbers of new pages before shuffling */
74705
- Pgno aPgOrder[NB+2]; /* Copy of aPgno[] used for sorting pages */
74706
- u16 aPgFlags[NB+2]; /* flags field of new pages before shuffling */
7470774874
CellArray b; /* Parsed information on cells being balanced */
7470874875
7470974876
memset(abDone, 0, sizeof(abDone));
7471074877
memset(&b, 0, sizeof(b));
7471174878
pBt = pParent->pBt;
@@ -75125,46 +75292,43 @@
7512575292
** Reassign page numbers so that the new pages are in ascending order.
7512675293
** This helps to keep entries in the disk file in order so that a scan
7512775294
** of the table is closer to a linear scan through the file. That in turn
7512875295
** helps the operating system to deliver pages from the disk more rapidly.
7512975296
**
75130
- ** An O(n^2) insertion sort algorithm is used, but since n is never more
75131
- ** than (NB+2) (a small constant), that should not be a problem.
75297
+ ** An O(N*N) sort algorithm is used, but since N is never more than NB+2
75298
+ ** (5), that is not a performance concern.
7513275299
**
7513375300
** When NB==3, this one optimization makes the database about 25% faster
7513475301
** for large insertions and deletions.
7513575302
*/
7513675303
for(i=0; i<nNew; i++){
75137
- aPgOrder[i] = aPgno[i] = apNew[i]->pgno;
75138
- aPgFlags[i] = apNew[i]->pDbPage->flags;
75139
- for(j=0; j<i; j++){
75140
- if( NEVER(aPgno[j]==aPgno[i]) ){
75141
- /* This branch is taken if the set of sibling pages somehow contains
75142
- ** duplicate entries. This can happen if the database is corrupt.
75143
- ** It would be simpler to detect this as part of the loop below, but
75144
- ** we do the detection here in order to avoid populating the pager
75145
- ** cache with two separate objects associated with the same
75146
- ** page number. */
75147
- assert( CORRUPT_DB );
75148
- rc = SQLITE_CORRUPT_BKPT;
75149
- goto balance_cleanup;
75150
- }
75151
- }
75152
- }
75153
- for(i=0; i<nNew; i++){
75154
- int iBest = 0; /* aPgno[] index of page number to use */
75155
- for(j=1; j<nNew; j++){
75156
- if( aPgOrder[j]<aPgOrder[iBest] ) iBest = j;
75157
- }
75158
- pgno = aPgOrder[iBest];
75159
- aPgOrder[iBest] = 0xffffffff;
75160
- if( iBest!=i ){
75161
- if( iBest>i ){
75162
- sqlite3PagerRekey(apNew[iBest]->pDbPage, pBt->nPage+iBest+1, 0);
75163
- }
75164
- sqlite3PagerRekey(apNew[i]->pDbPage, pgno, aPgFlags[iBest]);
75165
- apNew[i]->pgno = pgno;
75304
+ aPgno[i] = apNew[i]->pgno;
75305
+ assert( apNew[i]->pDbPage->flags & PGHDR_WRITEABLE );
75306
+ assert( apNew[i]->pDbPage->flags & PGHDR_DIRTY );
75307
+ }
75308
+ for(i=0; i<nNew-1; i++){
75309
+ int iB = i;
75310
+ for(j=i+1; j<nNew; j++){
75311
+ if( apNew[j]->pgno < apNew[iB]->pgno ) iB = j;
75312
+ }
75313
+
75314
+ /* If apNew[i] has a page number that is bigger than any of the
75315
+ ** subsequence apNew[i] entries, then swap apNew[i] with the subsequent
75316
+ ** entry that has the smallest page number (which we know to be
75317
+ ** entry apNew[iB]).
75318
+ */
75319
+ if( iB!=i ){
75320
+ Pgno pgnoA = apNew[i]->pgno;
75321
+ Pgno pgnoB = apNew[iB]->pgno;
75322
+ Pgno pgnoTemp = (PENDING_BYTE/pBt->pageSize)+1;
75323
+ u16 fgA = apNew[i]->pDbPage->flags;
75324
+ u16 fgB = apNew[iB]->pDbPage->flags;
75325
+ sqlite3PagerRekey(apNew[i]->pDbPage, pgnoTemp, fgB);
75326
+ sqlite3PagerRekey(apNew[iB]->pDbPage, pgnoA, fgA);
75327
+ sqlite3PagerRekey(apNew[i]->pDbPage, pgnoB, fgB);
75328
+ apNew[i]->pgno = pgnoB;
75329
+ apNew[iB]->pgno = pgnoA;
7516675330
}
7516775331
}
7516875332
7516975333
TRACE(("BALANCE: new: %d(%d nc=%d) %d(%d nc=%d) %d(%d nc=%d) "
7517075334
"%d(%d nc=%d) %d(%d nc=%d)\n",
@@ -79428,10 +79592,20 @@
7942879592
double r2 = (double)i;
7942979593
return r1==0.0
7943079594
|| (memcmp(&r1, &r2, sizeof(r1))==0
7943179595
&& i >= -2251799813685248LL && i < 2251799813685248LL);
7943279596
}
79597
+
79598
+/* Convert a floating point value to its closest integer. Do so in
79599
+** a way that avoids 'outside the range of representable values' warnings
79600
+** from UBSAN.
79601
+*/
79602
+SQLITE_PRIVATE i64 sqlite3RealToI64(double r){
79603
+ if( r<=(double)SMALLEST_INT64 ) return SMALLEST_INT64;
79604
+ if( r>=(double)LARGEST_INT64) return LARGEST_INT64;
79605
+ return (i64)r;
79606
+}
7943379607
7943479608
/*
7943579609
** Convert pMem so that it has type MEM_Real or MEM_Int.
7943679610
** Invalidate any prior representations.
7943779611
**
@@ -79450,11 +79624,11 @@
7945079624
sqlite3_int64 ix;
7945179625
assert( (pMem->flags & (MEM_Blob|MEM_Str))!=0 );
7945279626
assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
7945379627
rc = sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc);
7945479628
if( ((rc==0 || rc==1) && sqlite3Atoi64(pMem->z, &ix, pMem->n, pMem->enc)<=1)
79455
- || sqlite3RealSameAsInt(pMem->u.r, (ix = (i64)pMem->u.r))
79629
+ || sqlite3RealSameAsInt(pMem->u.r, (ix = sqlite3RealToI64(pMem->u.r)))
7945679630
){
7945779631
pMem->u.i = ix;
7945879632
MemSetTypeFlag(pMem, MEM_Int);
7945979633
}else{
7946079634
MemSetTypeFlag(pMem, MEM_Real);
@@ -80682,14 +80856,14 @@
8068280856
p = sqlite3DbMallocRawNN(db, sizeof(Vdbe) );
8068380857
if( p==0 ) return 0;
8068480858
memset(&p->aOp, 0, sizeof(Vdbe)-offsetof(Vdbe,aOp));
8068580859
p->db = db;
8068680860
if( db->pVdbe ){
80687
- db->pVdbe->pPrev = p;
80861
+ db->pVdbe->ppVPrev = &p->pVNext;
8068880862
}
80689
- p->pNext = db->pVdbe;
80690
- p->pPrev = 0;
80863
+ p->pVNext = db->pVdbe;
80864
+ p->ppVPrev = &db->pVdbe;
8069180865
db->pVdbe = p;
8069280866
assert( p->eVdbeState==VDBE_INIT_STATE );
8069380867
p->pParse = pParse;
8069480868
pParse->pVdbe = p;
8069580869
assert( pParse->aLabel==0 );
@@ -80767,25 +80941,32 @@
8076780941
return 0;
8076880942
}
8076980943
#endif
8077080944
8077180945
/*
80772
-** Swap all content between two VDBE structures.
80946
+** Swap byte-code between two VDBE structures.
80947
+**
80948
+** This happens after pB was previously run and returned
80949
+** SQLITE_SCHEMA. The statement was then reprepared in pA.
80950
+** This routine transfers the new bytecode in pA over to pB
80951
+** so that pB can be run again. The old pB byte code is
80952
+** moved back to pA so that it will be cleaned up when pA is
80953
+** finalized.
8077380954
*/
8077480955
SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){
80775
- Vdbe tmp, *pTmp;
80956
+ Vdbe tmp, *pTmp, **ppTmp;
8077680957
char *zTmp;
8077780958
assert( pA->db==pB->db );
8077880959
tmp = *pA;
8077980960
*pA = *pB;
8078080961
*pB = tmp;
80781
- pTmp = pA->pNext;
80782
- pA->pNext = pB->pNext;
80783
- pB->pNext = pTmp;
80784
- pTmp = pA->pPrev;
80785
- pA->pPrev = pB->pPrev;
80786
- pB->pPrev = pTmp;
80962
+ pTmp = pA->pVNext;
80963
+ pA->pVNext = pB->pVNext;
80964
+ pB->pVNext = pTmp;
80965
+ ppTmp = pA->ppVPrev;
80966
+ pA->ppVPrev = pB->ppVPrev;
80967
+ pB->ppVPrev = ppTmp;
8078780968
zTmp = pA->zSql;
8078880969
pA->zSql = pB->zSql;
8078980970
pB->zSql = zTmp;
8079080971
#ifdef SQLITE_ENABLE_NORMALIZE
8079180972
zTmp = pA->zNormSql;
@@ -81033,10 +81214,11 @@
8103381214
pCtx->argc = nArg;
8103481215
pCtx->iOp = sqlite3VdbeCurrentAddr(v);
8103581216
addr = sqlite3VdbeAddOp4(v, eCallCtx ? OP_PureFunc : OP_Function,
8103681217
p1, p2, p3, (char*)pCtx, P4_FUNCCTX);
8103781218
sqlite3VdbeChangeP5(v, eCallCtx & NC_SelfRef);
81219
+ sqlite3MayAbort(pParse);
8103881220
return addr;
8103981221
}
8104081222
8104181223
/*
8104281224
** Add an opcode that includes the p4 value with a P4_INT64 or
@@ -81101,11 +81283,11 @@
8110181283
va_end(ap);
8110281284
v = pParse->pVdbe;
8110381285
iThis = v->nOp;
8110481286
sqlite3VdbeAddOp4(v, OP_Explain, iThis, pParse->addrExplain, 0,
8110581287
zMsg, P4_DYNAMIC);
81106
- sqlite3ExplainBreakpoint(bPush?"PUSH":"", sqlite3VdbeGetOp(v,-1)->p4.z);
81288
+ sqlite3ExplainBreakpoint(bPush?"PUSH":"", sqlite3VdbeGetLastOp(v)->p4.z);
8110781289
if( bPush){
8110881290
pParse->addrExplain = iThis;
8110981291
}
8111081292
}
8111181293
}
@@ -81368,10 +81550,11 @@
8136881550
int opcode = pOp->opcode;
8136981551
if( opcode==OP_Destroy || opcode==OP_VUpdate || opcode==OP_VRename
8137081552
|| opcode==OP_VDestroy
8137181553
|| opcode==OP_VCreate
8137281554
|| opcode==OP_ParseSchema
81555
+ || opcode==OP_Function || opcode==OP_PureFunc
8137381556
|| ((opcode==OP_Halt || opcode==OP_HaltIfNull)
8137481557
&& ((pOp->p1)!=SQLITE_OK && pOp->p2==OE_Abort))
8137581558
){
8137681559
hasAbort = 1;
8137781560
break;
@@ -81458,12 +81641,12 @@
8145881641
Parse *pParse = p->pParse;
8145981642
int *aLabel = pParse->aLabel;
8146081643
p->readOnly = 1;
8146181644
p->bIsReader = 0;
8146281645
pOp = &p->aOp[p->nOp-1];
81463
- while(1){
81464
-
81646
+ assert( p->aOp[0].opcode==OP_Init );
81647
+ while( 1 /* Loop termates when it reaches the OP_Init opcode */ ){
8146581648
/* Only JUMP opcodes and the short list of special opcodes in the switch
8146681649
** below need to be considered. The mkopcodeh.tcl generator script groups
8146781650
** all these opcodes together near the front of the opcode list. Skip
8146881651
** any opcode that does not need processing by virtual of the fact that
8146981652
** it is larger than SQLITE_MX_JUMP_OPCODE, as a performance optimization.
@@ -81488,10 +81671,14 @@
8148881671
case OP_JournalMode: {
8148981672
p->readOnly = 0;
8149081673
p->bIsReader = 1;
8149181674
break;
8149281675
}
81676
+ case OP_Init: {
81677
+ assert( pOp->p2>=0 );
81678
+ goto resolve_p2_values_loop_exit;
81679
+ }
8149381680
#ifndef SQLITE_OMIT_VIRTUALTABLE
8149481681
case OP_VUpdate: {
8149581682
if( pOp->p2>nMaxArgs ) nMaxArgs = pOp->p2;
8149681683
break;
8149781684
}
@@ -81520,15 +81707,16 @@
8152081707
/* The mkopcodeh.tcl script has so arranged things that the only
8152181708
** non-jump opcodes less than SQLITE_MX_JUMP_CODE are guaranteed to
8152281709
** have non-negative values for P2. */
8152381710
assert( (sqlite3OpcodeProperty[pOp->opcode]&OPFLG_JUMP)==0 || pOp->p2>=0);
8152481711
}
81525
- if( pOp==p->aOp ) break;
81712
+ assert( pOp>p->aOp );
8152681713
pOp--;
8152781714
}
81715
+resolve_p2_values_loop_exit:
8152881716
if( aLabel ){
81529
- sqlite3DbFreeNN(p->db, pParse->aLabel);
81717
+ sqlite3DbNNFreeNN(p->db, pParse->aLabel);
8153081718
pParse->aLabel = 0;
8153181719
}
8153281720
pParse->nLabel = 0;
8153381721
*pMaxFuncArgs = nMaxArgs;
8153481722
assert( p->bIsReader!=0 || DbMaskAllZero(p->btreeMask) );
@@ -81773,19 +81961,23 @@
8177381961
/*
8177481962
** Change the value of the opcode, or P1, P2, P3, or P5 operands
8177581963
** for a specific instruction.
8177681964
*/
8177781965
SQLITE_PRIVATE void sqlite3VdbeChangeOpcode(Vdbe *p, int addr, u8 iNewOpcode){
81966
+ assert( addr>=0 );
8177881967
sqlite3VdbeGetOp(p,addr)->opcode = iNewOpcode;
8177981968
}
8178081969
SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe *p, int addr, int val){
81970
+ assert( addr>=0 );
8178181971
sqlite3VdbeGetOp(p,addr)->p1 = val;
8178281972
}
8178381973
SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe *p, int addr, int val){
81974
+ assert( addr>=0 || p->db->mallocFailed );
8178481975
sqlite3VdbeGetOp(p,addr)->p2 = val;
8178581976
}
8178681977
SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe *p, int addr, int val){
81978
+ assert( addr>=0 );
8178781979
sqlite3VdbeGetOp(p,addr)->p3 = val;
8178881980
}
8178981981
SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe *p, u16 p5){
8179081982
assert( p->nOp>0 || p->db->mallocFailed );
8179181983
if( p->nOp>0 ) p->aOp[p->nOp-1].p5 = p5;
@@ -81817,11 +82009,11 @@
8181782009
assert( p->aOp[addr].opcode==OP_Once
8181882010
|| p->aOp[addr].opcode==OP_If
8181982011
|| p->aOp[addr].opcode==OP_FkIfZero );
8182082012
assert( p->aOp[addr].p4type==0 );
8182182013
#ifdef SQLITE_VDBE_COVERAGE
81822
- sqlite3VdbeGetOp(p,-1)->iSrcLine = 0; /* Erase VdbeCoverage() macros */
82014
+ sqlite3VdbeGetLastOp(p)->iSrcLine = 0; /* Erase VdbeCoverage() macros */
8182382015
#endif
8182482016
p->nOp--;
8182582017
}else{
8182682018
sqlite3VdbeChangeP2(p, addr, p->nOp);
8182782019
}
@@ -81831,25 +82023,27 @@
8183182023
/*
8183282024
** If the input FuncDef structure is ephemeral, then free it. If
8183382025
** the FuncDef is not ephermal, then do nothing.
8183482026
*/
8183582027
static void freeEphemeralFunction(sqlite3 *db, FuncDef *pDef){
82028
+ assert( db!=0 );
8183682029
if( (pDef->funcFlags & SQLITE_FUNC_EPHEM)!=0 ){
81837
- sqlite3DbFreeNN(db, pDef);
82030
+ sqlite3DbNNFreeNN(db, pDef);
8183882031
}
8183982032
}
8184082033
8184182034
/*
8184282035
** Delete a P4 value if necessary.
8184382036
*/
8184482037
static SQLITE_NOINLINE void freeP4Mem(sqlite3 *db, Mem *p){
8184582038
if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc);
81846
- sqlite3DbFreeNN(db, p);
82039
+ sqlite3DbNNFreeNN(db, p);
8184782040
}
8184882041
static SQLITE_NOINLINE void freeP4FuncCtx(sqlite3 *db, sqlite3_context *p){
82042
+ assert( db!=0 );
8184982043
freeEphemeralFunction(db, p->pFunc);
81850
- sqlite3DbFreeNN(db, p);
82044
+ sqlite3DbNNFreeNN(db, p);
8185182045
}
8185282046
static void freeP4(sqlite3 *db, int p4type, void *p4){
8185382047
assert( db );
8185482048
switch( p4type ){
8185582049
case P4_FUNCCTX: {
@@ -81858,11 +82052,11 @@
8185882052
}
8185982053
case P4_REAL:
8186082054
case P4_INT64:
8186182055
case P4_DYNAMIC:
8186282056
case P4_INTARRAY: {
81863
- sqlite3DbFree(db, p4);
82057
+ if( p4 ) sqlite3DbNNFreeNN(db, p4);
8186482058
break;
8186582059
}
8186682060
case P4_KEYINFO: {
8186782061
if( db->pnBytesFreed==0 ) sqlite3KeyInfoUnref((KeyInfo*)p4);
8186882062
break;
@@ -81897,10 +82091,11 @@
8189782091
** opcodes contained within. If aOp is not NULL it is assumed to contain
8189882092
** nOp entries.
8189982093
*/
8190082094
static void vdbeFreeOpArray(sqlite3 *db, Op *aOp, int nOp){
8190182095
assert( nOp>=0 );
82096
+ assert( db!=0 );
8190282097
if( aOp ){
8190382098
Op *pOp = &aOp[nOp-1];
8190482099
while(1){ /* Exit via break */
8190582100
if( pOp->p4type <= P4_FREE_IF_LE ) freeP4(db, pOp->p4type, pOp->p4.p);
8190682101
#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
@@ -81907,11 +82102,11 @@
8190782102
sqlite3DbFree(db, pOp->zComment);
8190882103
#endif
8190982104
if( pOp==aOp ) break;
8191082105
pOp--;
8191182106
}
81912
- sqlite3DbFreeNN(db, aOp);
82107
+ sqlite3DbNNFreeNN(db, aOp);
8191382108
}
8191482109
}
8191582110
8191682111
/*
8191782112
** Link the SubProgram object passed as the second argument into the linked
@@ -82138,17 +82333,17 @@
8213882333
#ifdef SQLITE_VDBE_COVERAGE
8213982334
/*
8214082335
** Set the value if the iSrcLine field for the previously coded instruction.
8214182336
*/
8214282337
SQLITE_PRIVATE void sqlite3VdbeSetLineNumber(Vdbe *v, int iLine){
82143
- sqlite3VdbeGetOp(v,-1)->iSrcLine = iLine;
82338
+ sqlite3VdbeGetLastOp(v)->iSrcLine = iLine;
8214482339
}
8214582340
#endif /* SQLITE_VDBE_COVERAGE */
8214682341
8214782342
/*
82148
-** Return the opcode for a given address. If the address is -1, then
82149
-** return the most recently inserted opcode.
82343
+** Return the opcode for a given address. The address must be non-negative.
82344
+** See sqlite3VdbeGetLastOp() to get the most recently added opcode.
8215082345
**
8215182346
** If a memory allocation error has occurred prior to the calling of this
8215282347
** routine, then a pointer to a dummy VdbeOp will be returned. That opcode
8215382348
** is readable but not writable, though it is cast to a writable value.
8215482349
** The return of a dummy opcode allows the call to continue functioning
@@ -82160,20 +82355,23 @@
8216082355
SQLITE_PRIVATE VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){
8216182356
/* C89 specifies that the constant "dummy" will be initialized to all
8216282357
** zeros, which is correct. MSVC generates a warning, nevertheless. */
8216382358
static VdbeOp dummy; /* Ignore the MSVC warning about no initializer */
8216482359
assert( p->eVdbeState==VDBE_INIT_STATE );
82165
- if( addr<0 ){
82166
- addr = p->nOp - 1;
82167
- }
8216882360
assert( (addr>=0 && addr<p->nOp) || p->db->mallocFailed );
8216982361
if( p->db->mallocFailed ){
8217082362
return (VdbeOp*)&dummy;
8217182363
}else{
8217282364
return &p->aOp[addr];
8217382365
}
8217482366
}
82367
+
82368
+/* Return the most recently added opcode
82369
+*/
82370
+VdbeOp * sqlite3VdbeGetLastOp(Vdbe *p){
82371
+ return sqlite3VdbeGetOp(p, p->nOp - 1);
82372
+}
8217582373
8217682374
#if defined(SQLITE_ENABLE_EXPLAIN_COMMENTS)
8217782375
/*
8217882376
** Return an integer value for one of the parameters to the opcode pOp
8217982377
** determined by character c.
@@ -82658,11 +82856,11 @@
8265882856
if( p->flags&(MEM_Agg|MEM_Dyn) ){
8265982857
testcase( (p->flags & MEM_Dyn)!=0 && p->xDel==sqlite3VdbeFrameMemDel );
8266082858
sqlite3VdbeMemRelease(p);
8266182859
p->flags = MEM_Undefined;
8266282860
}else if( p->szMalloc ){
82663
- sqlite3DbFreeNN(db, p->zMalloc);
82861
+ sqlite3DbNNFreeNN(db, p->zMalloc);
8266482862
p->szMalloc = 0;
8266582863
p->flags = MEM_Undefined;
8266682864
}
8266782865
#ifdef SQLITE_DEBUG
8266882866
else{
@@ -83650,11 +83848,11 @@
8365083848
if( sqlite3_stmt_busy((sqlite3_stmt*)p) ){
8365183849
cnt++;
8365283850
if( p->readOnly==0 ) nWrite++;
8365383851
if( p->bIsReader ) nRead++;
8365483852
}
83655
- p = p->pNext;
83853
+ p = p->pVNext;
8365683854
}
8365783855
assert( cnt==db->nVdbeActive );
8365883856
assert( nWrite==db->nVdbeWrite );
8365983857
assert( nRead==db->nVdbeRead );
8366083858
}
@@ -84179,27 +84377,28 @@
8417984377
** VdbeDelete() also unlinks the Vdbe from the list of VMs associated with
8418084378
** the database connection and frees the object itself.
8418184379
*/
8418284380
static void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){
8418384381
SubProgram *pSub, *pNext;
84382
+ assert( db!=0 );
8418484383
assert( p->db==0 || p->db==db );
8418584384
if( p->aColName ){
8418684385
releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
84187
- sqlite3DbFreeNN(db, p->aColName);
84386
+ sqlite3DbNNFreeNN(db, p->aColName);
8418884387
}
8418984388
for(pSub=p->pProgram; pSub; pSub=pNext){
8419084389
pNext = pSub->pNext;
8419184390
vdbeFreeOpArray(db, pSub->aOp, pSub->nOp);
8419284391
sqlite3DbFree(db, pSub);
8419384392
}
8419484393
if( p->eVdbeState!=VDBE_INIT_STATE ){
8419584394
releaseMemArray(p->aVar, p->nVar);
84196
- if( p->pVList ) sqlite3DbFreeNN(db, p->pVList);
84197
- if( p->pFree ) sqlite3DbFreeNN(db, p->pFree);
84395
+ if( p->pVList ) sqlite3DbNNFreeNN(db, p->pVList);
84396
+ if( p->pFree ) sqlite3DbNNFreeNN(db, p->pFree);
8419884397
}
8419984398
vdbeFreeOpArray(db, p->aOp, p->nOp);
84200
- sqlite3DbFree(db, p->zSql);
84399
+ if( p->zSql ) sqlite3DbNNFreeNN(db, p->zSql);
8420184400
#ifdef SQLITE_ENABLE_NORMALIZE
8420284401
sqlite3DbFree(db, p->zNormSql);
8420384402
{
8420484403
DblquoteStr *pThis, *pNext;
8420584404
for(pThis=p->pDblStr; pThis; pThis=pNext){
@@ -84225,24 +84424,21 @@
8422584424
SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe *p){
8422684425
sqlite3 *db;
8422784426
8422884427
assert( p!=0 );
8422984428
db = p->db;
84429
+ assert( db!=0 );
8423084430
assert( sqlite3_mutex_held(db->mutex) );
8423184431
sqlite3VdbeClearObject(db, p);
8423284432
if( db->pnBytesFreed==0 ){
84233
- if( p->pPrev ){
84234
- p->pPrev->pNext = p->pNext;
84235
- }else{
84236
- assert( db->pVdbe==p );
84237
- db->pVdbe = p->pNext;
84238
- }
84239
- if( p->pNext ){
84240
- p->pNext->pPrev = p->pPrev;
84433
+ assert( p->ppVPrev!=0 );
84434
+ *p->ppVPrev = p->pVNext;
84435
+ if( p->pVNext ){
84436
+ p->pVNext->ppVPrev = p->ppVPrev;
8424184437
}
8424284438
}
84243
- sqlite3DbFreeNN(db, p);
84439
+ sqlite3DbNNFreeNN(db, p);
8424484440
}
8424584441
8424684442
/*
8424784443
** The cursor "p" has a pending seek operation that has not yet been
8424884444
** carried out. Seek the cursor now. If an error occurs, return
@@ -85733,11 +85929,11 @@
8573385929
** prepared statements. The flag is set to 1 for an immediate expiration
8573485930
** and set to 2 for an advisory expiration.
8573585931
*/
8573685932
SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3 *db, int iCode){
8573785933
Vdbe *p;
85738
- for(p = db->pVdbe; p; p=p->pNext){
85934
+ for(p = db->pVdbe; p; p=p->pVNext){
8573985935
p->expired = iCode+1;
8574085936
}
8574185937
}
8574285938
8574385939
/*
@@ -85854,17 +86050,18 @@
8585486050
**
8585586051
** This function is used to free UnpackedRecord structures allocated by
8585686052
** the vdbeUnpackRecord() function found in vdbeapi.c.
8585786053
*/
8585886054
static void vdbeFreeUnpacked(sqlite3 *db, int nField, UnpackedRecord *p){
86055
+ assert( db!=0 );
8585986056
if( p ){
8586086057
int i;
8586186058
for(i=0; i<nField; i++){
8586286059
Mem *pMem = &p->aMem[i];
8586386060
if( pMem->zMalloc ) sqlite3VdbeMemReleaseMalloc(pMem);
8586486061
}
85865
- sqlite3DbFreeNN(db, p);
86062
+ sqlite3DbNNFreeNN(db, p);
8586686063
}
8586786064
}
8586886065
#endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
8586986066
8587086067
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
@@ -85931,11 +86128,11 @@
8593186128
if( preupdate.aNew ){
8593286129
int i;
8593386130
for(i=0; i<pCsr->nField; i++){
8593486131
sqlite3VdbeMemRelease(&preupdate.aNew[i]);
8593586132
}
85936
- sqlite3DbFreeNN(db, preupdate.aNew);
86133
+ sqlite3DbNNFreeNN(db, preupdate.aNew);
8593786134
}
8593886135
}
8593986136
#endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
8594086137
8594186138
/************** End of vdbeaux.c *********************************************/
@@ -86048,11 +86245,13 @@
8604886245
Vdbe *v = (Vdbe*)pStmt;
8604986246
sqlite3 *db = v->db;
8605086247
if( vdbeSafety(v) ) return SQLITE_MISUSE_BKPT;
8605186248
sqlite3_mutex_enter(db->mutex);
8605286249
checkProfileCallback(db, v);
86053
- rc = sqlite3VdbeFinalize(v);
86250
+ assert( v->eVdbeState>=VDBE_READY_STATE );
86251
+ rc = sqlite3VdbeReset(v);
86252
+ sqlite3VdbeDelete(v);
8605486253
rc = sqlite3ApiExit(db, rc);
8605586254
sqlite3LeaveMutexAndCloseZombie(db);
8605686255
}
8605786256
return rc;
8605886257
}
@@ -87370,11 +87569,11 @@
8737087569
** the mutex is released if any kind of error occurs.
8737187570
**
8737287571
** The error code stored in database p->db is overwritten with the return
8737387572
** value in any case.
8737487573
*/
87375
-static int vdbeUnbind(Vdbe *p, int i){
87574
+static int vdbeUnbind(Vdbe *p, unsigned int i){
8737687575
Mem *pVar;
8737787576
if( vdbeSafetyNotNull(p) ){
8737887577
return SQLITE_MISUSE_BKPT;
8737987578
}
8738087579
sqlite3_mutex_enter(p->db->mutex);
@@ -87383,16 +87582,15 @@
8738387582
sqlite3_mutex_leave(p->db->mutex);
8738487583
sqlite3_log(SQLITE_MISUSE,
8738587584
"bind on a busy prepared statement: [%s]", p->zSql);
8738687585
return SQLITE_MISUSE_BKPT;
8738787586
}
87388
- if( i<1 || i>p->nVar ){
87587
+ if( i>=(unsigned int)p->nVar ){
8738987588
sqlite3Error(p->db, SQLITE_RANGE);
8739087589
sqlite3_mutex_leave(p->db->mutex);
8739187590
return SQLITE_RANGE;
8739287591
}
87393
- i--;
8739487592
pVar = &p->aVar[i];
8739587593
sqlite3VdbeMemRelease(pVar);
8739687594
pVar->flags = MEM_Null;
8739787595
p->db->errCode = SQLITE_OK;
8739887596
@@ -87425,11 +87623,11 @@
8742587623
){
8742687624
Vdbe *p = (Vdbe *)pStmt;
8742787625
Mem *pVar;
8742887626
int rc;
8742987627
87430
- rc = vdbeUnbind(p, i);
87628
+ rc = vdbeUnbind(p, (u32)(i-1));
8743187629
if( rc==SQLITE_OK ){
8743287630
if( zData!=0 ){
8743387631
pVar = &p->aVar[i-1];
8743487632
rc = sqlite3VdbeMemSetStr(pVar, zData, nData, encoding, xDel);
8743587633
if( rc==SQLITE_OK && encoding!=0 ){
@@ -87474,11 +87672,11 @@
8747487672
return bindText(pStmt, i, zData, nData, xDel, 0);
8747587673
}
8747687674
SQLITE_API int sqlite3_bind_double(sqlite3_stmt *pStmt, int i, double rValue){
8747787675
int rc;
8747887676
Vdbe *p = (Vdbe *)pStmt;
87479
- rc = vdbeUnbind(p, i);
87677
+ rc = vdbeUnbind(p, (u32)(i-1));
8748087678
if( rc==SQLITE_OK ){
8748187679
sqlite3VdbeMemSetDouble(&p->aVar[i-1], rValue);
8748287680
sqlite3_mutex_leave(p->db->mutex);
8748387681
}
8748487682
return rc;
@@ -87487,21 +87685,21 @@
8748787685
return sqlite3_bind_int64(p, i, (i64)iValue);
8748887686
}
8748987687
SQLITE_API int sqlite3_bind_int64(sqlite3_stmt *pStmt, int i, sqlite_int64 iValue){
8749087688
int rc;
8749187689
Vdbe *p = (Vdbe *)pStmt;
87492
- rc = vdbeUnbind(p, i);
87690
+ rc = vdbeUnbind(p, (u32)(i-1));
8749387691
if( rc==SQLITE_OK ){
8749487692
sqlite3VdbeMemSetInt64(&p->aVar[i-1], iValue);
8749587693
sqlite3_mutex_leave(p->db->mutex);
8749687694
}
8749787695
return rc;
8749887696
}
8749987697
SQLITE_API int sqlite3_bind_null(sqlite3_stmt *pStmt, int i){
8750087698
int rc;
8750187699
Vdbe *p = (Vdbe*)pStmt;
87502
- rc = vdbeUnbind(p, i);
87700
+ rc = vdbeUnbind(p, (u32)(i-1));
8750387701
if( rc==SQLITE_OK ){
8750487702
sqlite3_mutex_leave(p->db->mutex);
8750587703
}
8750687704
return rc;
8750787705
}
@@ -87512,11 +87710,11 @@
8751287710
const char *zPTtype,
8751387711
void (*xDestructor)(void*)
8751487712
){
8751587713
int rc;
8751687714
Vdbe *p = (Vdbe*)pStmt;
87517
- rc = vdbeUnbind(p, i);
87715
+ rc = vdbeUnbind(p, (u32)(i-1));
8751887716
if( rc==SQLITE_OK ){
8751987717
sqlite3VdbeMemSetPointer(&p->aVar[i-1], pPtr, zPTtype, xDestructor);
8752087718
sqlite3_mutex_leave(p->db->mutex);
8752187719
}else if( xDestructor ){
8752287720
xDestructor(pPtr);
@@ -87590,11 +87788,11 @@
8759087788
return rc;
8759187789
}
8759287790
SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt *pStmt, int i, int n){
8759387791
int rc;
8759487792
Vdbe *p = (Vdbe *)pStmt;
87595
- rc = vdbeUnbind(p, i);
87793
+ rc = vdbeUnbind(p, (u32)(i-1));
8759687794
if( rc==SQLITE_OK ){
8759787795
#ifndef SQLITE_OMIT_INCRBLOB
8759887796
sqlite3VdbeMemSetZeroBlob(&p->aVar[i-1], n);
8759987797
#else
8760087798
rc = sqlite3VdbeMemSetZeroBlob(&p->aVar[i-1], n);
@@ -87750,11 +87948,11 @@
8775087948
#endif
8775187949
sqlite3_mutex_enter(pDb->mutex);
8775287950
if( pStmt==0 ){
8775387951
pNext = (sqlite3_stmt*)pDb->pVdbe;
8775487952
}else{
87755
- pNext = (sqlite3_stmt*)((Vdbe*)pStmt)->pNext;
87953
+ pNext = (sqlite3_stmt*)((Vdbe*)pStmt)->pVNext;
8775687954
}
8775787955
sqlite3_mutex_leave(pDb->mutex);
8775887956
return pNext;
8775987957
}
8776087958
@@ -87775,12 +87973,15 @@
8777587973
if( op==SQLITE_STMTSTATUS_MEMUSED ){
8777687974
sqlite3 *db = pVdbe->db;
8777787975
sqlite3_mutex_enter(db->mutex);
8777887976
v = 0;
8777987977
db->pnBytesFreed = (int*)&v;
87978
+ assert( db->lookaside.pEnd==db->lookaside.pTrueEnd );
87979
+ db->lookaside.pEnd = db->lookaside.pStart;
8778087980
sqlite3VdbeDelete(pVdbe);
8778187981
db->pnBytesFreed = 0;
87982
+ db->lookaside.pEnd = db->lookaside.pTrueEnd;
8778287983
sqlite3_mutex_leave(db->mutex);
8778387984
}else{
8778487985
v = pVdbe->aCounter[op];
8778587986
if( resetFlag ) pVdbe->aCounter[op] = 0;
8778687987
}
@@ -88616,11 +88817,12 @@
8861688817
** floating point value of rValue. Return true and set *piValue to the
8861788818
** integer value if the string is in range to be an integer. Otherwise,
8861888819
** return false.
8861988820
*/
8862088821
static int alsoAnInt(Mem *pRec, double rValue, i64 *piValue){
88621
- i64 iValue = (double)rValue;
88822
+ i64 iValue;
88823
+ iValue = sqlite3RealToI64(rValue);
8862288824
if( sqlite3RealSameAsInt(rValue,iValue) ){
8862388825
*piValue = iValue;
8862488826
return 1;
8862588827
}
8862688828
return 0==sqlite3Atoi64(pRec->z, piValue, pRec->n, pRec->enc);
@@ -88778,21 +88980,22 @@
8877888980
**
8877988981
** Unlike applyNumericAffinity(), this routine does not modify pMem->flags.
8878088982
** But it does set pMem->u.r and pMem->u.i appropriately.
8878188983
*/
8878288984
static u16 numericType(Mem *pMem){
88783
- if( pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal) ){
88985
+ assert( (pMem->flags & MEM_Null)==0
88986
+ || pMem->db==0 || pMem->db->mallocFailed );
88987
+ if( pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal|MEM_Null) ){
8878488988
testcase( pMem->flags & MEM_Int );
8878588989
testcase( pMem->flags & MEM_Real );
8878688990
testcase( pMem->flags & MEM_IntReal );
88787
- return pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal);
88991
+ return pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal|MEM_Null);
8878888992
}
88789
- if( pMem->flags & (MEM_Str|MEM_Blob) ){
88790
- testcase( pMem->flags & MEM_Str );
88791
- testcase( pMem->flags & MEM_Blob );
88792
- return computeNumericType(pMem);
88793
- }
88993
+ assert( pMem->flags & (MEM_Str|MEM_Blob) );
88994
+ testcase( pMem->flags & MEM_Str );
88995
+ testcase( pMem->flags & MEM_Blob );
88996
+ return computeNumericType(pMem);
8879488997
return 0;
8879588998
}
8879688999
8879789000
#ifdef SQLITE_DEBUG
8879889001
/*
@@ -90033,25 +90236,24 @@
9003390236
case OP_Add: /* same as TK_PLUS, in1, in2, out3 */
9003490237
case OP_Subtract: /* same as TK_MINUS, in1, in2, out3 */
9003590238
case OP_Multiply: /* same as TK_STAR, in1, in2, out3 */
9003690239
case OP_Divide: /* same as TK_SLASH, in1, in2, out3 */
9003790240
case OP_Remainder: { /* same as TK_REM, in1, in2, out3 */
90038
- u16 flags; /* Combined MEM_* flags from both inputs */
9003990241
u16 type1; /* Numeric type of left operand */
9004090242
u16 type2; /* Numeric type of right operand */
9004190243
i64 iA; /* Integer value of left operand */
9004290244
i64 iB; /* Integer value of right operand */
9004390245
double rA; /* Real value of left operand */
9004490246
double rB; /* Real value of right operand */
9004590247
9004690248
pIn1 = &aMem[pOp->p1];
90047
- type1 = numericType(pIn1);
90249
+ type1 = pIn1->flags;
9004890250
pIn2 = &aMem[pOp->p2];
90049
- type2 = numericType(pIn2);
90251
+ type2 = pIn2->flags;
9005090252
pOut = &aMem[pOp->p3];
90051
- flags = pIn1->flags | pIn2->flags;
9005290253
if( (type1 & type2 & MEM_Int)!=0 ){
90254
+int_math:
9005390255
iA = pIn1->u.i;
9005490256
iB = pIn2->u.i;
9005590257
switch( pOp->opcode ){
9005690258
case OP_Add: if( sqlite3AddInt64(&iB,iA) ) goto fp_math; break;
9005790259
case OP_Subtract: if( sqlite3SubInt64(&iB,iA) ) goto fp_math; break;
@@ -90069,13 +90271,16 @@
9006990271
break;
9007090272
}
9007190273
}
9007290274
pOut->u.i = iB;
9007390275
MemSetTypeFlag(pOut, MEM_Int);
90074
- }else if( (flags & MEM_Null)!=0 ){
90276
+ }else if( ((type1 | type2) & MEM_Null)!=0 ){
9007590277
goto arithmetic_result_is_null;
9007690278
}else{
90279
+ type1 = numericType(pIn1);
90280
+ type2 = numericType(pIn2);
90281
+ if( (type1 & type2 & MEM_Int)!=0 ) goto int_math;
9007790282
fp_math:
9007890283
rA = sqlite3VdbeRealValue(pIn1);
9007990284
rB = sqlite3VdbeRealValue(pIn2);
9008090285
switch( pOp->opcode ){
9008190286
case OP_Add: rB += rA; break;
@@ -90941,15 +91146,18 @@
9094191146
**
9094291147
** Check the cursor P1 to see if it is currently pointing at a NULL row.
9094391148
** If it is, then set register P3 to NULL and jump immediately to P2.
9094491149
** If P1 is not on a NULL row, then fall through without making any
9094591150
** changes.
91151
+**
91152
+** If P1 is not an open cursor, then this opcode is a no-op.
9094691153
*/
9094791154
case OP_IfNullRow: { /* jump */
91155
+ VdbeCursor *pC;
9094891156
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
90949
- assert( p->apCsr[pOp->p1]!=0 );
90950
- if( p->apCsr[pOp->p1]->nullRow ){
91157
+ pC = p->apCsr[pOp->p1];
91158
+ if( ALWAYS(pC) && pC->nullRow ){
9095191159
sqlite3VdbeMemSetNull(aMem + pOp->p3);
9095291160
goto jump_to_p2;
9095391161
}
9095491162
break;
9095591163
}
@@ -93052,11 +93260,11 @@
9305293260
**
9305393261
** <li> If the cursor is successfully moved to the target row by 0 or more
9305493262
** sqlite3BtreeNext() calls, then jump to This.P2, which will land just
9305593263
** past the OP_IdxGT or OP_IdxGE opcode that follows the OP_SeekGE.
9305693264
**
93057
-** <li> If the cursor ends up past the target row (indicating the the target
93265
+** <li> If the cursor ends up past the target row (indicating that the target
9305893266
** row does not exist in the btree) then jump to SeekOP.P2.
9305993267
** </ol>
9306093268
*/
9306193269
case OP_SeekScan: {
9306293270
VdbeCursor *pC;
@@ -94388,11 +94596,13 @@
9438894596
rc = sqlite3VdbeSorterNext(db, pC);
9438994597
goto next_tail;
9439094598
9439194599
case OP_Prev: /* jump */
9439294600
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
94393
- assert( pOp->p5<ArraySize(p->aCounter) );
94601
+ assert( pOp->p5==0
94602
+ || pOp->p5==SQLITE_STMTSTATUS_FULLSCAN_STEP
94603
+ || pOp->p5==SQLITE_STMTSTATUS_AUTOINDEX);
9439494604
pC = p->apCsr[pOp->p1];
9439594605
assert( pC!=0 );
9439694606
assert( pC->deferredMoveto==0 );
9439794607
assert( pC->eCurType==CURTYPE_BTREE );
9439894608
assert( pC->seekOp==OP_SeekLT || pC->seekOp==OP_SeekLE
@@ -94401,11 +94611,13 @@
9440194611
rc = sqlite3BtreePrevious(pC->uc.pCursor, pOp->p3);
9440294612
goto next_tail;
9440394613
9440494614
case OP_Next: /* jump */
9440594615
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
94406
- assert( pOp->p5<ArraySize(p->aCounter) );
94616
+ assert( pOp->p5==0
94617
+ || pOp->p5==SQLITE_STMTSTATUS_FULLSCAN_STEP
94618
+ || pOp->p5==SQLITE_STMTSTATUS_AUTOINDEX);
9440794619
pC = p->apCsr[pOp->p1];
9440894620
assert( pC!=0 );
9440994621
assert( pC->deferredMoveto==0 );
9441094622
assert( pC->eCurType==CURTYPE_BTREE );
9441194623
assert( pC->seekOp==OP_SeekGT || pC->seekOp==OP_SeekGE
@@ -94608,14 +94820,14 @@
9460894820
9460994821
/* The IdxRowid and Seek opcodes are combined because of the commonality
9461094822
** of sqlite3VdbeCursorRestore() and sqlite3VdbeIdxRowid(). */
9461194823
rc = sqlite3VdbeCursorRestore(pC);
9461294824
94613
- /* sqlite3VbeCursorRestore() can only fail if the record has been deleted
94614
- ** out from under the cursor. That will never happens for an IdxRowid
94615
- ** or Seek opcode */
94616
- if( NEVER(rc!=SQLITE_OK) ) goto abort_due_to_error;
94825
+ /* sqlite3VdbeCursorRestore() may fail if the cursor has been disturbed
94826
+ ** since it was last positioned and an error (e.g. OOM or an IO error)
94827
+ ** occurs while trying to reposition it. */
94828
+ if( rc!=SQLITE_OK ) goto abort_due_to_error;
9461794829
9461894830
if( !pC->nullRow ){
9461994831
rowid = 0; /* Not needed. Only used to silence a warning. */
9462094832
rc = sqlite3VdbeIdxRowid(db, pC->uc.pCursor, &rowid);
9462194833
if( rc!=SQLITE_OK ){
@@ -95513,11 +95725,11 @@
9551395725
9551495726
/* Opcode: OffsetLimit P1 P2 P3 * *
9551595727
** Synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)
9551695728
**
9551795729
** This opcode performs a commonly used computation associated with
95518
-** LIMIT and OFFSET process. r[P1] holds the limit counter. r[P3]
95730
+** LIMIT and OFFSET processing. r[P1] holds the limit counter. r[P3]
9551995731
** holds the offset counter. The opcode computes the combined value
9552095732
** of the LIMIT and OFFSET and stores that value in r[P2]. The r[P2]
9552195733
** value computed is the total number of rows that will need to be
9552295734
** visited in order to complete the query.
9552395735
**
@@ -101110,10 +101322,12 @@
101110101322
sqlite3_file *pJfd, /* Preallocated, blank file handle */
101111101323
int flags, /* Opening flags */
101112101324
int nSpill /* Bytes buffered before opening the file */
101113101325
){
101114101326
MemJournal *p = (MemJournal*)pJfd;
101327
+
101328
+ assert( zName || nSpill<0 || (flags & SQLITE_OPEN_EXCLUSIVE) );
101115101329
101116101330
/* Zero the file-handle object. If nSpill was passed zero, initialize
101117101331
** it using the sqlite3OsOpen() function of the underlying VFS. In this
101118101332
** case none of the code in this module is executed as a result of calls
101119101333
** made on the journal file-handle. */
@@ -101552,13 +101766,11 @@
101552101766
if( ExprHasProperty(pExpr, EP_WinFunc) ){
101553101767
if( ALWAYS(pExpr->y.pWin!=0) ){
101554101768
pExpr->y.pWin->pOwner = pExpr;
101555101769
}
101556101770
}
101557
- sqlite3ParserAddCleanup(pParse,
101558
- (void(*)(sqlite3*,void*))sqlite3ExprDelete,
101559
- pDup);
101771
+ sqlite3ExprDeferredDelete(pParse, pDup);
101560101772
}
101561101773
}
101562101774
101563101775
/*
101564101776
** Subqueries stores the original database, table and column names for their
@@ -104363,11 +104575,13 @@
104363104575
** Also propagate EP_Propagate flags up from Expr.x.pList to Expr.flags,
104364104576
** if appropriate.
104365104577
*/
104366104578
static void exprSetHeight(Expr *p){
104367104579
int nHeight = p->pLeft ? p->pLeft->nHeight : 0;
104368
- if( p->pRight && p->pRight->nHeight>nHeight ) nHeight = p->pRight->nHeight;
104580
+ if( NEVER(p->pRight) && p->pRight->nHeight>nHeight ){
104581
+ nHeight = p->pRight->nHeight;
104582
+ }
104369104583
if( ExprUseXSelect(p) ){
104370104584
heightOfSelect(p->x.pSelect, &nHeight);
104371104585
}else if( p->x.pList ){
104372104586
heightOfExprList(p->x.pList, &nHeight);
104373104587
p->flags |= EP_Propagate & sqlite3ExprListFlags(p->x.pList);
@@ -104506,19 +104720,30 @@
104506104720
if( pRoot==0 ){
104507104721
assert( db->mallocFailed );
104508104722
sqlite3ExprDelete(db, pLeft);
104509104723
sqlite3ExprDelete(db, pRight);
104510104724
}else{
104725
+ assert( ExprUseXList(pRoot) );
104726
+ assert( pRoot->x.pSelect==0 );
104511104727
if( pRight ){
104512104728
pRoot->pRight = pRight;
104513104729
pRoot->flags |= EP_Propagate & pRight->flags;
104730
+#if SQLITE_MAX_EXPR_DEPTH>0
104731
+ pRoot->nHeight = pRight->nHeight+1;
104732
+ }else{
104733
+ pRoot->nHeight = 1;
104734
+#endif
104514104735
}
104515104736
if( pLeft ){
104516104737
pRoot->pLeft = pLeft;
104517104738
pRoot->flags |= EP_Propagate & pLeft->flags;
104739
+#if SQLITE_MAX_EXPR_DEPTH>0
104740
+ if( pLeft->nHeight>=pRoot->nHeight ){
104741
+ pRoot->nHeight = pLeft->nHeight+1;
104742
+ }
104743
+#endif
104518104744
}
104519
- exprSetHeight(pRoot);
104520104745
}
104521104746
}
104522104747
104523104748
/*
104524104749
** Allocate an Expr node which joins as many as two subtrees.
@@ -104800,10 +105025,11 @@
104800105025
/*
104801105026
** Recursively delete an expression tree.
104802105027
*/
104803105028
static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){
104804105029
assert( p!=0 );
105030
+ assert( db!=0 );
104805105031
assert( !ExprUseUValue(p) || p->u.iValue>=0 );
104806105032
assert( !ExprUseYWin(p) || !ExprUseYSub(p) );
104807105033
assert( !ExprUseYWin(p) || p->y.pWin!=0 || db->mallocFailed );
104808105034
assert( p->op!=TK_FUNCTION || !ExprUseYSub(p) );
104809105035
#ifdef SQLITE_DEBUG
@@ -104831,16 +105057,12 @@
104831105057
sqlite3WindowDelete(db, p->y.pWin);
104832105058
}
104833105059
#endif
104834105060
}
104835105061
}
104836
- if( ExprHasProperty(p, EP_MemToken) ){
104837
- assert( !ExprHasProperty(p, EP_IntValue) );
104838
- sqlite3DbFree(db, p->u.zToken);
104839
- }
104840105062
if( !ExprHasProperty(p, EP_Static) ){
104841
- sqlite3DbFreeNN(db, p);
105063
+ sqlite3DbNNFreeNN(db, p);
104842105064
}
104843105065
}
104844105066
SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3 *db, Expr *p){
104845105067
if( p ) sqlite3ExprDeleteNN(db, p);
104846105068
}
@@ -104867,12 +105089,13 @@
104867105089
**
104868105090
** The deferred delete is (currently) implemented by adding the
104869105091
** pExpr to the pParse->pConstExpr list with a register number of 0.
104870105092
*/
104871105093
SQLITE_PRIVATE void sqlite3ExprDeferredDelete(Parse *pParse, Expr *pExpr){
104872
- pParse->pConstExpr =
104873
- sqlite3ExprListAppend(pParse, pParse->pConstExpr, pExpr);
105094
+ sqlite3ParserAddCleanup(pParse,
105095
+ (void(*)(sqlite3*,void*))sqlite3ExprDelete,
105096
+ pExpr);
104874105097
}
104875105098
104876105099
/* Invoke sqlite3RenameExprUnmap() and sqlite3ExprDelete() on the
104877105100
** expression.
104878105101
*/
@@ -104942,11 +105165,10 @@
104942105165
){
104943105166
nSize = EXPR_FULLSIZE;
104944105167
}else{
104945105168
assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) );
104946105169
assert( !ExprHasProperty(p, EP_OuterON) );
104947
- assert( !ExprHasProperty(p, EP_MemToken) );
104948105170
assert( !ExprHasVVAProperty(p, EP_NoReduce) );
104949105171
if( p->pLeft || p->x.pList ){
104950105172
nSize = EXPR_REDUCEDSIZE | EP_Reduced;
104951105173
}else{
104952105174
assert( p->pRight==0 );
@@ -105046,11 +105268,11 @@
105046105268
memset(&zAlloc[nSize], 0, EXPR_FULLSIZE-nSize);
105047105269
}
105048105270
}
105049105271
105050105272
/* Set the EP_Reduced, EP_TokenOnly, and EP_Static flags appropriately. */
105051
- pNew->flags &= ~(EP_Reduced|EP_TokenOnly|EP_Static|EP_MemToken);
105273
+ pNew->flags &= ~(EP_Reduced|EP_TokenOnly|EP_Static);
105052105274
pNew->flags |= nStructSize & (EP_Reduced|EP_TokenOnly);
105053105275
pNew->flags |= staticFlag;
105054105276
ExprClearVVAProperties(pNew);
105055105277
if( dupFlags ){
105056105278
ExprSetVVAProperty(pNew, EP_Immutable);
@@ -105622,16 +105844,17 @@
105622105844
*/
105623105845
static SQLITE_NOINLINE void exprListDeleteNN(sqlite3 *db, ExprList *pList){
105624105846
int i = pList->nExpr;
105625105847
struct ExprList_item *pItem = pList->a;
105626105848
assert( pList->nExpr>0 );
105849
+ assert( db!=0 );
105627105850
do{
105628105851
sqlite3ExprDelete(db, pItem->pExpr);
105629
- sqlite3DbFree(db, pItem->zEName);
105852
+ if( pItem->zEName ) sqlite3DbNNFreeNN(db, pItem->zEName);
105630105853
pItem++;
105631105854
}while( --i>0 );
105632
- sqlite3DbFreeNN(db, pList);
105855
+ sqlite3DbNNFreeNN(db, pList);
105633105856
}
105634105857
SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3 *db, ExprList *pList){
105635105858
if( pList ) exprListDeleteNN(db, pList);
105636105859
}
105637105860
@@ -106918,11 +107141,11 @@
106918107141
if( pLimit ){
106919107142
pLimit->affExpr = SQLITE_AFF_NUMERIC;
106920107143
pLimit = sqlite3PExpr(pParse, TK_NE,
106921107144
sqlite3ExprDup(db, pSel->pLimit->pLeft, 0), pLimit);
106922107145
}
106923
- sqlite3ExprDelete(db, pSel->pLimit->pLeft);
107146
+ sqlite3ExprDeferredDelete(pParse, pSel->pLimit->pLeft);
106924107147
pSel->pLimit->pLeft = pLimit;
106925107148
}else{
106926107149
/* If there is no pre-existing limit add a limit of 1 */
106927107150
pLimit = sqlite3Expr(pParse->db, TK_INTEGER, "1");
106928107151
pSel->pLimit = sqlite3PExpr(pParse, TK_LIMIT, pLimit, 0);
@@ -107432,11 +107655,11 @@
107432107655
u8 p5 /* P5 value for OP_Column + FLAGS */
107433107656
){
107434107657
assert( pParse->pVdbe!=0 );
107435107658
sqlite3ExprCodeGetColumnOfTable(pParse->pVdbe, pTab, iTable, iColumn, iReg);
107436107659
if( p5 ){
107437
- VdbeOp *pOp = sqlite3VdbeGetOp(pParse->pVdbe,-1);
107660
+ VdbeOp *pOp = sqlite3VdbeGetLastOp(pParse->pVdbe);
107438107661
if( pOp->opcode==OP_Column ) pOp->p5 = p5;
107439107662
}
107440107663
return iReg;
107441107664
}
107442107665
@@ -107501,11 +107724,11 @@
107501107724
/*
107502107725
** If the last opcode is a OP_Copy, then set the do-not-merge flag (p5)
107503107726
** so that a subsequent copy will not be merged into this one.
107504107727
*/
107505107728
static void setDoNotMergeFlagOnCopy(Vdbe *v){
107506
- if( sqlite3VdbeGetOp(v, -1)->opcode==OP_Copy ){
107729
+ if( sqlite3VdbeGetLastOp(v)->opcode==OP_Copy ){
107507107730
sqlite3VdbeChangeP5(v, 1); /* Tag trailing OP_Copy as not mergable */
107508107731
}
107509107732
}
107510107733
107511107734
/*
@@ -107672,11 +107895,11 @@
107672107895
Table *pTab = pCol->pTab;
107673107896
sqlite3VdbeAddOp3(v, OP_Column, pAggInfo->sortingIdxPTab,
107674107897
pCol->iSorterColumn, target);
107675107898
if( pCol->iColumn<0 ){
107676107899
VdbeComment((v,"%s.rowid",pTab->zName));
107677
- }else{
107900
+ }else if( ALWAYS(pTab!=0) ){
107678107901
VdbeComment((v,"%s.%s",
107679107902
pTab->zName, pTab->aCol[pCol->iColumn].zCnName));
107680107903
if( pTab->aCol[pCol->iColumn].affinity==SQLITE_AFF_REAL ){
107681107904
sqlite3VdbeAddOp1(v, OP_RealAffinity, target);
107682107905
}
@@ -108267,10 +108490,25 @@
108267108490
** on a LEFT JOIN NULL row.
108268108491
*/
108269108492
case TK_IF_NULL_ROW: {
108270108493
int addrINR;
108271108494
u8 okConstFactor = pParse->okConstFactor;
108495
+ AggInfo *pAggInfo = pExpr->pAggInfo;
108496
+ if( pAggInfo ){
108497
+ assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn );
108498
+ if( !pAggInfo->directMode ){
108499
+ inReg = pAggInfo->aCol[pExpr->iAgg].iMem;
108500
+ break;
108501
+ }
108502
+ if( pExpr->pAggInfo->useSortingIdx ){
108503
+ sqlite3VdbeAddOp3(v, OP_Column, pAggInfo->sortingIdxPTab,
108504
+ pAggInfo->aCol[pExpr->iAgg].iSorterColumn,
108505
+ target);
108506
+ inReg = target;
108507
+ break;
108508
+ }
108509
+ }
108272108510
addrINR = sqlite3VdbeAddOp1(v, OP_IfNullRow, pExpr->iTable);
108273108511
/* Temporarily disable factoring of constant expressions, since
108274108512
** even though expressions may appear to be constant, they are not
108275108513
** really constant because they originate from the right-hand side
108276108514
** of a LEFT JOIN. */
@@ -108608,11 +108846,11 @@
108608108846
}else{
108609108847
int inReg = sqlite3ExprCodeTarget(pParse, pExpr, target+i);
108610108848
if( inReg!=target+i ){
108611108849
VdbeOp *pOp;
108612108850
if( copyOp==OP_Copy
108613
- && (pOp=sqlite3VdbeGetOp(v, -1))->opcode==OP_Copy
108851
+ && (pOp=sqlite3VdbeGetLastOp(v))->opcode==OP_Copy
108614108852
&& pOp->p1+pOp->p3+1==inReg
108615108853
&& pOp->p2+pOp->p3+1==target+i
108616108854
&& pOp->p5==0 /* The do-not-merge flag must be clear */
108617108855
){
108618108856
pOp->p3++;
@@ -109644,10 +109882,11 @@
109644109882
** fact is exploited for efficiency.
109645109883
*/
109646109884
SQLITE_PRIVATE int sqlite3ReferencesSrcList(Parse *pParse, Expr *pExpr, SrcList *pSrcList){
109647109885
Walker w;
109648109886
struct RefSrcList x;
109887
+ assert( pParse->db!=0 );
109649109888
memset(&w, 0, sizeof(w));
109650109889
memset(&x, 0, sizeof(x));
109651109890
w.xExprCallback = exprRefToSrcList;
109652109891
w.xSelectCallback = selectRefEnter;
109653109892
w.xSelectCallback2 = selectRefLeave;
@@ -109660,11 +109899,11 @@
109660109899
#ifndef SQLITE_OMIT_WINDOWFUNC
109661109900
if( ExprHasProperty(pExpr, EP_WinFunc) ){
109662109901
sqlite3WalkExpr(&w, pExpr->y.pWin->pFilter);
109663109902
}
109664109903
#endif
109665
- sqlite3DbFree(pParse->db, x.aiExclude);
109904
+ if( x.aiExclude ) sqlite3DbNNFreeNN(pParse->db, x.aiExclude);
109666109905
if( w.eCode & 0x01 ){
109667109906
return 1;
109668109907
}else if( w.eCode ){
109669109908
return 0;
109670109909
}else{
@@ -109691,21 +109930,22 @@
109691109930
){
109692109931
AggInfo *pAggInfo = pExpr->pAggInfo;
109693109932
int iAgg = pExpr->iAgg;
109694109933
Parse *pParse = pWalker->pParse;
109695109934
sqlite3 *db = pParse->db;
109696
- assert( pExpr->op==TK_AGG_COLUMN || pExpr->op==TK_AGG_FUNCTION );
109697
- if( pExpr->op==TK_AGG_COLUMN ){
109935
+ if( pExpr->op!=TK_AGG_FUNCTION ){
109936
+ assert( pExpr->op==TK_AGG_COLUMN || pExpr->op==TK_IF_NULL_ROW );
109698109937
assert( iAgg>=0 && iAgg<pAggInfo->nColumn );
109699109938
if( pAggInfo->aCol[iAgg].pCExpr==pExpr ){
109700109939
pExpr = sqlite3ExprDup(db, pExpr, 0);
109701109940
if( pExpr ){
109702109941
pAggInfo->aCol[iAgg].pCExpr = pExpr;
109703109942
sqlite3ExprDeferredDelete(pParse, pExpr);
109704109943
}
109705109944
}
109706109945
}else{
109946
+ assert( pExpr->op==TK_AGG_FUNCTION );
109707109947
assert( iAgg>=0 && iAgg<pAggInfo->nFunc );
109708109948
if( pAggInfo->aFunc[iAgg].pFExpr==pExpr ){
109709109949
pExpr = sqlite3ExprDup(db, pExpr, 0);
109710109950
if( pExpr ){
109711109951
pAggInfo->aFunc[iAgg].pFExpr = pExpr;
@@ -109772,14 +110012,16 @@
109772110012
SrcList *pSrcList = pNC->pSrcList;
109773110013
AggInfo *pAggInfo = pNC->uNC.pAggInfo;
109774110014
109775110015
assert( pNC->ncFlags & NC_UAggInfo );
109776110016
switch( pExpr->op ){
110017
+ case TK_IF_NULL_ROW:
109777110018
case TK_AGG_COLUMN:
109778110019
case TK_COLUMN: {
109779110020
testcase( pExpr->op==TK_AGG_COLUMN );
109780110021
testcase( pExpr->op==TK_COLUMN );
110022
+ testcase( pExpr->op==TK_IF_NULL_ROW );
109781110023
/* Check to see if the column is in one of the tables in the FROM
109782110024
** clause of the aggregate query */
109783110025
if( ALWAYS(pSrcList!=0) ){
109784110026
SrcItem *pItem = pSrcList->a;
109785110027
for(i=0; i<pSrcList->nSrc; i++, pItem++){
@@ -109793,12 +110035,14 @@
109793110035
** is not an entry there already.
109794110036
*/
109795110037
int k;
109796110038
pCol = pAggInfo->aCol;
109797110039
for(k=0; k<pAggInfo->nColumn; k++, pCol++){
109798
- if( pCol->iTable==pExpr->iTable &&
109799
- pCol->iColumn==pExpr->iColumn ){
110040
+ if( pCol->iTable==pExpr->iTable
110041
+ && pCol->iColumn==pExpr->iColumn
110042
+ && pExpr->op!=TK_IF_NULL_ROW
110043
+ ){
109800110044
break;
109801110045
}
109802110046
}
109803110047
if( (k>=pAggInfo->nColumn)
109804110048
&& (k = addAggInfoColumn(pParse->db, pAggInfo))>=0
@@ -109809,19 +110053,21 @@
109809110053
pCol->iTable = pExpr->iTable;
109810110054
pCol->iColumn = pExpr->iColumn;
109811110055
pCol->iMem = ++pParse->nMem;
109812110056
pCol->iSorterColumn = -1;
109813110057
pCol->pCExpr = pExpr;
109814
- if( pAggInfo->pGroupBy ){
110058
+ if( pAggInfo->pGroupBy && pExpr->op!=TK_IF_NULL_ROW ){
109815110059
int j, n;
109816110060
ExprList *pGB = pAggInfo->pGroupBy;
109817110061
struct ExprList_item *pTerm = pGB->a;
109818110062
n = pGB->nExpr;
109819110063
for(j=0; j<n; j++, pTerm++){
109820110064
Expr *pE = pTerm->pExpr;
109821
- if( pE->op==TK_COLUMN && pE->iTable==pExpr->iTable &&
109822
- pE->iColumn==pExpr->iColumn ){
110065
+ if( pE->op==TK_COLUMN
110066
+ && pE->iTable==pExpr->iTable
110067
+ && pE->iColumn==pExpr->iColumn
110068
+ ){
109823110069
pCol->iSorterColumn = j;
109824110070
break;
109825110071
}
109826110072
}
109827110073
}
@@ -109834,11 +110080,13 @@
109834110080
** Convert the pExpr to be a TK_AGG_COLUMN referring to that
109835110081
** pAggInfo->aCol[] entry.
109836110082
*/
109837110083
ExprSetVVAProperty(pExpr, EP_NoReduce);
109838110084
pExpr->pAggInfo = pAggInfo;
109839
- pExpr->op = TK_AGG_COLUMN;
110085
+ if( pExpr->op==TK_COLUMN ){
110086
+ pExpr->op = TK_AGG_COLUMN;
110087
+ }
109840110088
pExpr->iAgg = (i16)k;
109841110089
break;
109842110090
} /* endif pExpr->iTable==pItem->iCursor */
109843110091
} /* end loop over pSrcList */
109844110092
}
@@ -115256,10 +115504,11 @@
115256115504
** no VDBE code was generated.
115257115505
*/
115258115506
SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){
115259115507
sqlite3 *db;
115260115508
Vdbe *v;
115509
+ int iDb, i;
115261115510
115262115511
assert( pParse->pToplevel==0 );
115263115512
db = pParse->db;
115264115513
assert( db->pParse==pParse );
115265115514
if( pParse->nested ) return;
@@ -115285,11 +115534,10 @@
115285115534
|| sqlite3VdbeAssertMayAbort(v, pParse->mayAbort));
115286115535
if( v ){
115287115536
if( pParse->bReturning ){
115288115537
Returning *pReturning = pParse->u1.pReturning;
115289115538
int addrRewind;
115290
- int i;
115291115539
int reg;
115292115540
115293115541
if( pReturning->nRetCol ){
115294115542
sqlite3VdbeAddOp0(v, OP_FkCheck);
115295115543
addrRewind =
@@ -115322,80 +115570,73 @@
115322115570
** (Bit 0 is for main, bit 1 is for temp, and so forth.) Bits are
115323115571
** set for each database that is used. Generate code to start a
115324115572
** transaction on each used database and to verify the schema cookie
115325115573
** on each used database.
115326115574
*/
115327
- if( db->mallocFailed==0
115328
- && (DbMaskNonZero(pParse->cookieMask) || pParse->pConstExpr)
115329
- ){
115330
- int iDb, i;
115331
- assert( sqlite3VdbeGetOp(v, 0)->opcode==OP_Init );
115332
- sqlite3VdbeJumpHere(v, 0);
115333
- assert( db->nDb>0 );
115334
- iDb = 0;
115335
- do{
115336
- Schema *pSchema;
115337
- if( DbMaskTest(pParse->cookieMask, iDb)==0 ) continue;
115338
- sqlite3VdbeUsesBtree(v, iDb);
115339
- pSchema = db->aDb[iDb].pSchema;
115340
- sqlite3VdbeAddOp4Int(v,
115341
- OP_Transaction, /* Opcode */
115342
- iDb, /* P1 */
115343
- DbMaskTest(pParse->writeMask,iDb), /* P2 */
115344
- pSchema->schema_cookie, /* P3 */
115345
- pSchema->iGeneration /* P4 */
115346
- );
115347
- if( db->init.busy==0 ) sqlite3VdbeChangeP5(v, 1);
115348
- VdbeComment((v,
115349
- "usesStmtJournal=%d", pParse->mayAbort && pParse->isMultiWrite));
115350
- }while( ++iDb<db->nDb );
115575
+ assert( pParse->nErr>0 || sqlite3VdbeGetOp(v, 0)->opcode==OP_Init );
115576
+ sqlite3VdbeJumpHere(v, 0);
115577
+ assert( db->nDb>0 );
115578
+ iDb = 0;
115579
+ do{
115580
+ Schema *pSchema;
115581
+ if( DbMaskTest(pParse->cookieMask, iDb)==0 ) continue;
115582
+ sqlite3VdbeUsesBtree(v, iDb);
115583
+ pSchema = db->aDb[iDb].pSchema;
115584
+ sqlite3VdbeAddOp4Int(v,
115585
+ OP_Transaction, /* Opcode */
115586
+ iDb, /* P1 */
115587
+ DbMaskTest(pParse->writeMask,iDb), /* P2 */
115588
+ pSchema->schema_cookie, /* P3 */
115589
+ pSchema->iGeneration /* P4 */
115590
+ );
115591
+ if( db->init.busy==0 ) sqlite3VdbeChangeP5(v, 1);
115592
+ VdbeComment((v,
115593
+ "usesStmtJournal=%d", pParse->mayAbort && pParse->isMultiWrite));
115594
+ }while( ++iDb<db->nDb );
115351115595
#ifndef SQLITE_OMIT_VIRTUALTABLE
115352
- for(i=0; i<pParse->nVtabLock; i++){
115353
- char *vtab = (char *)sqlite3GetVTable(db, pParse->apVtabLock[i]);
115354
- sqlite3VdbeAddOp4(v, OP_VBegin, 0, 0, 0, vtab, P4_VTAB);
115355
- }
115356
- pParse->nVtabLock = 0;
115596
+ for(i=0; i<pParse->nVtabLock; i++){
115597
+ char *vtab = (char *)sqlite3GetVTable(db, pParse->apVtabLock[i]);
115598
+ sqlite3VdbeAddOp4(v, OP_VBegin, 0, 0, 0, vtab, P4_VTAB);
115599
+ }
115600
+ pParse->nVtabLock = 0;
115357115601
#endif
115358115602
115359
- /* Once all the cookies have been verified and transactions opened,
115360
- ** obtain the required table-locks. This is a no-op unless the
115361
- ** shared-cache feature is enabled.
115362
- */
115363
- codeTableLocks(pParse);
115364
-
115365
- /* Initialize any AUTOINCREMENT data structures required.
115366
- */
115367
- sqlite3AutoincrementBegin(pParse);
115368
-
115369
- /* Code constant expressions that where factored out of inner loops.
115370
- **
115371
- ** The pConstExpr list might also contain expressions that we simply
115372
- ** want to keep around until the Parse object is deleted. Such
115373
- ** expressions have iConstExprReg==0. Do not generate code for
115374
- ** those expressions, of course.
115375
- */
115376
- if( pParse->pConstExpr ){
115377
- ExprList *pEL = pParse->pConstExpr;
115378
- pParse->okConstFactor = 0;
115379
- for(i=0; i<pEL->nExpr; i++){
115380
- int iReg = pEL->a[i].u.iConstExprReg;
115381
- if( iReg>0 ){
115382
- sqlite3ExprCode(pParse, pEL->a[i].pExpr, iReg);
115383
- }
115384
- }
115385
- }
115386
-
115387
- if( pParse->bReturning ){
115388
- Returning *pRet = pParse->u1.pReturning;
115389
- if( pRet->nRetCol ){
115390
- sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pRet->iRetCur, pRet->nRetCol);
115391
- }
115392
- }
115393
-
115394
- /* Finally, jump back to the beginning of the executable code. */
115395
- sqlite3VdbeGoto(v, 1);
115396
- }
115603
+ /* Once all the cookies have been verified and transactions opened,
115604
+ ** obtain the required table-locks. This is a no-op unless the
115605
+ ** shared-cache feature is enabled.
115606
+ */
115607
+ codeTableLocks(pParse);
115608
+
115609
+ /* Initialize any AUTOINCREMENT data structures required.
115610
+ */
115611
+ sqlite3AutoincrementBegin(pParse);
115612
+
115613
+ /* Code constant expressions that where factored out of inner loops.
115614
+ **
115615
+ ** The pConstExpr list might also contain expressions that we simply
115616
+ ** want to keep around until the Parse object is deleted. Such
115617
+ ** expressions have iConstExprReg==0. Do not generate code for
115618
+ ** those expressions, of course.
115619
+ */
115620
+ if( pParse->pConstExpr ){
115621
+ ExprList *pEL = pParse->pConstExpr;
115622
+ pParse->okConstFactor = 0;
115623
+ for(i=0; i<pEL->nExpr; i++){
115624
+ int iReg = pEL->a[i].u.iConstExprReg;
115625
+ sqlite3ExprCode(pParse, pEL->a[i].pExpr, iReg);
115626
+ }
115627
+ }
115628
+
115629
+ if( pParse->bReturning ){
115630
+ Returning *pRet = pParse->u1.pReturning;
115631
+ if( pRet->nRetCol ){
115632
+ sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pRet->iRetCur, pRet->nRetCol);
115633
+ }
115634
+ }
115635
+
115636
+ /* Finally, jump back to the beginning of the executable code. */
115637
+ sqlite3VdbeGoto(v, 1);
115397115638
}
115398115639
115399115640
/* Get the VDBE program ready for execution
115400115641
*/
115401115642
assert( v!=0 || pParse->nErr );
@@ -115898,20 +116139,21 @@
115898116139
*/
115899116140
SQLITE_PRIVATE void sqlite3DeleteColumnNames(sqlite3 *db, Table *pTable){
115900116141
int i;
115901116142
Column *pCol;
115902116143
assert( pTable!=0 );
116144
+ assert( db!=0 );
115903116145
if( (pCol = pTable->aCol)!=0 ){
115904116146
for(i=0; i<pTable->nCol; i++, pCol++){
115905116147
assert( pCol->zCnName==0 || pCol->hName==sqlite3StrIHash(pCol->zCnName) );
115906116148
sqlite3DbFree(db, pCol->zCnName);
115907116149
}
115908
- sqlite3DbFree(db, pTable->aCol);
116150
+ sqlite3DbNNFreeNN(db, pTable->aCol);
115909116151
if( IsOrdinaryTable(pTable) ){
115910116152
sqlite3ExprListDelete(db, pTable->u.tab.pDfltList);
115911116153
}
115912
- if( db==0 || db->pnBytesFreed==0 ){
116154
+ if( db->pnBytesFreed==0 ){
115913116155
pTable->aCol = 0;
115914116156
pTable->nCol = 0;
115915116157
if( IsOrdinaryTable(pTable) ){
115916116158
pTable->u.tab.pDfltList = 0;
115917116159
}
@@ -115944,21 +116186,22 @@
115944116186
**
115945116187
** If malloc has already failed, it may be that it failed while allocating
115946116188
** a Table object that was going to be marked ephemeral. So do not check
115947116189
** that no lookaside memory is used in this case either. */
115948116190
int nLookaside = 0;
115949
- if( db && !db->mallocFailed && (pTable->tabFlags & TF_Ephemeral)==0 ){
116191
+ assert( db!=0 );
116192
+ if( !db->mallocFailed && (pTable->tabFlags & TF_Ephemeral)==0 ){
115950116193
nLookaside = sqlite3LookasideUsed(db, 0);
115951116194
}
115952116195
#endif
115953116196
115954116197
/* Delete all indices associated with this table. */
115955116198
for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){
115956116199
pNext = pIndex->pNext;
115957116200
assert( pIndex->pSchema==pTable->pSchema
115958116201
|| (IsVirtual(pTable) && pIndex->idxType!=SQLITE_IDXTYPE_APPDEF) );
115959
- if( (db==0 || db->pnBytesFreed==0) && !IsVirtual(pTable) ){
116202
+ if( db->pnBytesFreed==0 && !IsVirtual(pTable) ){
115960116203
char *zName = pIndex->zName;
115961116204
TESTONLY ( Index *pOld = ) sqlite3HashInsert(
115962116205
&pIndex->pSchema->idxHash, zName, 0
115963116206
);
115964116207
assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );
@@ -115991,12 +116234,13 @@
115991116234
/* Verify that no lookaside memory was used by schema tables */
115992116235
assert( nLookaside==0 || nLookaside==sqlite3LookasideUsed(db,0) );
115993116236
}
115994116237
SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
115995116238
/* Do not delete the table until the reference count reaches zero. */
116239
+ assert( db!=0 );
115996116240
if( !pTable ) return;
115997
- if( ((!db || db->pnBytesFreed==0) && (--pTable->nTabRef)>0) ) return;
116241
+ if( db->pnBytesFreed==0 && (--pTable->nTabRef)>0 ) return;
115998116242
deleteTable(db, pTable);
115999116243
}
116000116244
116001116245
116002116246
/*
@@ -118165,11 +118409,11 @@
118165118409
/*
118166118410
** The Table structure pTable is really a VIEW. Fill in the names of
118167118411
** the columns of the view in the pTable structure. Return the number
118168118412
** of errors. If an error is seen leave an error message in pParse->zErrMsg.
118169118413
*/
118170