Skip to contentSkip to conversation

package/polkit: install service file

PATCH New aduskett at gmail.com 3 participants 8 messages Apr 18, 2020 – May 6, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 package/polkit: install service file

From: Adam Duskett <[email protected]>

The default installed service file is missing a target, which causes preset-all to not enable the service.

Add the service file to package/polkit with the addition of:

[Install]
WantedBy=multi-user.target

---
 package/polkit/polkit.mk      |  6 ++++++
 package/polkit/polkit.service | 12 ++++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 package/polkit/polkit.service
package/polkit/polkit.mk +6 -0
index 8572d8b9ba..ee0b3674de 100644
@@ -43,4 +43,10 @@ define POLKIT_PERMISSIONS
 	/usr/bin/pkexec f 4755 root root - - - - -
 endef
 
+define POLKIT_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 644 $(POLKIT_PKGDIR)/polkit.service \
+		$(TARGET_DIR)/usr/lib/systemd/system/polkit.service
+
+endef
+
 $(eval $(autotools-package))
package/polkit/polkit.service new file +12 -0
new file mode 100644
index 0000000000..a69b28cd93
@@ -0,0 +1,12 @@
+[Unit]
+
+Description=Authorization Manager
+Documentation=man:polkit(8)
+
+[Service]
+Type=dbus
+BusName=org.freedesktop.PolicyKit1
+ExecStart=/usr/lib/polkit-1/polkitd --no-debug
+
+[Install]
+WantedBy=multi-user.target
Signature · 1 line
2.25.2
#1 lore raw

PATCH 2/4 package/polkit: add upstream memory leak fix

From: Adam Duskett <[email protected]>

This patch fixes two small memory leaks.

Upstream commit: 28e3a6653d8c3777b07e0128a0d97d46e586e311

---
 package/polkit/0002-jsauthority-memleak.patch | 28 +++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 package/polkit/0002-jsauthority-memleak.patch
package/polkit/0002-jsauthority-memleak.patch new file +28 -0
new file mode 100644
index 0000000000..4f0733185c
@@ -0,0 +1,28 @@
+From 28e3a6653d8c3777b07e0128a0d97d46e586e311 Mon Sep 17 00:00:00 2001
+From: Jan Rybar <[email protected]>
+Date: Tue, 8 Oct 2019 13:28:18 +0000
+Subject: [PATCH] jsauthority: Fix two minor memory leaks
+
+(cherry picked from commit 28e3a6653d8c3777b07e0128a0d97d46e586e311)
+Signed-off-by: Jan Rybar <[email protected]>
+Signed-off-by: Adam Duskett <[email protected]>
+---
+ src/polkitbackend/polkitbackendjsauthority.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp
+index 9b752d1..e97b8aa 100644
+--- a/src/polkitbackend/polkitbackendjsauthority.cpp
++++ b/src/polkitbackend/polkitbackendjsauthority.cpp
+@@ -567,6 +567,8 @@ polkit_backend_js_authority_finalize (GObject *object)
+   g_strfreev (authority->priv->rules_dirs);
+ 
+   delete authority->priv->ac;
++  delete authority->priv->js_global;
++  delete authority->priv->js_polkit;
+ 
+   JS_DestroyContext (authority->priv->cx);
+   /* JS_ShutDown (); */
+-- 
+2.24.1
+
Signature · 1 line
2.25.2
#2 lore raw

PATCH 2/4 package/polkit: add upstream memory leak fix

Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"aduskett" == aduskett <[email protected]> writes:

From: Adam Duskett <[email protected]>
This patch fixes two small memory leaks.

Upstream commit: 28e3a6653d8c3777b07e0128a0d97d46e586e311

Committed to 2020.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 3/4 package/polkit: add upstream fix for SIGTTOU

In reply to aduskett at gmail.com

From: Adam Duskett <[email protected]>

If tty_handler() resets terminal while pkttyagent is run in background job, the process gets stopped by SIGTTOU. This impacts systemctl, hence it must be blocked for a while and then the process gets killed anyway.

Upstream commit: 28e3a6653d8c3777b07e0128a0d97d46e586e311

---
 ...lkit-0.116-pkttyagent-sigttou-bg-job.patch | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 package/polkit/0003-polkit-0.116-pkttyagent-sigttou-bg-job.patch
