Sat Oct 9 23:20:24 2021 UTC ()
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).


(gutteridge)
diff -r1.20 -r1.21 pkgsrc/devel/py-jupyter_client/Makefile
diff -r1.16 -r1.17 pkgsrc/devel/py-jupyter_client/distinfo
diff -r0 -r1.1 pkgsrc/devel/py-jupyter_client/patches/patch-jupyter__client_connect.py

cvs diff -r1.20 -r1.21 pkgsrc/devel/py-jupyter_client/Makefile (expand / switch to unified diff)

--- pkgsrc/devel/py-jupyter_client/Makefile 2021/06/29 09:23:30 1.20
+++ pkgsrc/devel/py-jupyter_client/Makefile 2021/10/09 23:20:24 1.21
@@ -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
3DISTNAME= jupyter_client-6.1.12 3DISTNAME= jupyter_client-6.1.12
4PKGNAME= ${PYPKGPREFIX}-${DISTNAME} 4PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
 5PKGREVISION= 1
5CATEGORIES= devel python 6CATEGORIES= devel python
6MASTER_SITES= ${MASTER_SITE_PYPI:=j/jupyter_client/} 7MASTER_SITES= ${MASTER_SITE_PYPI:=j/jupyter_client/}
7 8
8MAINTAINER= pkgsrc-users@NetBSD.org 9MAINTAINER= pkgsrc-users@NetBSD.org
9HOMEPAGE= https://jupyter-client.readthedocs.io/ 10HOMEPAGE= https://jupyter-client.readthedocs.io/
10COMMENT= Jupyter protocol implementation and client libraries 11COMMENT= Jupyter protocol implementation and client libraries
11LICENSE= modified-bsd 12LICENSE= modified-bsd
12 13
13DEPENDS+= ${PYPKGPREFIX}-dateutil>=2.1:../../time/py-dateutil 14DEPENDS+= ${PYPKGPREFIX}-dateutil>=2.1:../../time/py-dateutil
14DEPENDS+= ${PYPKGPREFIX}-jupyter_core>=4.6.0:../../devel/py-jupyter_core 15DEPENDS+= ${PYPKGPREFIX}-jupyter_core>=4.6.0:../../devel/py-jupyter_core
15DEPENDS+= ${PYPKGPREFIX}-tornado>=4.1:../../www/py-tornado 16DEPENDS+= ${PYPKGPREFIX}-tornado>=4.1:../../www/py-tornado
16DEPENDS+= ${PYPKGPREFIX}-traitlets>=4.1.0:../../devel/py-traitlets 17DEPENDS+= ${PYPKGPREFIX}-traitlets>=4.1.0:../../devel/py-traitlets
17DEPENDS+= ${PYPKGPREFIX}-zmq>=13.0.0:../../net/py-zmq 18DEPENDS+= ${PYPKGPREFIX}-zmq>=13.0.0:../../net/py-zmq

cvs diff -r1.16 -r1.17 pkgsrc/devel/py-jupyter_client/distinfo (expand / switch to unified diff)

--- pkgsrc/devel/py-jupyter_client/distinfo 2021/10/07 13:43:18 1.16
+++ pkgsrc/devel/py-jupyter_client/distinfo 2021/10/09 23:20:24 1.17
@@ -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
3RMD160 (jupyter_client-6.1.12.tar.gz) = 1e2bf8a6a8ec37e0744a7d5cb85895224636b43e 3RMD160 (jupyter_client-6.1.12.tar.gz) = 1e2bf8a6a8ec37e0744a7d5cb85895224636b43e
4SHA512 (jupyter_client-6.1.12.tar.gz) = f31ff1a24b264c32d35d07491785e1d77935cdb463243e90e4aadcb0a093a074cdce75f01662591766588f39b146077639ca697f71157309dc92f12ae04d5cdd 4SHA512 (jupyter_client-6.1.12.tar.gz) = f31ff1a24b264c32d35d07491785e1d77935cdb463243e90e4aadcb0a093a074cdce75f01662591766588f39b146077639ca697f71157309dc92f12ae04d5cdd
5Size (jupyter_client-6.1.12.tar.gz) = 301499 bytes 5Size (jupyter_client-6.1.12.tar.gz) = 301499 bytes
 6SHA1 (patch-jupyter__client_connect.py) = 0fd1aeeff32eb89d270324aada38f91d5decefb6

File Added: pkgsrc/devel/py-jupyter_client/patches/Attic/patch-jupyter__client_connect.py
$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