[osv-dev] [PATCH] libc: add __wcsncpy_chk() to support python 3.10

2022-11-07 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk 
---
 Makefile|  1 +
 libc/string/__wcsncpy_chk.c | 15 +++
 2 files changed, 16 insertions(+)
 create mode 100644 libc/string/__wcsncpy_chk.c

diff --git a/Makefile b/Makefile
index fcc55e29..b8d5d924 100644
--- a/Makefile
+++ b/Makefile
@@ -1796,6 +1796,7 @@ musl += string/wcsncasecmp_l.o
 musl += string/wcsncat.o
 musl += string/wcsncmp.o
 musl += string/wcsncpy.o
+libc += string/__wcsncpy_chk.o
 musl += string/wcsnlen.o
 musl += string/wcspbrk.o
 musl += string/wcsrchr.o
diff --git a/libc/string/__wcsncpy_chk.c b/libc/string/__wcsncpy_chk.c
new file mode 100644
index ..ff3da7f5
--- /dev/null
+++ b/libc/string/__wcsncpy_chk.c
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 2022 Waldemar Kozaczuk
+ *
+ * This work is open source software, licensed under the terms of the
+ * BSD license as described in the LICENSE file in the top-level directory.
+ */
+
+#include 
+#include 
+
+wchar_t *__wcsncpy_chk(wchar_t * dest, const wchar_t * src, size_t n, size_t 
destlen)
+{
+assert(wcslen(src) + sizeof(L'\0') <= destlen);
+return wcsncpy(dest, src, n);
+}
-- 
2.35.1

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/20221107152837.142732-1-jwkozaczuk%40gmail.com.


[osv-dev] [COMMIT osv-apps master] add simple flask example

2022-11-07 Thread Commit Bot
From: Waldemar Kozaczuk 
Committer: Waldemar Kozaczuk 
Branch: master

add simple flask example

Signed-off-by: Waldemar Kozaczuk 

---
diff --git a/flask-example/GET b/flask-example/GET
--- a/flask-example/GET
+++ b/flask-example/GET
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+set -e
+
+MODULE_DIR=$(readlink -f .)
+
+rm -rf upstream
+
+mkdir upstream
+pushd upstream
+git clone --depth 1 https://github.com/auth0-blog/flask-restful-apis.git
+
+cd flask-restful-apis
+git apply ../../app.patch
+
+mkdir site-packages
+pip3 install --no-cache-dir --target ./site-packages flask marshmallow
+
+popd
+
+PYTHON_VERSION=$(python3 -c 'import sys; print("%s.%s" % 
(sys.version_info.major,sys.version_info.minor))')
+
+echo "/lib/python${PYTHON_VERSION}/site-packages/**: 
${MODULE_DIR}/upstream/flask-restful-apis/site-packages/**" > usr.manifest
+echo "/lib/python${PYTHON_VERSION}/dist-packages: ->site-packages" >> 
usr.manifest
+echo '/cashman/**: ${MODULE_DIR}/upstream/flask-restful-apis/cashman/**' >> 
usr.manifest
diff --git a/flask-example/Makefile b/flask-example/Makefile
--- a/flask-example/Makefile
+++ b/flask-example/Makefile
@@ -0,0 +1,8 @@
+.PHONY: module
+module: upstream/flask-restful-apis/cashman
+
+upstream/flask-restful-apis/cashman:
+   ./GET
+
+clean:
+   rm -rf ./upstream usr.manifest
diff --git a/flask-example/app.patch b/flask-example/app.patch
--- a/flask-example/app.patch
+++ b/flask-example/app.patch
@@ -0,0 +1,10 @@
+diff --git a/cashman/index.py b/cashman/index.py
+index 7868b9f..6e9b1a8 100644
+--- a/cashman/index.py
 b/cashman/index.py
+@@ -47,4 +47,4 @@ def add_expense():
+ 
+ 
+ if __name__ == "__main__":
+-app.run()
++app.run(host="0.0.0.0")
diff --git a/flask-example/module.py b/flask-example/module.py
--- a/flask-example/module.py
+++ b/flask-example/module.py
@@ -0,0 +1,6 @@
+from osv.modules import api
+
+#For a proper interactive python terminal
+api.require('unknown-term')
+
+default = api.run(cmdline="--env=TERM=unknown --env=PYTHONPATH=/ 
--env=PYTHONHOME=/ --env=PYTHONPLATLIBDIR=lib /python /cashman/index.py")

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/ee31ea05ece30fcf%40google.com.


[osv-dev] [COMMIT osv-apps master] python-from-host: replace default with the repl profile

2022-11-07 Thread Commit Bot
From: Waldemar Kozaczuk 
Committer: Waldemar Kozaczuk 
Branch: master

python-from-host: replace default with the repl profile

Signed-off-by: Waldemar Kozaczuk 

---
diff --git a/python-from-host/module.py b/python-from-host/module.py
--- a/python-from-host/module.py
+++ b/python-from-host/module.py
@@ -2,5 +2,4 @@
 
 #For a proper interactive python terminal
 api.require('unknown-term')
-
-default = api.run(cmdline="--env=TERM=unknown /python")
+repl = api.run(cmdline="--env=TERM=unknown --env=PYTHONPATH=/ 
--env=PYTHONHOME=/ --env=PYTHONPLATLIBDIR=lib /python")

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/da865305ece30f0e%40google.com.