Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-fuse for openSUSE:Factory checked in at 2022-01-23 19:13:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-fuse (Old) and /work/SRC/openSUSE:Factory/.python-fuse.new.1938 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-fuse" Sun Jan 23 19:13:21 2022 rev:9 rq:948239 version:1.0.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-fuse/python-fuse.changes 2020-12-10 15:59:11.546914017 +0100 +++ /work/SRC/openSUSE:Factory/.python-fuse.new.1938/python-fuse.changes 2022-01-23 19:13:23.743805659 +0100 @@ -1,0 +2,11 @@ +Sun Jan 23 16:21:16 UTC 2022 - Dirk M??ller <[email protected]> + +- update to 1.0.4: + * Improve path handling for Python >= 3.6 + * fix race in xmp.py + * fix surrogateescape handling in fsyncdir/readdir/write + * unbreak xmp.py for python2 + * fix object leak in open_func() + * fix temporary objects leak + +------------------------------------------------------------------- Old: ---- python-fuse-1.0.0.tar.gz New: ---- python-fuse-1.0.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-fuse.spec ++++++ --- /var/tmp/diff_new_pack.qd0rZ9/_old 2022-01-23 19:13:24.155802869 +0100 +++ /var/tmp/diff_new_pack.qd0rZ9/_new 2022-01-23 19:13:24.159802842 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-fuse # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-fuse -Version: 1.0.0 +Version: 1.0.4 Release: 0 Summary: Python bindings for FUSE License: LGPL-2.1-only ++++++ python-fuse-1.0.0.tar.gz -> python-fuse-1.0.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-fuse-1.0.0/.gitignore new/python-fuse-1.0.4/.gitignore --- old/python-fuse-1.0.0/.gitignore 2019-07-19 06:37:09.000000000 +0200 +++ new/python-fuse-1.0.4/.gitignore 2021-05-02 08:20:59.000000000 +0200 @@ -4,3 +4,4 @@ __pycache__ *.pyc *.so +wheelhouse diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-fuse-1.0.0/Makefile new/python-fuse-1.0.4/Makefile --- old/python-fuse-1.0.0/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ new/python-fuse-1.0.4/Makefile 2021-05-02 08:20:59.000000000 +0200 @@ -0,0 +1,11 @@ +all: source manylinux + +source: + python3 setup.py sdist + +manylinux: + docker run --rm -it -e PLAT=manylinux2010_x86_64 -v $(PWD):/io:Z -w /io quay.io/pypa/manylinux2010_x86_64 bash -c "yum install -y fuse-devel && /opt/python/cp39-cp39/bin/python setup.py bdist_wheel && auditwheel repair dist/*.whl" + +clean: + python3 setup.py clean --all + rm -fr build dist fuse_python.egg-info wheelhouse diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-fuse-1.0.0/example/xmp.py new/python-fuse-1.0.4/example/xmp.py --- old/python-fuse-1.0.0/example/xmp.py 2019-07-19 06:37:09.000000000 +0200 +++ new/python-fuse-1.0.4/example/xmp.py 2021-05-02 08:20:59.000000000 +0200 @@ -7,10 +7,13 @@ # See the file COPYING. # +from __future__ import print_function + import os, sys from errno import * from stat import * import fcntl +from threading import Lock # pull in some spaghetti to make this stuff work without fuse-py being installed try: import _find_fuse_parts @@ -166,15 +169,33 @@ self.file = os.fdopen(os.open("." + path, flags, *mode), flag2mode(flags)) self.fd = self.file.fileno() + if hasattr(os, 'pread'): + self.iolock = None + else: + self.iolock = Lock() def read(self, length, offset): - self.file.seek(offset) - return self.file.read(length) + if self.iolock: + self.iolock.acquire() + try: + self.file.seek(offset) + return self.file.read(length) + finally: + self.iolock.release() + else: + return os.pread(self.fd, length, offset) def write(self, buf, offset): - self.file.seek(offset) - self.file.write(buf) - return len(buf) + if self.iolock: + self.iolock.acquire() + try: + self.file.seek(offset) + self.file.write(buf) + return len(buf) + finally: + self.iolock.release() + else: + return os.pwrite(self.fd, buf, offset) def release(self, flags): self.file.close() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-fuse-1.0.0/fuseparts/__init__.py new/python-fuse-1.0.4/fuseparts/__init__.py --- old/python-fuse-1.0.0/fuseparts/__init__.py 2019-07-19 06:37:09.000000000 +0200 +++ new/python-fuse-1.0.4/fuseparts/__init__.py 2021-05-02 08:20:59.000000000 +0200 @@ -1 +1 @@ -__version__ = "1.0.0" +__version__ = "1.0.4" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-fuse-1.0.0/fuseparts/_fusemodule.c new/python-fuse-1.0.4/fuseparts/_fusemodule.c --- old/python-fuse-1.0.0/fuseparts/_fusemodule.c 2019-07-19 06:37:09.000000000 +0200 +++ new/python-fuse-1.0.4/fuseparts/_fusemodule.c 2021-05-02 08:20:59.000000000 +0200 @@ -8,10 +8,10 @@ 2004 Steven James <[email protected]> and Linux Labs International, Inc. http://www.linuxlabs.com - Copyright (C) 2006-2007 Csaba Henk <[email protected]> + Copyright (C) 2006-2007 Csaba Henk <[email protected]> */ -/* +/* * Local Variables: * indent-tabs-mode: t * c-basic-offset: 8 @@ -30,7 +30,7 @@ #include <sys/ioctl.h> #ifndef _UAPI_ASM_GENERIC_IOCTL_H /* Essential IOCTL definitions from Linux /include/uapi/asm-generic/ioctl.h - to fix compilation errors on FreeBSD + to fix compilation errors on FreeBSD Mikhail Zakharov <[email protected]> 2018.10.22 */ #define _IOC_NRBITS 8 @@ -83,11 +83,41 @@ #define PyInt_AsLong PyLong_AsLong #define PyInt_Check PyLong_Check #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#if PY_MINOR_VERSION >= 6 + #define FIX_PATH_DECODING + + PyObject* Path_AsDecodedUnicode(void* path) { + if (path) { + return PyUnicode_DecodeFSDefault(path); + } + PyErr_SetString(PyExc_ValueError, "non-decodable filename"); + return NULL; + } + +#else #define PyString_AsString PyUnicode_AsUTF8 +#endif #define PyString_Check PyUnicode_Check #define PyString_Size PyUnicode_GET_SIZE #endif +#ifdef FIX_PATH_DECODING + // use appropriate utf-8 conversion + #define PATH_AS_STR_BEGIN(py_obj, str) \ + PyObject *py_bytes_tmp = PyUnicode_EncodeFSDefault(py_obj); \ + str = PyBytes_AsString(py_bytes_tmp); +#else + #define PATH_AS_STR_BEGIN(py_obj, str) \ + str = PyString_AsString(py_obj); +#endif + +#ifdef FIX_PATH_DECODING + #define PATH_AS_STR_END \ + Py_DECREF(py_bytes_tmp); +#else + #define PATH_AS_STR_END +#endif + static PyObject *getattr_cb=NULL, *readlink_cb=NULL, *readdir_cb=NULL, *mknod_cb=NULL, *mkdir_cb=NULL, *unlink_cb=NULL, *rmdir_cb=NULL, *symlink_cb=NULL, *rename_cb=NULL, *link_cb=NULL, *chmod_cb=NULL, @@ -131,7 +161,7 @@ PyEval_ReleaseLock(); \ } #endif - + #else #define PYLOCK() #define PYUNLOCK() @@ -290,8 +320,11 @@ PyObject *pytmp; unsigned long long ctmp; +#ifdef FIX_PATH_DECODING + PROLOGUE( PyObject_CallFunction(getattr_cb, "O&", &Path_AsDecodedUnicode, path) ) +#else PROLOGUE( PyObject_CallFunction(getattr_cb, "s", path) ) - +#endif FETCH_STAT_DATA(); ret = 0; @@ -306,7 +339,11 @@ PyObject *pytmp; unsigned long long ctmp; +#ifdef FIX_PATH_DECODING + PROLOGUE( PYO_CALLWITHFI(fi, fgetattr_cb, O&, &Path_AsDecodedUnicode, path) ) +#else PROLOGUE( PYO_CALLWITHFI(fi, fgetattr_cb, s, path) ) +#endif FETCH_STAT_DATA(); @@ -325,14 +362,20 @@ { char *s; +#ifdef FIX_PATH_DECODING + PROLOGUE( PyObject_CallFunction(readlink_cb, "O&", &Path_AsDecodedUnicode, path) ) +#else PROLOGUE( PyObject_CallFunction(readlink_cb, "s", path) ) +#endif if(!PyString_Check(v)) { ret = -EINVAL; goto OUT_DECREF; } - s = PyString_AsString(v); + + PATH_AS_STR_BEGIN(v, s); strncpy(link, s, size); + PATH_AS_STR_END; link[size-1] = '\0'; ret = 0; @@ -343,7 +386,11 @@ static int opendir_func(const char *path, struct fuse_file_info *fi) { +#ifdef FIX_PATH_DECODING + PROLOGUE( PyObject_CallFunction(opendir_cb, "O&", &Path_AsDecodedUnicode, path) ) +#else PROLOGUE( PyObject_CallFunction(opendir_cb, "s", path) ) +#endif fi->fh = (uintptr_t) v; @@ -358,9 +405,15 @@ { PROLOGUE( fi_to_py(fi) ? +#ifdef FIX_PATH_DECODING + PyObject_CallFunction(releasedir_cb, "O&N", &Path_AsDecodedUnicode, path, + fi_to_py(fi)) : + PyObject_CallFunction(releasedir_cb, "O&", &Path_AsDecodedUnicode, path) +#else PyObject_CallFunction(releasedir_cb, "sN", path, fi_to_py(fi)) : PyObject_CallFunction(releasedir_cb, "s", path) +#endif ) EPILOGUE @@ -369,7 +422,11 @@ static int fsyncdir_func(const char *path, int datasync, struct fuse_file_info *fi) { +#ifdef FIX_PATH_DECODING + PROLOGUE( PYO_CALLWITHFI(fi, fsyncdir_cb, &Oi, &Path_AsDecodedUnicode, path, datasync) ) +#else PROLOGUE( PYO_CALLWITHFI(fi, fsyncdir_cb, si, path, datasync) ) +#endif EPILOGUE } @@ -391,21 +448,23 @@ fetchattr_nam(&st, st_mode, "type"); fetchattr(&offs, offset); - if (!(pytmp = PyObject_GetAttrString(v, "name"))) - goto OUT_DECREF; + if (!(pytmp = PyObject_GetAttrString(v, "name"))) + goto OUT_DECREF; if (!PyString_Check(pytmp)) { Py_DECREF(pytmp); - goto OUT_DECREF; - } + goto OUT_DECREF; + } + char *s; + PATH_AS_STR_BEGIN(pytmp, s); #if FUSE_VERSION >= 23 - ret = df(buf, PyString_AsString(pytmp), &st, offs.offset); + ret = df(buf, s, &st, offs.offset); #elif FUSE_VERSION >= 21 - ret = df(buf, PyString_AsString(pytmp), (st.st_mode & 0170000) >> 12, - st.st_ino); + ret = df(buf, s, (st.st_mode & 0170000) >> 12, st.st_ino); #else - ret = df(buf, PyString_AsString(pytmp), (st.st_mode & 0170000) >> 12); + ret = df(buf, s, (st.st_mode & 0170000) >> 12); #endif + PATH_AS_STR_END; Py_DECREF(pytmp); OUT_DECREF: @@ -421,15 +480,22 @@ { PyObject *iter, *w; +#ifdef FIX_PATH_DECODING + PROLOGUE( PYO_CALLWITHFI(fi, readdir_cb, O&K, &Path_AsDecodedUnicode, path, off) ) +#else PROLOGUE( PYO_CALLWITHFI(fi, readdir_cb, sK, path, off) ) +#endif #else static int readdir_func(const char *path, fuse_dirh_t buf, fuse_dirfil_t df) { PyObject *iter, *w; - +#ifdef FIX_PATH_DECODING + PROLOGUE( PyObject_CallFunction(readdir_cb, "O&K", &Path_AsDecodedUnicode, path) ) +#else PROLOGUE( PyObject_CallFunction(readdir_cb, "sK", path) ) #endif +#endif iter = PyObject_GetIter(v); if(!iter) { @@ -455,70 +521,110 @@ static int mknod_func(const char *path, mode_t m, dev_t d) { +#ifdef FIX_PATH_DECODING + PROLOGUE( PyObject_CallFunction(mknod_cb, "O&ii", &Path_AsDecodedUnicode, path, m, d) ) +#else PROLOGUE( PyObject_CallFunction(mknod_cb, "sii", path, m, d) ) +#endif EPILOGUE } static int mkdir_func(const char *path, mode_t m) { +#ifdef FIX_PATH_DECODING + PROLOGUE( PyObject_CallFunction(mkdir_cb, "O&i", &Path_AsDecodedUnicode, path, m) ) +#else PROLOGUE( PyObject_CallFunction(mkdir_cb, "si", path, m) ) +#endif EPILOGUE } static int unlink_func(const char *path) { +#ifdef FIX_PATH_DECODING + PROLOGUE( PyObject_CallFunction(unlink_cb, "O&", &Path_AsDecodedUnicode, path) ) +#else PROLOGUE( PyObject_CallFunction(unlink_cb, "s", path) ) +#endif EPILOGUE } static int rmdir_func(const char *path) { +#ifdef FIX_PATH_DECODING + PROLOGUE( PyObject_CallFunction(rmdir_cb, "O&", &Path_AsDecodedUnicode, path) ) +#else PROLOGUE( PyObject_CallFunction(rmdir_cb, "s", path) ) +#endif EPILOGUE } static int symlink_func(const char *path, const char *path1) { +#ifdef FIX_PATH_DECODING + PROLOGUE( PyObject_CallFunction(symlink_cb, "O&O&", &Path_AsDecodedUnicode, path, &Path_AsDecodedUnicode, path1) ) +#else PROLOGUE( PyObject_CallFunction(symlink_cb, "ss", path, path1) ) +#endif EPILOGUE } static int rename_func(const char *path, const char *path1) { +#ifdef FIX_PATH_DECODING + PROLOGUE( PyObject_CallFunction(rename_cb, "O&O&", &Path_AsDecodedUnicode, path, &Path_AsDecodedUnicode, path1) ) +#else PROLOGUE( PyObject_CallFunction(rename_cb, "ss", path, path1) ) +#endif EPILOGUE } static int link_func(const char *path, const char *path1) { +#ifdef FIX_PATH_DECODING + PROLOGUE( PyObject_CallFunction(link_cb, "O&O&", &Path_AsDecodedUnicode, path, &Path_AsDecodedUnicode, path1) ) +#else PROLOGUE( PyObject_CallFunction(link_cb, "ss", path, path1) ) +#endif EPILOGUE } static int -chmod_func(const char *path, mode_t m) +chmod_func(const char *path, mode_t m) { +#ifdef FIX_PATH_DECODING + PROLOGUE( PyObject_CallFunction(chmod_cb, "O&i", &Path_AsDecodedUnicode, path, m) ) +#else PROLOGUE( PyObject_CallFunction(chmod_cb, "si", path, m) ) +#endif EPILOGUE } static int -chown_func(const char *path, uid_t u, gid_t g) +chown_func(const char *path, uid_t u, gid_t g) { +#ifdef FIX_PATH_DECODING + PROLOGUE( PyObject_CallFunction(chown_cb, "O&ii", &Path_AsDecodedUnicode, path, u, g) ) +#else PROLOGUE( PyObject_CallFunction(chown_cb, "sii", path, u, g) ) +#endif EPILOGUE } static int truncate_func(const char *path, off_t length) { +#ifdef FIX_PATH_DECODING + PROLOGUE( PyObject_CallFunction(truncate_cb, "O&K", &Path_AsDecodedUnicode, path, length) ) +#else PROLOGUE( PyObject_CallFunction(truncate_cb, "sK", path, length) ) +#endif EPILOGUE } @@ -526,7 +632,11 @@ static int ftruncate_func(const char *path, off_t length, struct fuse_file_info *fi) { +#ifdef FIX_PATH_DECODING + PROLOGUE( PYO_CALLWITHFI(fi, ftruncate_cb, O&K, &Path_AsDecodedUnicode, path, length) ) +#else PROLOGUE( PYO_CALLWITHFI(fi, ftruncate_cb, sK, path, length) ) +#endif EPILOGUE } #endif @@ -537,7 +647,11 @@ int actime = u ? u->actime : time(NULL); int modtime = u ? u->modtime : actime; PROLOGUE( +#ifdef FIX_PATH_DECODING + PyObject_CallFunction(utime_cb, "O&(ii)", &Path_AsDecodedUnicode, path, actime, modtime) +#else PyObject_CallFunction(utime_cb, "s(ii)", path, actime, modtime) +#endif ) EPILOGUE } @@ -554,8 +668,12 @@ #if PY_VERSION_HEX < 0x02050000 PROLOGUE( PYO_CALLWITHFI(fi, read_cb, siK, path, s, off) ) #else +#ifdef FIX_PATH_DECODING + PROLOGUE( PYO_CALLWITHFI(fi, read_cb, O&nK, &Path_AsDecodedUnicode, path, s, off) ) +#else PROLOGUE( PYO_CALLWITHFI(fi, read_cb, snK, path, s, off) ) #endif +#endif #if PY_MAJOR_VERSION >= 3 @@ -587,7 +705,11 @@ #endif { #if PY_MAJOR_VERSION >= 3 +#ifdef FIX_PATH_DECODING + PROLOGUE( PYO_CALLWITHFI(fi, write_cb, O&y#K, &Path_AsDecodedUnicode, path, buf, t, off) ) +#else PROLOGUE( PYO_CALLWITHFI(fi, write_cb, sy#K, path, buf, t, off) ) +#endif #else PROLOGUE( PYO_CALLWITHFI(fi, write_cb, ss#K, path, buf, t, off) ) #endif @@ -600,7 +722,11 @@ { PyObject *pytmp, *pytmp1; +#ifdef FIX_PATH_DECODING + PROLOGUE( PyObject_CallFunction(open_cb, "O&i", &Path_AsDecodedUnicode, path, fi->flags) ) +#else PROLOGUE( PyObject_CallFunction(open_cb, "si", path, fi->flags) ) +#endif pytmp = PyTuple_GetItem(v, 0); @@ -628,7 +754,7 @@ } ret = 0; - goto OUT; + goto OUT_DECREF; EPILOGUE } @@ -636,7 +762,11 @@ static int open_func(const char *path, int mode) { +#ifdef FIX_PATH_DECODING + PROLOGUE( PyObject_CallFunction(open_cb, "O&i", &Path_AsDecodedUnicode, path, mode) ) +#else PROLOGUE( PyObject_CallFunction(open_cb, "si", path, mode) ) +#endif EPILOGUE } #endif @@ -648,7 +778,11 @@ PyObject *pytmp, *pytmp1; PROLOGUE( +#ifdef FIX_PATH_DECODING + PyObject_CallFunction(create_cb, "O&ii", &Path_AsDecodedUnicode, path, fi->flags, mode) +#else PyObject_CallFunction(create_cb, "sii", path, fi->flags, mode) +#endif ) pytmp = PyTuple_GetItem(v, 0); @@ -686,9 +820,17 @@ { PROLOGUE( fi_to_py(fi) ? +#ifdef FIX_PATH_DECODING + PyObject_CallFunction(release_cb, "O&iN", &Path_AsDecodedUnicode, path, fi->flags, +#else PyObject_CallFunction(release_cb, "siN", path, fi->flags, +#endif fi_to_py(fi)) : +#ifdef FIX_PATH_DECODING + PyObject_CallFunction(release_cb, "O&i", &Path_AsDecodedUnicode, path, fi->flags) +#else PyObject_CallFunction(release_cb, "si", path, fi->flags) +#endif ) #else static int @@ -729,7 +871,7 @@ #endif ret = 0; - + EPILOGUE } @@ -741,7 +883,11 @@ fsync_func(const char *path, int datasync) #endif { +#ifdef FIX_PATH_DECODING + PROLOGUE( PYO_CALLWITHFI(fi, fsync_cb, O&i, &Path_AsDecodedUnicode, path, datasync) ) +#else PROLOGUE( PYO_CALLWITHFI(fi, fsync_cb, si, path, datasync) ) +#endif EPILOGUE } @@ -753,7 +899,11 @@ flush_func(const char *path) #endif { +#ifdef FIX_PATH_DECODING + PROLOGUE( PYO_CALLWITHFI(fi, flush_cb, O&, &Path_AsDecodedUnicode, path) ) +#else PROLOGUE( PYO_CALLWITHFI(fi, flush_cb, s, path) ) +#endif EPILOGUE } @@ -763,8 +913,12 @@ #if PY_VERSION_HEX < 0x02050000 PROLOGUE( PyObject_CallFunction(getxattr_cb, "ssi", path, name, size) ) #else +#ifdef FIX_PATH_DECODING + PROLOGUE( PyObject_CallFunction(getxattr_cb, "O&O&n", &Path_AsDecodedUnicode, path, &Path_AsDecodedUnicode, name, size) ) +#else PROLOGUE( PyObject_CallFunction(getxattr_cb, "ssn", path, name, size) ) #endif +#endif if(PyString_Check(v)) { /* size zero can be passed into these calls to return the current size of @@ -773,7 +927,7 @@ if (size == 0) { ret = PyString_Size(v); goto OUT_DECREF; - } + } /* If the size of the value buffer is too small to hold the result, errno * is set to ERANGE. @@ -783,7 +937,10 @@ goto OUT_DECREF; } - memcpy(value, PyString_AsString(v), PyString_Size(v)); + char *s; + PATH_AS_STR_BEGIN(v, s); + memcpy(value, s, PyString_Size(v)); + PATH_AS_STR_END; ret = PyString_Size(v); } @@ -798,8 +955,12 @@ #if PY_VERSION_HEX < 0x02050000 PROLOGUE( PyObject_CallFunction(listxattr_cb, "si", path, size) ) #else +#ifdef FIX_PATH_DECODING + PROLOGUE( PyObject_CallFunction(listxattr_cb, "O&n", &Path_AsDecodedUnicode, path, size) ) +#else PROLOGUE( PyObject_CallFunction(listxattr_cb, "sn", path, size) ) #endif +#endif iter = PyObject_GetIter(v); if(!iter) { PyErr_Print(); @@ -826,7 +987,10 @@ break; } - strncpy(lx, PyString_AsString(w), ilen + 1); + char *s; + PATH_AS_STR_BEGIN(w, s); + strncpy(lx, s, ilen + 1); + PATH_AS_STR_END; lx += ilen + 1; Py_DECREF(w); @@ -846,7 +1010,11 @@ size_t size, int flags) { PROLOGUE( +#ifdef FIX_PATH_DECODING + PyObject_CallFunction(setxattr_cb, "O&O&s#i", &Path_AsDecodedUnicode, path, &Path_AsDecodedUnicode, name, value, size, +#else PyObject_CallFunction(setxattr_cb, "sss#i", path, name, value, size, +#endif flags) ) EPILOGUE @@ -855,7 +1023,11 @@ static int removexattr_func(const char *path, const char *name) { +#ifdef FIX_PATH_DECODING + PROLOGUE( PyObject_CallFunction(removexattr_cb, "O&O&", &Path_AsDecodedUnicode, path, &Path_AsDecodedUnicode, name) ) +#else PROLOGUE( PyObject_CallFunction(removexattr_cb, "ss", path, name) ) +#endif EPILOGUE } @@ -863,7 +1035,11 @@ static int access_func(const char *path, int mask) { +#ifdef FIX_PATH_DECODING + PROLOGUE( PyObject_CallFunction(access_cb, "O&i", &Path_AsDecodedUnicode, path, mask) ) +#else PROLOGUE( PyObject_CallFunction(access_cb, "si", path, mask) ) +#endif EPILOGUE } #endif @@ -906,8 +1082,13 @@ pyargs = fi_to_py(fi) ? +#ifdef FIX_PATH_DECODING + Py_BuildValue("(O&iKO)", &Path_AsDecodedUnicode, path, cmd, fi->lock_owner, fi_to_py(fi)) : + Py_BuildValue("(O&iK)", &Path_AsDecodedUnicode, path, cmd, fi->lock_owner); +#else Py_BuildValue("(siKO)", path, cmd, fi->lock_owner, fi_to_py(fi)) : - Py_BuildValue("(siK)", path, cmd, fi->lock_owner); + Py_BuildValue("(siK)", path, cmd, fi->lock_owner); +#endif if (! pyargs) goto out; @@ -951,10 +1132,15 @@ utimens_func(const char *path, const struct timespec ts[2]) { PROLOGUE( - PyObject_CallFunction(utimens_cb, "siiii", path, + PyObject_CallFunction( + #ifdef FIX_PATH_DECODING + utimens_cb, "O&iiii", &Path_AsDecodedUnicode, path, + #else + utimens_cb, "siiii", path, + #endif ts[0].tv_sec, ts[0].tv_nsec, ts[1].tv_sec, ts[1].tv_nsec) - ) + ) EPILOGUE } @@ -970,8 +1156,12 @@ #if PY_VERSION_HEX < 0x02050000 PyObject_CallFunction(bmap_cb, "siK", path, blocksize, *idx) #else +#ifdef FIX_PATH_DECODING + PyObject_CallFunction(bmap_cb, "O&nK", &Path_AsDecodedUnicode, path, blocksize, *idx) +#else PyObject_CallFunction(bmap_cb, "snK", path, blocksize, *idx) #endif +#endif ) /* @@ -1008,7 +1198,11 @@ } #if PY_MAJOR_VERSION >= 3 +#ifdef FIX_PATH_DECODING + PROLOGUE(PYO_CALLWITHFI(fi, ioctl_cb, O&Iy#I, &Path_AsDecodedUnicode, path,cmd,(char*)input_data,input_data_size,flags)); +#else PROLOGUE(PYO_CALLWITHFI(fi, ioctl_cb, sIy#I, path,cmd,(char*)input_data,input_data_size,flags)); +#endif #else PROLOGUE(PYO_CALLWITHFI(fi, ioctl_cb, sIs#I, path,cmd,(char*)input_data,input_data_size,flags)); #endif @@ -1066,7 +1260,11 @@ if (ph) pollhandle = PyCapsule_New(ph, pollhandle_name, pollhandle_destructor); +#ifdef FIX_PATH_DECODING + PROLOGUE(PYO_CALLWITHFI(fi, poll_cb, O&O, &Path_AsDecodedUnicode, path, pollhandle)); +#else PROLOGUE(PYO_CALLWITHFI(fi, poll_cb, sO, path, pollhandle)); +#endif OUT_DECREF: Py_DECREF(v); @@ -1229,6 +1427,11 @@ fargv = malloc(fargc * sizeof(char *)); if (!fargv) return(PyErr_NoMemory()); +#ifdef FIX_PATH_DECODING + PyObject **tmp_bytes = malloc(fargc * sizeof(PyObject *)); + if (!tmp_bytes) + return(PyErr_NoMemory()); +#endif if (fargseq) { for (i=0; i < fargc; i++) { @@ -1242,7 +1445,12 @@ "fuse argument is not a string"); return(NULL); } +#ifdef FIX_PATH_DECODING + tmp_bytes[i] = PyUnicode_EncodeFSDefault(pa); + fargv[i] = PyBytes_AsString(tmp_bytes[i]); +#else fargv[i] = PyString_AsString(pa); +#endif Py_DECREF(pa); } @@ -1260,6 +1468,14 @@ #else fuse = __fuse_setup(fargc, fargv, &op, &fmp, &mthp, &fd); #endif + +#ifdef FIX_PATH_DECODING + for (i=0; i < fargc; i++) + Py_DECREF(tmp_bytes[i]); + + free(tmp_bytes); +#endif + free(fargv); if (fuse == NULL) { @@ -1300,7 +1516,7 @@ PyErr_SetString(Py_FuseError, "service loop failed"); return (NULL); - } + } Py_INCREF(Py_None); return Py_None; @@ -1325,9 +1541,10 @@ return(NULL); } - path = PyString_AsString(arg1); + PATH_AS_STR_BEGIN(arg1, path); err = fuse_invalidate(fuse, path); + PATH_AS_STR_END; ret = PyInt_FromLong(err); @@ -1418,7 +1635,7 @@ PyObject *PyInit__fuse(void) { PyObject *m, *d; - + /* Create the module and add the functions */ #if PY_MAJOR_VERSION >= 3 m = PyModule_Create(&fuse_module); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-fuse-1.0.0/make_release.sh new/python-fuse-1.0.4/make_release.sh --- old/python-fuse-1.0.0/make_release.sh 2019-07-19 06:37:09.000000000 +0200 +++ new/python-fuse-1.0.4/make_release.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,36 +0,0 @@ -#!/bin/sh -e - -# Works only in the hg repo incarnation of the source tree. -# Mercurial, docutils, setuptools needs to be installed. - -setupdotpy_version=`python setup.py -V` - -# Finding out Mercurial cset until which we want to log -hgid=`hg id | awk '{print $1}'` -if echo $hgid | grep -q '+$'; then - echo "you have outstanding changes, don't make a release" >&2 - exit 1 -fi -hgrev=`hg log --template '{node|short} {rev}\n' | awk "{if (\\$1 ~ /$hgid/) { print \\$2 }}"` -hgtiprev=`hg log --template '{rev}' -r tip` -if ! [ $hgrev -eq $hgtiprev ]; then - (echo "*************" - echo "Warning: you are making a release from an older state of the code!" - echo "*************") >&2 -fi -if hg log --template '{tags}' -r $hgid | egrep -q "(^| )$setupdotpy_version($| )"; then - log_to=$hgid -elif [ $hgrev -gt 0 ] && - hg log --template '{desc}' -r $hgid | grep -q "Added tag $setupdotpy_version for changeset" && - hg log --template '{tags}' -r $(($hgrev - 1)) | egrep -q "(^| )$setupdotpy_version($| )"; then - log_to=$(($hgrev - 1)) -else - echo "HG tag '$hg_tag' doesn't match reported program version '$setupdotpy_version'" >&2 - exit 1 -fi - -hg log --style util/fusepychangelog.tmpl -r $log_to:0 > Changelog -rst2html.py --stylesheet util/voidspace-fusepy.css README.new_fusepy_api > README.new_fusepy_api.html -{ hg manif | grep -v '^\.' | sed 's/^[0-9]\{3,\} \+\(.\+\)$/\1/' ; echo Changelog ; echo README.new_fusepy_api.html ; } | sed 's/^/include /' > MANIFEST.in -python setup.py sdist -python setup.py bdist_egg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-fuse-1.0.0/setup.py new/python-fuse-1.0.4/setup.py --- old/python-fuse-1.0.0/setup.py 2019-07-19 06:37:09.000000000 +0200 +++ new/python-fuse-1.0.4/setup.py 2021-05-02 08:20:59.000000000 +0200 @@ -1,7 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# distutils build script # To install fuse-python, run 'python setup.py install' # This setup.py based on that of shout-python (py bindings for libshout, @@ -9,10 +8,8 @@ try: from setuptools import setup - from setuptools.dist import Distribution except ImportError: from distutils.core import setup - from distutils.dist import Distribution from distutils.core import Extension import os import sys @@ -31,24 +28,11 @@ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Topic :: System :: Filesystems" ] -class MyDistribution(Distribution): - """ - Obnoxious hack to enforce the packager to generate - the to-be-generated files - """ - -# def run_command(self, command): -# if command == 'sdist': -# for f in ('Changelog', 'README.new_fusepy_api.html'): -# if not os.path.exists(f): -# raise RuntimeError('file ' + repr(f) + \ -# " doesn't exist, please generate it before creating a source distribution") - -# return Distribution.run_command(self, command) - - # write default fuse.pc path into environment if PKG_CONFIG_PATH is unset #if not os.environ.has_key('PKG_CONFIG_PATH'): # os.environ['PKG_CONFIG_PATH'] = '/usr/local/lib/pkgconfig' @@ -120,5 +104,4 @@ maintainer_email = '[email protected]', ext_modules = [fusemodule], packages = ["fuseparts"], - py_modules=["fuse"], - distclass = MyDistribution) + py_modules=["fuse"])
