Skip to contentSkip to conversation

package/systemd: disable urlify unless supported

PATCH New James Hilliard 3 participants 4 messages Jul 20, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/systemd: disable urlify unless supported

The urlify feature in the systemd pager is only supported by the full less package and not busybox less, enable only for builds with full less support.

---
 ...1-Add-meson-option-to-disable-urlify.patch | 67 +++++++++++++++++++
 package/systemd/systemd.mk                    |  6 ++
 2 files changed, 73 insertions(+)
 create mode 100644 package/systemd/0001-Add-meson-option-to-disable-urlify.patch
package/systemd/0001-Add-meson-option-to-disable-urlify.patch new file +67 -0
new file mode 100644
index 0000000000..b0a59a9f0f
@@ -0,0 +1,67 @@
+From e5d86ebed5624ef62342c820a5868b1075deb300 Mon Sep 17 00:00:00 2001
+From: James Hilliard <[email protected]>
+Date: Sun, 11 Jul 2021 04:39:33 -0600
+Subject: [PATCH] Add meson option to disable urlify.
+
+Useful for systems that don't use a version of less with hyperlink
+support.
+
+Signed-off-by: James Hilliard <[email protected]>
+[james.hilliard1 at gmail.com: backport from upstream commit
+e5d86ebed5624ef62342c820a5868b1075deb300]
+---
+ meson.build               | 1 +
+ meson_options.txt         | 2 ++
+ src/shared/pretty-print.c | 4 ++++
+ 3 files changed, 7 insertions(+)
+
+diff --git a/meson.build b/meson.build
+index 5735cfc7ad..a2ee15bf32 100644
+--- a/meson.build
++++ b/meson.build
+@@ -278,6 +278,7 @@ conf.set_quoted('USER_PRESET_DIR',                            userpresetdir)
+ conf.set_quoted('VENDOR_KEYRING_PATH',                        join_paths(rootlibexecdir, 'import-pubring.gpg'))
+ 
+ conf.set('ANSI_OK_COLOR',                                     'ANSI_' + get_option('ok-color').underscorify().to_upper())
++conf.set10('ENABLE_URLIFY',                                   get_option('urlify'))
+ conf.set10('ENABLE_FEXECVE',                                  get_option('fexecve'))
+ conf.set10('MEMORY_ACCOUNTING_DEFAULT',                       memory_accounting_default)
+ conf.set('STATUS_UNIT_FORMAT_DEFAULT',                        'STATUS_UNIT_FORMAT_' + status_unit_format_default.to_upper())
+diff --git a/meson_options.txt b/meson_options.txt
+index 163c8df87d..b60261ac24 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -444,6 +444,8 @@ option('ok-color', type : 'combo',
+                   'highlight-cyan', 'highlight-white'],
+        value : 'green',
+        description: 'color of the "OK" status message')
++option('urlify', type : 'boolean', value : 'true',
++       description : 'enable pager Hyperlink ANSI sequence support')
+ option('fexecve', type : 'boolean', value : 'false',
+        description : 'use fexecve() to spawn children')
+ 
+diff --git a/src/shared/pretty-print.c b/src/shared/pretty-print.c
+index 137ba77b3a..7983c0a33a 100644
+--- a/src/shared/pretty-print.c
++++ b/src/shared/pretty-print.c
+@@ -19,6 +19,7 @@
+ #include "util.h"
+ 
+ bool urlify_enabled(void) {
++#if ENABLE_URLIFY
+         static int cached_urlify_enabled = -1;
+ 
+         if (cached_urlify_enabled < 0) {
+@@ -32,6 +33,9 @@ bool urlify_enabled(void) {
+         }
+ 
+         return cached_urlify_enabled;
++#else
++        return 0;
++#endif
+ }
+ 
+ int terminal_urlify(const char *url, const char *text, char **ret) {
+-- 
+2.25.1
+
package/systemd/systemd.mk +6 -0
index 5562703a89..03a5a5e4c8 100644
@@ -59,6 +59,12 @@ else
 SYSTEMD_CONF_OPTS += -Dacl=false
 endif
 
+ifeq ($(BR2_PACKAGE_LESS),y)
+SYSTEMD_CONF_OPTS += -Durlify=true
+else
+SYSTEMD_CONF_OPTS += -Durlify=false
+endif
+
 ifeq ($(BR2_PACKAGE_LIBAPPARMOR),y)
 SYSTEMD_DEPENDENCIES += libapparmor
 SYSTEMD_CONF_OPTS += -Dapparmor=true
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 package/systemd: disable urlify unless supported

Am Di., 20. Juli 2021 um 17:26 Uhr schrieb James Hilliard <[email protected]>:

Quoted 4 lines

The urlify feature in the systemd pager is only supported by the full less package and not busybox less, enable only for builds with full less support.

Not only that, but its not supported by buildroot's version either (563) ;)

Quoted 66 lines
---
 ...1-Add-meson-option-to-disable-urlify.patch | 67 +++++++++++++++++++
 package/systemd/systemd.mk                    |  6 ++
 2 files changed, 73 insertions(+)
 create mode 100644 package/systemd/0001-Add-meson-option-to-disable-urlify.patch
package/systemd/0001-Add-meson-option-to-disable-urlify.patch new file +52 -0
new file mode 100644
index 0000000000..b0a59a9f0f
@@ -0,0 +1,67 @@
+From e5d86ebed5624ef62342c820a5868b1075deb300 Mon Sep 17 00:00:00 2001
+From: James Hilliard <[email protected]>
+Date: Sun, 11 Jul 2021 04:39:33 -0600
+Subject: [PATCH] Add meson option to disable urlify.
+
+Useful for systems that don't use a version of less with hyperlink
+support.
+
+Signed-off-by: James Hilliard <[email protected]>
+[james.hilliard1 at gmail.com: backport from upstream commit
+e5d86ebed5624ef62342c820a5868b1075deb300]
+---
+ meson.build               | 1 +
+ meson_options.txt         | 2 ++
+ src/shared/pretty-print.c | 4 ++++
+ 3 files changed, 7 insertions(+)
+
+diff --git a/meson.build b/meson.build
+index 5735cfc7ad..a2ee15bf32 100644
+--- a/meson.build
++++ b/meson.build
+@@ -278,6 +278,7 @@ conf.set_quoted('USER_PRESET_DIR',                            userpresetdir)
+ conf.set_quoted('VENDOR_KEYRING_PATH',                        join_paths(rootlibexecdir, 'import-pubring.gpg'))
+
+ conf.set('ANSI_OK_COLOR',                                     'ANSI_' + get_option('ok-color').underscorify().to_upper())
++conf.set10('ENABLE_URLIFY',                                   get_option('urlify'))
+ conf.set10('ENABLE_FEXECVE',                                  get_option('fexecve'))
+ conf.set10('MEMORY_ACCOUNTING_DEFAULT',                       memory_accounting_default)
+ conf.set('STATUS_UNIT_FORMAT_DEFAULT',                        'STATUS_UNIT_FORMAT_' + status_unit_format_default.to_upper())
+diff --git a/meson_options.txt b/meson_options.txt
+index 163c8df87d..b60261ac24 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -444,6 +444,8 @@ option('ok-color', type : 'combo',
+                   'highlight-cyan', 'highlight-white'],
+        value : 'green',
+        description: 'color of the "OK" status message')
++option('urlify', type : 'boolean', value : 'true',
++       description : 'enable pager Hyperlink ANSI sequence support')
+ option('fexecve', type : 'boolean', value : 'false',
+        description : 'use fexecve() to spawn children')
+
+diff --git a/src/shared/pretty-print.c b/src/shared/pretty-print.c
+index 137ba77b3a..7983c0a33a 100644
+--- a/src/shared/pretty-print.c
++++ b/src/shared/pretty-print.c
+@@ -19,6 +19,7 @@
+ #include "util.h"
+
+ bool urlify_enabled(void) {
++#if ENABLE_URLIFY
+         static int cached_urlify_enabled = -1;

package/systemd/0001-Add-meson-option-to-disable-urlify.patch line 62

Quoted 10 lines
package/systemd/0001-Add-meson-option-to-disable-urlify.patch new file +10 -0
+
+         if (cached_urlify_enabled < 0) {
+@@ -32,6 +33,9 @@ bool urlify_enabled(void) {
+         }
+
+         return cached_urlify_enabled;
++#else
++        return 0;
++#endif
+ }

how about just changing the default
cached_urlify_enabled = colors_enabled();
to
cached_urlify_enabled = 0;

Quoted 23 lines
package/systemd/0001-Add-meson-option-to-disable-urlify.patch new file +5 -0
+
+ int terminal_urlify(const char *url, const char *text, char **ret) {
+--
+2.25.1
+
package/systemd/systemd.mk +6 -1
index 5562703a89..03a5a5e4c8 100644
@@ -59,6 +59,12 @@ else
 SYSTEMD_CONF_OPTS += -Dacl=false
 endif
 
+ifeq ($(BR2_PACKAGE_LESS),y)
+SYSTEMD_CONF_OPTS += -Durlify=true
+else
+SYSTEMD_CONF_OPTS += -Durlify=false
+endif
+
 ifeq ($(BR2_PACKAGE_LIBAPPARMOR),y)
 SYSTEMD_DEPENDENCIES += libapparmor
 SYSTEMD_CONF_OPTS += -Dapparmor=true
--
Quoted 1 line

2.25.1

Norbert

#2 lore raw

PATCH 1/1 package/systemd: disable urlify unless supported

Quoted 9 lines · Norbert Lange

Am Di., 20. Juli 2021 um 17:26 Uhr schrieb James Hilliard <[email protected]>:

Quoted 4 lines

The urlify feature in the systemd pager is only supported by the full less package and not busybox less, enable only for builds with full less support.

Not only that, but its not supported by buildroot's version either (563) ;)

Yeah, I had noticed that after I sent this, we should probably apply this first:
https://patchwork.ozlabs.org/project/buildroot/patch/20210720153005.314976-1-james.hilliard1 at gmail.com/

Quoted 74 lines
Quoted 74 lines
---
 ...1-Add-meson-option-to-disable-urlify.patch | 67 +++++++++++++++++++
 package/systemd/systemd.mk                    |  6 ++
 2 files changed, 73 insertions(+)
 create mode 100644 package/systemd/0001-Add-meson-option-to-disable-urlify.patch
package/systemd/0001-Add-meson-option-to-disable-urlify.patch new file +59 -0
new file mode 100644
index 0000000000..b0a59a9f0f
@@ -0,0 +1,67 @@
+From e5d86ebed5624ef62342c820a5868b1075deb300 Mon Sep 17 00:00:00 2001
+From: James Hilliard <[email protected]>
+Date: Sun, 11 Jul 2021 04:39:33 -0600
+Subject: [PATCH] Add meson option to disable urlify.
+
+Useful for systems that don't use a version of less with hyperlink
+support.
+
+Signed-off-by: James Hilliard <[email protected]>
+[james.hilliard1 at gmail.com: backport from upstream commit
+e5d86ebed5624ef62342c820a5868b1075deb300]
+---
+ meson.build               | 1 +
+ meson_options.txt         | 2 ++
+ src/shared/pretty-print.c | 4 ++++
+ 3 files changed, 7 insertions(+)
+
+diff --git a/meson.build b/meson.build
+index 5735cfc7ad..a2ee15bf32 100644
+--- a/meson.build
++++ b/meson.build
+@@ -278,6 +278,7 @@ conf.set_quoted('USER_PRESET_DIR',                            userpresetdir)
+ conf.set_quoted('VENDOR_KEYRING_PATH',                        join_paths(rootlibexecdir, 'import-pubring.gpg'))
+
+ conf.set('ANSI_OK_COLOR',                                     'ANSI_' + get_option('ok-color').underscorify().to_upper())
++conf.set10('ENABLE_URLIFY',                                   get_option('urlify'))
+ conf.set10('ENABLE_FEXECVE',                                  get_option('fexecve'))
+ conf.set10('MEMORY_ACCOUNTING_DEFAULT',                       memory_accounting_default)
+ conf.set('STATUS_UNIT_FORMAT_DEFAULT',                        'STATUS_UNIT_FORMAT_' + status_unit_format_default.to_upper())
+diff --git a/meson_options.txt b/meson_options.txt
+index 163c8df87d..b60261ac24 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -444,6 +444,8 @@ option('ok-color', type : 'combo',
+                   'highlight-cyan', 'highlight-white'],
+        value : 'green',
+        description: 'color of the "OK" status message')
++option('urlify', type : 'boolean', value : 'true',
++       description : 'enable pager Hyperlink ANSI sequence support')
+ option('fexecve', type : 'boolean', value : 'false',
+        description : 'use fexecve() to spawn children')
+
+diff --git a/src/shared/pretty-print.c b/src/shared/pretty-print.c
+index 137ba77b3a..7983c0a33a 100644
+--- a/src/shared/pretty-print.c
++++ b/src/shared/pretty-print.c
+@@ -19,6 +19,7 @@
+ #include "util.h"
+
+ bool urlify_enabled(void) {
++#if ENABLE_URLIFY
+         static int cached_urlify_enabled = -1;
+
+         if (cached_urlify_enabled < 0) {
+@@ -32,6 +33,9 @@ bool urlify_enabled(void) {
+         }
+
+         return cached_urlify_enabled;
++#else
Quoted 8 lines

package/systemd/0001-Add-meson-option-to-disable-urlify.patch line 62

Quoted 3 lines
package/systemd/0001-Add-meson-option-to-disable-urlify.patch new file +3 -0
++        return 0;
++#endif
+ }

how about just changing the default
cached_urlify_enabled = colors_enabled();
to
cached_urlify_enabled = 0;

This is an unmodified backport of the upstream commit:
https://github.com/systemd/systemd/commit/e5d86ebed5624ef62342c820a5868b1075deb300

I figured just returning 0 made the disabling logic clearer.

Quoted 27 lines
Quoted 24 lines
package/systemd/0001-Add-meson-option-to-disable-urlify.patch new file +5 -0
+
+ int terminal_urlify(const char *url, const char *text, char **ret) {
+--
+2.25.1
+
package/systemd/systemd.mk +6 -1
index 5562703a89..03a5a5e4c8 100644
@@ -59,6 +59,12 @@ else
 SYSTEMD_CONF_OPTS += -Dacl=false
 endif
 
+ifeq ($(BR2_PACKAGE_LESS),y)
+SYSTEMD_CONF_OPTS += -Durlify=true
+else
+SYSTEMD_CONF_OPTS += -Durlify=false
+endif
+
 ifeq ($(BR2_PACKAGE_LIBAPPARMOR),y)
 SYSTEMD_DEPENDENCIES += libapparmor
 SYSTEMD_CONF_OPTS += -Dapparmor=true
--
Quoted 1 line

2.25.1

Norbert

#3 lore raw

PATCH 1/1 package/systemd: disable urlify unless supported

In reply to James Hilliard
Quoted 10 lines · On Tue, 20 Jul 2021 09:25:59 -0600 James Hilliard <[email protected]>…

The urlify feature in the systemd pager is only supported by the full less package and not busybox less, enable only for builds with full less support.

---
 ...1-Add-meson-option-to-disable-urlify.patch | 67 +++++++++++++++++++
 package/systemd/systemd.mk                    |  6 ++
 2 files changed, 73 insertions(+)
 create mode 100644 package/systemd/0001-Add-meson-option-to-disable-urlify.patch

Applied to master, thanks.

Thomas

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