py-jupyter_client: set sticky bit only on the directory Addresses PR pkg/56437 from Chavdar Ivanov, who also supplied the patch that has already been integrated upstream (but not yet in a release branch).diff -r1.20 -r1.21 pkgsrc/devel/py-jupyter_client/Makefile
(gutteridge)
@@ -1,17 +1,18 @@ | @@ -1,17 +1,18 @@ | |||
1 | # $NetBSD: Makefile,v 1.20 2021/06/29 09:23:30 nia Exp $ | 1 | # $NetBSD: Makefile,v 1.21 2021/10/09 23:20:24 gutteridge Exp $ | |
2 | 2 | |||
3 | DISTNAME= jupyter_client-6.1.12 | 3 | DISTNAME= jupyter_client-6.1.12 | |
4 | PKGNAME= ${PYPKGPREFIX}-${DISTNAME} | 4 | PKGNAME= ${PYPKGPREFIX}-${DISTNAME} | |
5 | PKGREVISION= 1 | |||
5 | CATEGORIES= devel python | 6 | CATEGORIES= devel python | |
6 | MASTER_SITES= ${MASTER_SITE_PYPI:=j/jupyter_client/} | 7 | MASTER_SITES= ${MASTER_SITE_PYPI:=j/jupyter_client/} | |
7 | 8 | |||
8 | MAINTAINER= pkgsrc-users@NetBSD.org | 9 | MAINTAINER= pkgsrc-users@NetBSD.org | |
9 | HOMEPAGE= https://jupyter-client.readthedocs.io/ | 10 | HOMEPAGE= https://jupyter-client.readthedocs.io/ | |
10 | COMMENT= Jupyter protocol implementation and client libraries | 11 | COMMENT= Jupyter protocol implementation and client libraries | |
11 | LICENSE= modified-bsd | 12 | LICENSE= modified-bsd | |
12 | 13 | |||
13 | DEPENDS+= ${PYPKGPREFIX}-dateutil>=2.1:../../time/py-dateutil | 14 | DEPENDS+= ${PYPKGPREFIX}-dateutil>=2.1:../../time/py-dateutil | |
14 | DEPENDS+= ${PYPKGPREFIX}-jupyter_core>=4.6.0:../../devel/py-jupyter_core | 15 | DEPENDS+= ${PYPKGPREFIX}-jupyter_core>=4.6.0:../../devel/py-jupyter_core | |
15 | DEPENDS+= ${PYPKGPREFIX}-tornado>=4.1:../../www/py-tornado | 16 | DEPENDS+= ${PYPKGPREFIX}-tornado>=4.1:../../www/py-tornado | |
16 | DEPENDS+= ${PYPKGPREFIX}-traitlets>=4.1.0:../../devel/py-traitlets | 17 | DEPENDS+= ${PYPKGPREFIX}-traitlets>=4.1.0:../../devel/py-traitlets | |
17 | DEPENDS+= ${PYPKGPREFIX}-zmq>=13.0.0:../../net/py-zmq | 18 | DEPENDS+= ${PYPKGPREFIX}-zmq>=13.0.0:../../net/py-zmq |
@@ -1,5 +1,6 @@ | @@ -1,5 +1,6 @@ | |||
1 | $NetBSD: distinfo,v 1.16 2021/10/07 13:43:18 nia Exp $ | 1 | $NetBSD: distinfo,v 1.17 2021/10/09 23:20:24 gutteridge Exp $ | |
2 | 2 | |||
3 | RMD160 (jupyter_client-6.1.12.tar.gz) = 1e2bf8a6a8ec37e0744a7d5cb85895224636b43e | 3 | RMD160 (jupyter_client-6.1.12.tar.gz) = 1e2bf8a6a8ec37e0744a7d5cb85895224636b43e | |
4 | SHA512 (jupyter_client-6.1.12.tar.gz) = f31ff1a24b264c32d35d07491785e1d77935cdb463243e90e4aadcb0a093a074cdce75f01662591766588f39b146077639ca697f71157309dc92f12ae04d5cdd | 4 | SHA512 (jupyter_client-6.1.12.tar.gz) = f31ff1a24b264c32d35d07491785e1d77935cdb463243e90e4aadcb0a093a074cdce75f01662591766588f39b146077639ca697f71157309dc92f12ae04d5cdd | |
5 | Size (jupyter_client-6.1.12.tar.gz) = 301499 bytes | 5 | Size (jupyter_client-6.1.12.tar.gz) = 301499 bytes | |
6 | SHA1 (patch-jupyter__client_connect.py) = 0fd1aeeff32eb89d270324aada38f91d5decefb6 |
$NetBSD: patch-jupyter__client_connect.py,v 1.1 2021/10/09 23:20:24 gutteridge Exp $
Set sticky bit only on the directory.
https://github.com/jupyter/jupyter_client/pull/711/
--- jupyter_client/connect.py.orig 2021-03-14 00:34:45.000000000 +0000
+++ jupyter_client/connect.py
@@ -137,31 +137,20 @@ def write_connection_file(fname=None, sh
f.write(json.dumps(cfg, indent=2))
if hasattr(stat, 'S_ISVTX'):
- # set the sticky bit on the file and its parent directory
- # to avoid periodic cleanup
- paths = [fname]
+ # set the sticky bit on the parent directory of the file
+ # to ensure only owner can remove it
runtime_dir = os.path.dirname(fname)
if runtime_dir:
- paths.append(runtime_dir)
- for path in paths:
- permissions = os.stat(path).st_mode
+ permissions = os.stat(runtime_dir).st_mode
new_permissions = permissions | stat.S_ISVTX
if new_permissions != permissions:
try:
- os.chmod(path, new_permissions)
+ os.chmod(runtime_dir, new_permissions)
except OSError as e:
- if e.errno == errno.EPERM and path == runtime_dir:
+ if e.errno == errno.EPERM:
# suppress permission errors setting sticky bit on runtime_dir,
# which we may not own.
pass
- else:
- # failed to set sticky bit, probably not a big deal
- warnings.warn(
- "Failed to set sticky bit on %r: %s"
- "\nProbably not a big deal, but runtime files may be cleaned up periodically." % (path, e),
- RuntimeWarning,
- )
-
return fname, cfg