]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
run0: when changing privileges to non-root, do not show superhero emoji
authorLennart Poettering <lennart@poettering.net>
Tue, 12 Nov 2024 13:18:31 +0000 (14:18 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 12 Nov 2024 22:09:21 +0000 (23:09 +0100)
Let's show an idcard logo instead, to indicate that we changed ids.

src/basic/glyph-util.c
src/basic/glyph-util.h
src/run/run.c
src/test/test-locale-util.c

index 1108afdf03e110bdd5250c10677cab2d34711877..64f6685cb4fcb53ff67ad790e5a8b40c0e5364e1 100644 (file)
@@ -81,6 +81,7 @@ const char* special_glyph_full(SpecialGlyph code, bool force_utf) {
                         [SPECIAL_GLYPH_BLUE_CIRCLE]             = "o",
                         [SPECIAL_GLYPH_GREEN_CIRCLE]            = "o",
                         [SPECIAL_GLYPH_SUPERHERO]               = "S",
+                        [SPECIAL_GLYPH_IDCARD]                  = "@",
                 },
 
                 /* UTF-8 */
@@ -151,6 +152,7 @@ const char* special_glyph_full(SpecialGlyph code, bool force_utf) {
                         [SPECIAL_GLYPH_BLUE_CIRCLE]             = u8"🔵",
                         [SPECIAL_GLYPH_GREEN_CIRCLE]            = u8"🟢",
                         [SPECIAL_GLYPH_SUPERHERO]               = u8"🦸",
+                        [SPECIAL_GLYPH_IDCARD]                  = u8"🪪",
                 },
         };
 
index c31c3c18bba4b3aac8e0cc15573a2461b55e7cae..ca4d4eda71aa00deccdcdde109b2f8f99b5ab375 100644 (file)
@@ -56,6 +56,7 @@ typedef enum SpecialGlyph {
         SPECIAL_GLYPH_BLUE_CIRCLE,
         SPECIAL_GLYPH_GREEN_CIRCLE,
         SPECIAL_GLYPH_SUPERHERO,
+        SPECIAL_GLYPH_IDCARD,
         _SPECIAL_GLYPH_MAX,
         _SPECIAL_GLYPH_INVALID = -EINVAL,
 } SpecialGlyph;
index 5a1df9ce8f69dc6de8ae6838ab7303844ee1f454..c62dce8950fde42bb8012132f3ce81b75232ce6b 100644 (file)
@@ -1038,7 +1038,7 @@ static int parse_argv_sudo_mode(int argc, char *argv[]) {
                         if (!arg_shell_prompt_prefix)
                                 return log_oom();
                 } else if (emoji_enabled()) {
-                        arg_shell_prompt_prefix = strjoin(special_glyph(SPECIAL_GLYPH_SUPERHERO), " ");
+                        arg_shell_prompt_prefix = strjoin(special_glyph(privileged_execution() ? SPECIAL_GLYPH_SUPERHERO : SPECIAL_GLYPH_IDCARD), " ");
                         if (!arg_shell_prompt_prefix)
                                 return log_oom();
                 }
index 7afa446bfb6087dd2d09b86935e84460cde9afe3..f9b2712444a9c9613a54af7c0f57b7514a318e47 100644 (file)
@@ -82,7 +82,7 @@ TEST(keymaps) {
 
 #define dump_glyph(x) log_info(STRINGIFY(x) ": %s", special_glyph(x))
 TEST(dump_special_glyphs) {
-        assert_cc(SPECIAL_GLYPH_SUPERHERO + 1 == _SPECIAL_GLYPH_MAX);
+        assert_cc(SPECIAL_GLYPH_IDCARD + 1 == _SPECIAL_GLYPH_MAX);
 
         log_info("is_locale_utf8: %s", yes_no(is_locale_utf8()));
 
@@ -134,6 +134,7 @@ TEST(dump_special_glyphs) {
         dump_glyph(SPECIAL_GLYPH_BLUE_CIRCLE);
         dump_glyph(SPECIAL_GLYPH_GREEN_CIRCLE);
         dump_glyph(SPECIAL_GLYPH_SUPERHERO);
+        dump_glyph(SPECIAL_GLYPH_IDCARD);
 }
 
 DEFINE_TEST_MAIN(LOG_INFO);