package/polkit/0003-polkit-0.116-pkttyagent-sigttou-bg-job.patch new file +34 -0
new file mode 100644
index 0000000000..fb41df3af2
@@ -0,0 +1,34 @@
+From 76aae4fce586b400f5fe08df31497db19d624609 Mon Sep 17 00:00:00 2001
+From: Jan Rybar <[email protected]>
+Date: Thu, 1 Aug 2019 06:46:10 +0000
+Subject: [PATCH] pkttyagent: process stopped by SIGTTOU if run in background
+ job
+
+
+(cherry picked from commit 76aae4fce586b400f5fe08df31497db19d624609)
+Signed-off-by: Jan Rybar <[email protected]>
+Signed-off-by: Adam Duskett <[email protected]>
+---
+ src/programs/pkttyagent.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/src/programs/pkttyagent.c b/src/programs/pkttyagent.c
+index 3c8d502..13879a2 100644
+--- a/src/programs/pkttyagent.c
++++ b/src/programs/pkttyagent.c
+@@ -264,6 +264,12 @@ main (int argc, char *argv[])
+ 
+   memset (&sa, 0, sizeof (sa));
+   sa.sa_handler = &tty_handler;
++/* If tty_handler() resets terminal while pkttyagent is run in background job,
++   the process gets stopped by SIGTTOU. This impacts systemctl, hence it must
++   be blocked for a while and then the process gets killed anyway.
++ */
++  sigemptyset(&sa.sa_mask);
++  sigaddset(&sa.sa_mask, SIGTTOU);
+   sigaction (SIGTERM, &sa, &savesigterm);
+   sigaction (SIGINT, &sa, &savesigint);
+   sigaction (SIGTSTP, &sa, &savesigtstp);
+-- 
+2.24.1
+
Signature · 1 line
2.25.2
#4 lore raw

PATCH 3/4 package/polkit: add upstream fix for SIGTTOU

Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"aduskett" == aduskett <[email protected]> writes:

From: Adam Duskett <[email protected]>
If tty_handler() resets terminal while pkttyagent is run in background job, the process gets stopped by SIGTTOU. This impacts systemctl, hence it must be blocked for a while and then the process gets killed anyway.

Upstream commit: 28e3a6653d8c3777b07e0128a0d97d46e586e311

Committed to 2020.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 4/4 package/polkit: enable gobject-introspection support

In reply to aduskett at gmail.com

From: Adam Duskett <[email protected]>

If gobject-introspection is selected, add the gobject-introspection package to the dependency list and set the conf opt --enable-introspection.

---
 package/polkit/polkit.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/polkit/polkit.mk +7 -0
index ee0b3674de..3ae42b2312 100644
@@ -26,6 +26,13 @@ POLKIT_CONF_OPTS = \
 	--disable-libelogind \
 	--disable-libsystemd-login
 
+ifeq ($(BR2_PACKAGE_GOBJECT_INTROSPECTION),y)
+POLKIT_CONF_OPTS += --enable-introspection
+POLKIT_DEPENDENCIES += gobject-introspection
+else
+POLKIT_CONF_OPTS += --disable-introspection
+endif
+
 ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
 POLKIT_DEPENDENCIES += linux-pam
 POLKIT_CONF_OPTS += --with-authfw=pam
Signature · 1 line
2.25.2
#6 lore raw

PATCH 1/4 package/polkit: install service file

In reply to aduskett at gmail.com
Quoted 10 lines · On Fri, 17 Apr 2020 19:58:13 -0700 aduskett at gmail.com wrote:

From: Adam Duskett <[email protected]>

The default installed service file is missing a target, which causes preset-all to not enable the service.

Add the service file to package/polkit with the addition of:

[Install]
WantedBy=multi-user.target

Quoted 6 lines
---
 package/polkit/polkit.mk      |  6 ++++++
 package/polkit/polkit.service | 12 ++++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 package/polkit/polkit.service

I've applied the series. However, I hesitated to apply PATCH 1/4:
upstream provides a service file so it would be better to be able to use it. Could you report to upstream the missing [Install] section in the .service file ?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#7 lore raw

PATCH 1/4 package/polkit: install service file

In reply to aduskett at gmail.com
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"aduskett" == aduskett <[email protected]> writes:

From: Adam Duskett <[email protected]>
The default installed service file is missing a target, which causes preset-all to not enable the service.

Quoted 6 lines

Add the service file to package/polkit with the addition of:

[Install]
WantedBy=multi-user.target

Committed to 2020.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard