From 5f96766b4a17c8d3be41c9657ebd528817edbb1c Mon Sep 17 00:00:00 2001 From: pshem Date: Mon, 4 Mar 2019 14:10:49 +0000 Subject: [PATCH 1/8] Update sqlite to the newest upstream releases Fixes a bunch of CVEs and is a prerequisite for using with python --- sqlite/GET | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlite/GET b/sqlite/GET index ce456c6b1..655b394f9 100755 --- a/sqlite/GET +++ b/sqlite/GET @@ -1,7 +1,7 @@ #!/bin/sh -YEAR=2013 -VERSION=3080200 +YEAR=2019 +VERSION=3270200 mkdir upstream cd upstream From 95d59207cf70b000e9ff09ce06e60ea8aee9faaa Mon Sep 17 00:00:00 2001 From: pshem Date: Mon, 4 Mar 2019 14:12:54 +0000 Subject: [PATCH 2/8] Rename sqlite to it's current name in Ubuntu 18.04 --- sqlite/GET | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite/GET b/sqlite/GET index 655b394f9..1173295b2 100755 --- a/sqlite/GET +++ b/sqlite/GET @@ -9,4 +9,4 @@ wget -c http://www.sqlite.org/$YEAR/sqlite-amalgamation-$VERSION.zip unzip -x sqlite-amalgamation-$VERSION.zip cd - -cc -O2 -fPIC -Wall -shared -DHAVE_MREMAP=0 -o sqlite.so upstream/sqlite-amalgamation-$VERSION/*.c +cc -O2 -fPIC -Wall -shared -DHAVE_MREMAP=0 -o libsqlite3.so.0 upstream/sqlite-amalgamation-$VERSION/*.c From bf8ae1e7b1e7a88631dcfb834ad8c00b05d688e2 Mon Sep 17 00:00:00 2001 From: pshem Date: Mon, 4 Mar 2019 14:14:26 +0000 Subject: [PATCH 3/8] Update Makefile to clear the new object --- sqlite/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite/Makefile b/sqlite/Makefile index 11b1ff957..896cd031e 100644 --- a/sqlite/Makefile +++ b/sqlite/Makefile @@ -6,4 +6,4 @@ upstream: .PHONY: clean clean: - rm -rf upstream *.so + rm -rf upstream *.so *.so.0 From b32892f93c5f844bc718ffcf8bb9db500cba5caa Mon Sep 17 00:00:00 2001 From: pshem Date: Mon, 4 Mar 2019 14:15:30 +0000 Subject: [PATCH 4/8] Update module.py --- sqlite/module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite/module.py b/sqlite/module.py index 035ebd3aa..0a35882e5 100644 --- a/sqlite/module.py +++ b/sqlite/module.py @@ -1,3 +1,3 @@ from osv.modules import api -default = api.run("/tools/sqlite.so test.db") +default = api.run("/usr/lib/libsqlite3.so.0 test.db") From 6cac2e6096623a7065a87e16cea46e30fdb7d992 Mon Sep 17 00:00:00 2001 From: pshem Date: Mon, 4 Mar 2019 14:16:14 +0000 Subject: [PATCH 5/8] Update usr.manifest --- sqlite/usr.manifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite/usr.manifest b/sqlite/usr.manifest index ada10b3c5..2329677f1 100644 --- a/sqlite/usr.manifest +++ b/sqlite/usr.manifest @@ -1 +1 @@ -/tools/sqlite.so: ${MODULE_DIR}/sqlite.so +/usr/lib/libsqlite3.so.0: ${MODULE_DIR}/libsqlite3.so.0 From fad766d9c8742dde395073b340b3774e727fdbf6 Mon Sep 17 00:00:00 2001 From: pshem Date: Mon, 4 Mar 2019 14:21:42 +0000 Subject: [PATCH 6/8] Fix python3 crashing on sqlite import by using sqlite compiled without `MREMAP`(see https://github.com/cloudius-systems/osv/issues/184 and #62) --- python3x/module.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python3x/module.py b/python3x/module.py index 2cafb787d..0c6fc1b73 100644 --- a/python3x/module.py +++ b/python3x/module.py @@ -1,4 +1,9 @@ from osv.modules import api +#For a proper interactive python terminal api.require('unknown-term') + +#For sqlite3 and help() +api.require('sqlite') + default = api.run(cmdline="--env=TERM=unknown /python3") From b9497c5291499208dfb50950350901f82db71092 Mon Sep 17 00:00:00 2001 From: pshem Date: Mon, 4 Mar 2019 14:39:27 +0000 Subject: [PATCH 7/8] Replace sqlite with a non-MREMAP version --- python3x/GET | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python3x/GET b/python3x/GET index cde27cb53..0157cbf93 100755 --- a/python3x/GET +++ b/python3x/GET @@ -55,6 +55,9 @@ then echo "ERROR some libraries required by python might be missing" exit 1 fi + +#replace sqlite with a non-MREMAP version +rsync -a $BASEDIR/../sqlite/libsqlite3.so.0 $ROOTFS/usr/lib/libsqlite3.so.0 } main From 79abf2af26184c1bd9e3de3fb7df5ed47e637247 Mon Sep 17 00:00:00 2001 From: pshem Date: Wed, 6 Mar 2019 00:59:32 +0000 Subject: [PATCH 8/8] Use cp instead of rsync when there are no benefits to rsync --- python3x/GET | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python3x/GET b/python3x/GET index 0157cbf93..440eefb15 100755 --- a/python3x/GET +++ b/python3x/GET @@ -57,7 +57,7 @@ then fi #replace sqlite with a non-MREMAP version -rsync -a $BASEDIR/../sqlite/libsqlite3.so.0 $ROOTFS/usr/lib/libsqlite3.so.0 +cp $BASEDIR/../sqlite/libsqlite3.so.0 $ROOTFS/usr/lib/libsqlite3.so.0 } main