mirror of
https://github.com/systemd/systemd
synced 2024-10-14 20:17:52 +00:00
Merge pull request #25616 from poettering/chase-symlinks-opendir
chase-symlinks/systemctl: let's handle cases without /proc/ better
This commit is contained in:
commit
cc420ae52a
|
@ -559,7 +559,7 @@ int chase_symlinks_and_opendir(
|
|||
return r;
|
||||
assert(path_fd >= 0);
|
||||
|
||||
d = opendir(FORMAT_PROC_FD_PATH(path_fd));
|
||||
d = xopendirat(path_fd, ".", O_NOFOLLOW);
|
||||
if (!d)
|
||||
return -errno;
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ const char *special_glyph(SpecialGlyph code) {
|
|||
[SPECIAL_GLYPH_RECYCLING] = "~",
|
||||
[SPECIAL_GLYPH_DOWNLOAD] = "\\",
|
||||
[SPECIAL_GLYPH_SPARKLES] = "*",
|
||||
[SPECIAL_GLYPH_WARNING_SIGN] = "!",
|
||||
},
|
||||
|
||||
/* UTF-8 */
|
||||
|
@ -124,10 +125,11 @@ const char *special_glyph(SpecialGlyph code) {
|
|||
/* This emoji is a single character cell glyph in Unicode, and two in ASCII */
|
||||
[SPECIAL_GLYPH_TOUCH] = u8"👆", /* actually called: BACKHAND INDEX POINTING UP */
|
||||
|
||||
/* These three emojis are single character cell glyphs in Unicode and also in ASCII. */
|
||||
/* These four emojis are single character cell glyphs in Unicode and also in ASCII. */
|
||||
[SPECIAL_GLYPH_RECYCLING] = u8"♻️", /* actually called: UNIVERSAL RECYCLNG SYMBOL */
|
||||
[SPECIAL_GLYPH_DOWNLOAD] = u8"⤵️", /* actually called: RIGHT ARROW CURVING DOWN */
|
||||
[SPECIAL_GLYPH_SPARKLES] = u8"✨",
|
||||
[SPECIAL_GLYPH_WARNING_SIGN] = u8"⚠️",
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ typedef enum SpecialGlyph {
|
|||
SPECIAL_GLYPH_RECYCLING,
|
||||
SPECIAL_GLYPH_DOWNLOAD,
|
||||
SPECIAL_GLYPH_SPARKLES,
|
||||
SPECIAL_GLYPH_WARNING_SIGN,
|
||||
_SPECIAL_GLYPH_MAX,
|
||||
_SPECIAL_GLYPH_INVALID = -EINVAL,
|
||||
} SpecialGlyph;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "rlimit-util.h"
|
||||
#include "sigbus.h"
|
||||
#include "signal-util.h"
|
||||
#include "stat-util.h"
|
||||
#include "string-table.h"
|
||||
#include "systemctl-add-dependency.h"
|
||||
#include "systemctl-cancel-job.h"
|
||||
|
@ -1157,6 +1158,13 @@ static int run(int argc, char *argv[]) {
|
|||
if (r <= 0)
|
||||
goto finish;
|
||||
|
||||
if (proc_mounted() == 0)
|
||||
log_warning("%s%s/proc/ is not mounted. This is not a supported mode of operation. Please fix\n"
|
||||
"your invocation environment to mount /proc/ and /sys/ properly. Proceeding anyway.\n"
|
||||
"Your mileage may vary.",
|
||||
emoji_enabled() ? special_glyph(SPECIAL_GLYPH_WARNING_SIGN) : "",
|
||||
emoji_enabled() ? " " : "");
|
||||
|
||||
if (arg_action != ACTION_SYSTEMCTL && running_in_chroot() > 0) {
|
||||
if (!arg_quiet)
|
||||
log_info("Running in chroot, ignoring request.");
|
||||
|
|
|
@ -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_SPARKLES + 1 == _SPECIAL_GLYPH_MAX);
|
||||
assert_cc(SPECIAL_GLYPH_WARNING_SIGN + 1 == _SPECIAL_GLYPH_MAX);
|
||||
|
||||
log_info("is_locale_utf8: %s", yes_no(is_locale_utf8()));
|
||||
|
||||
|
@ -119,6 +119,7 @@ TEST(dump_special_glyphs) {
|
|||
dump_glyph(SPECIAL_GLYPH_RECYCLING);
|
||||
dump_glyph(SPECIAL_GLYPH_DOWNLOAD);
|
||||
dump_glyph(SPECIAL_GLYPH_SPARKLES);
|
||||
dump_glyph(SPECIAL_GLYPH_WARNING_SIGN);
|
||||
}
|
||||
|
||||
DEFINE_TEST_MAIN(LOG_INFO);
|
||||
|
|
Loading…
Reference in a new issue