summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hwdb/60-evdev.hwdb7
-rw-r--r--man/sd_journal_print.xml87
-rwxr-xr-xmkosi.build2
-rw-r--r--src/basic/process-util.c2
-rw-r--r--src/boot/efi/console.c8
-rw-r--r--src/journal/journal-send.c16
-rw-r--r--src/kernel-install/90-loaderentry.install3
-rw-r--r--src/kernel-install/kernel-install10
-rw-r--r--src/machine/machinectl.c1
-rw-r--r--src/network/networkd-conf.c2
-rw-r--r--src/nspawn/nspawn.c1
-rw-r--r--src/resolve/resolved-dns-packet.c2
-rw-r--r--src/shared/logs-show.c4
-rw-r--r--src/systemctl/systemctl.c2
-rw-r--r--src/test/test-process-util.c2
15 files changed, 80 insertions, 69 deletions
diff --git a/hwdb/60-evdev.hwdb b/hwdb/60-evdev.hwdb
index 6f33849aa5..eceaddbd01 100644
--- a/hwdb/60-evdev.hwdb
+++ b/hwdb/60-evdev.hwdb
@@ -104,6 +104,13 @@ evdev:name:ETPS/2 Elantech Touchpad:dmi:*:svnASUSTeKCOMPUTERINC.:pnX550CC:*
EVDEV_ABS_35=::31
EVDEV_ABS_36=::30
+# Asus UX305
+evdev:name:Elan Touchpad:dmi:*:svnASUSTeKCOMPUTERINC.:pnUX305UA:*
+ EVDEV_ABS_00=0:3097:32
+ EVDEV_ABS_01=0:2119:33
+ EVDEV_ABS_35=0:3097:32
+ EVDEV_ABS_36=0:2119:33
+
#########################################
# Dell
#########################################
diff --git a/man/sd_journal_print.xml b/man/sd_journal_print.xml
index 17fdc9c1f2..76542527fc 100644
--- a/man/sd_journal_print.xml
+++ b/man/sd_journal_print.xml
@@ -93,27 +93,21 @@
<refsect1>
<title>Description</title>
- <para><function>sd_journal_print()</function> may be used to
- submit simple, plain text log entries to the system journal. The
- first argument is a priority value. This is followed by a format
- string and its parameters, similar to
- <citerefentry project='man-pages'><refentrytitle>printf</refentrytitle><manvolnum>3</manvolnum></citerefentry>
- or
+ <para><function>sd_journal_print()</function> may be used to submit simple, plain text log entries to the system
+ journal. The first argument is a priority value. This is followed by a format string and its parameters, similar to
+ <citerefentry project='man-pages'><refentrytitle>printf</refentrytitle><manvolnum>3</manvolnum></citerefentry> or
<citerefentry project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
- The priority value is one of
- <constant>LOG_EMERG</constant>,
- <constant>LOG_ALERT</constant>,
- <constant>LOG_CRIT</constant>,
- <constant>LOG_ERR</constant>,
- <constant>LOG_WARNING</constant>,
- <constant>LOG_NOTICE</constant>,
- <constant>LOG_INFO</constant>,
- <constant>LOG_DEBUG</constant>, as defined in
- <filename>syslog.h</filename>, see
- <citerefentry project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>
- for details. It is recommended to use this call to submit log
- messages in the application locale or system locale and in UTF-8
- format, but no such restrictions are enforced.</para>
+ The priority value is one of <constant>LOG_EMERG</constant>, <constant>LOG_ALERT</constant>,
+ <constant>LOG_CRIT</constant>, <constant>LOG_ERR</constant>, <constant>LOG_WARNING</constant>,
+ <constant>LOG_NOTICE</constant>, <constant>LOG_INFO</constant>, <constant>LOG_DEBUG</constant>, as defined in
+ <filename>syslog.h</filename>, see <citerefentry
+ project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry> for details. It is
+ recommended to use this call to submit log messages in the application locale or system locale and in UTF-8 format,
+ but no such restrictions are enforced. Note that log messages written using this function are generally not
+ expected to end in a new-line character. However, as all trailing whitespace (including spaces, new-lines,
+ tabulators and carriage returns) are automatically stripped from the logged string, it is acceptable to specify one
+ (or more). Empty lines (after trailing whitespace removal) are suppressed. On non-empty lines, leading whitespace
+ (as well as inner whitespace) is left unmodified. </para>
<para><function>sd_journal_printv()</function> is similar to
<function>sd_journal_print()</function> but takes a variable
@@ -123,35 +117,26 @@
for more information) instead of the format string. It is
otherwise equivalent in behavior.</para>
- <para><function>sd_journal_send()</function> may be used to submit
- structured log entries to the system journal. It takes a series of
- format strings, each immediately followed by their associated
- parameters, terminated by <constant>NULL</constant>. The strings
- passed should be of the format <literal>VARIABLE=value</literal>.
- The variable name must be in uppercase and consist only of
- characters, numbers and underscores, and may not begin with an
- underscore. (All assignments that do not follow this syntax will
- be ignored.) The value can be of any size and format. It is highly
- recommended to submit text strings formatted in the UTF-8
- character encoding only, and submit binary fields only when
- formatting in UTF-8 strings is not sensible. A number of
- well-known fields are defined, see
- <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>
- for details, but additional application defined fields may be
- used. A variable may be assigned more than one value per
- entry.</para>
-
- <para><function>sd_journal_sendv()</function> is similar to
- <function>sd_journal_send()</function> but takes an array of
- <varname>struct iovec</varname> (as defined in
- <filename>uio.h</filename>, see
- <citerefentry project='man-pages'><refentrytitle>readv</refentrytitle><manvolnum>3</manvolnum></citerefentry>
- for details) instead of the format string. Each structure should
- reference one field of the entry to submit. The second argument
- specifies the number of structures in the array.
- <function>sd_journal_sendv()</function> is particularly useful to
- submit binary objects to the journal where that is
- necessary.</para>
+ <para><function>sd_journal_send()</function> may be used to submit structured log entries to the system journal. It
+ takes a series of format strings, each immediately followed by their associated parameters, terminated by
+ <constant>NULL</constant>. The strings passed should be of the format <literal>VARIABLE=value</literal>. The
+ variable name must be in uppercase and consist only of characters, numbers and underscores, and may not begin with
+ an underscore. (All assignments that do not follow this syntax will be ignored.) The value can be of any size and
+ format. It is highly recommended to submit text strings formatted in the UTF-8 character encoding only, and submit
+ binary fields only when formatting in UTF-8 strings is not sensible. A number of well-known fields are defined, see
+ <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry> for
+ details, but additional application defined fields may be used. A variable may be assigned more than one value per
+ entry. If this function is used, trailing whitespace is automatically removed from each formatted field.</para>
+
+ <para><function>sd_journal_sendv()</function> is similar to <function>sd_journal_send()</function> but takes an
+ array of <varname>struct iovec</varname> (as defined in <filename>uio.h</filename>, see <citerefentry
+ project='man-pages'><refentrytitle>readv</refentrytitle><manvolnum>3</manvolnum></citerefentry> for details)
+ instead of the format string. Each structure should reference one field of the entry to submit. The second argument
+ specifies the number of structures in the array. <function>sd_journal_sendv()</function> is particularly useful to
+ submit binary objects to the journal where that is necessary. Note that this function wil not strip trailing
+ whitespace of the passed fields, but passes the specified data along unmodified. This is different from both
+ <function>sd_journal_print()</function> and <function>sd_journal_send()</function> described above, which are based
+ on format strings, and do strip trailing whitespace.</para>
<para><function>sd_journal_perror()</function> is a similar to
<citerefentry project='die-net'><refentrytitle>perror</refentrytitle><manvolnum>3</manvolnum></citerefentry>
@@ -174,8 +159,8 @@
<programlisting>sd_journal_print(LOG_INFO, "Hello World, this is PID %lu!", (unsigned long) getpid());
sd_journal_send("MESSAGE=Hello World, this is PID %lu!", (unsigned long) getpid(),
- "PRIORITY=%i", LOG_INFO,
- NULL);</programlisting>
+ "PRIORITY=%i", LOG_INFO,
+ NULL);</programlisting>
<para>Note that these calls implicitly add fields for the source
file, function name and code line where invoked. This is
diff --git a/mkosi.build b/mkosi.build
index b3d757afb1..09d835d45b 100755
--- a/mkosi.build
+++ b/mkosi.build
@@ -1,4 +1,4 @@
-#!/bin/sh -x
+#!/bin/sh -ex
# This file is part of systemd.
#
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index 3afb5e0a40..e38b67405e 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -196,7 +196,7 @@ int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char *
*(k++) = (char) c;
left--;
- } else if (k > r)
+ } else if (k > r)
space = true;
}
diff --git a/src/boot/efi/console.c b/src/boot/efi/console.c
index c436f8b476..2b797c9a5f 100644
--- a/src/boot/efi/console.c
+++ b/src/boot/efi/console.c
@@ -93,12 +93,8 @@ EFI_STATUS console_key_read(UINT64 *key, BOOLEAN wait) {
}
/* wait until key is pressed */
- if (wait) {
- if (TextInputEx)
- uefi_call_wrapper(BS->WaitForEvent, 3, 1, &TextInputEx->WaitForKeyEx, &index);
- else
- uefi_call_wrapper(BS->WaitForEvent, 3, 1, &ST->ConIn->WaitForKey, &index);
- }
+ if (wait)
+ uefi_call_wrapper(BS->WaitForEvent, 3, 1, &ST->ConIn->WaitForKey, &index);
if (TextInputEx) {
EFI_KEY_DATA keydata;
diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c
index 5e8a3e3200..440fba67ca 100644
--- a/src/journal/journal-send.c
+++ b/src/journal/journal-send.c
@@ -107,6 +107,13 @@ _public_ int sd_journal_printv(int priority, const char *format, va_list ap) {
memcpy(buffer, "MESSAGE=", 8);
vsnprintf(buffer+8, sizeof(buffer) - 8, format, ap);
+ /* Strip trailing whitespace, keep prefix whitespace. */
+ (void) strstrip(buffer);
+
+ /* Suppress empty lines */
+ if (isempty(buffer+8))
+ return 0;
+
zero(iov);
IOVEC_SET_STRING(iov[0], buffer);
IOVEC_SET_STRING(iov[1], p);
@@ -158,6 +165,8 @@ _printf_(1, 0) static int fill_iovec_sprintf(const char *format, va_list ap, int
VA_FORMAT_ADVANCE(format, ap);
+ (void) strstrip(buffer); /* strip trailing whitespace, keep prefixing whitespace */
+
IOVEC_SET_STRING(iov[i++], buffer);
format = va_arg(ap, char *);
@@ -471,6 +480,13 @@ _public_ int sd_journal_printv_with_location(int priority, const char *file, con
memcpy(buffer, "MESSAGE=", 8);
vsnprintf(buffer+8, sizeof(buffer) - 8, format, ap);
+ /* Strip trailing whitespace, keep prefixing whitespace */
+ (void) strstrip(buffer);
+
+ /* Suppress empty lines */
+ if (isempty(buffer+8))
+ return 0;
+
/* func is initialized from __func__ which is not a macro, but
* a static const char[], hence cannot easily be prefixed with
* CODE_FUNC=, hence let's do it manually here. */
diff --git a/src/kernel-install/90-loaderentry.install b/src/kernel-install/90-loaderentry.install
index 4c9b1f0327..a0bca05c9a 100644
--- a/src/kernel-install/90-loaderentry.install
+++ b/src/kernel-install/90-loaderentry.install
@@ -16,7 +16,8 @@ if ! [[ $MACHINE_ID ]]; then
fi
BOOT_DIR="/$MACHINE_ID/$KERNEL_VERSION"
-LOADER_ENTRY="/boot/loader/entries/$MACHINE_ID-$KERNEL_VERSION.conf"
+BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR}
+LOADER_ENTRY="$BOOT_ROOT/loader/entries/$MACHINE_ID-$KERNEL_VERSION.conf"
if [[ $COMMAND == remove ]]; then
exec rm -f "$LOADER_ENTRY"
diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install
index 3ae1d77e33..1159dc384d 100644
--- a/src/kernel-install/kernel-install
+++ b/src/kernel-install/kernel-install
@@ -86,7 +86,15 @@ if [[ ! $COMMAND ]] || [[ ! $KERNEL_VERSION ]]; then
exit 1
fi
-BOOT_DIR_ABS="/boot/$MACHINE_ID/$KERNEL_VERSION"
+if [[ -d /boot/loader/entries ]] || [[ -d /boot/$MACHINE_ID ]]; then
+ BOOT_DIR_ABS="/boot/$MACHINE_ID/$KERNEL_VERSION"
+elif [[ -d /boot/efi/loader/entries ]] || [[ -d /boot/efi/$MACHINE_ID ]] \
+ || mountpoint -q /boot/efi; then
+ BOOT_DIR_ABS="/boot/efi/$MACHINE_ID/$KERNEL_VERSION"
+else
+ BOOT_DIR_ABS="/boot/$MACHINE_ID/$KERNEL_VERSION"
+fi
+
ret=0
readarray -t PLUGINS < <(
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index 161dd3922b..96e0ab4b8a 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -1551,7 +1551,6 @@ static int image_exists(sd_bus *bus, const char *name) {
}
static int make_service_name(const char *name, char **ret) {
- _cleanup_free_ char *e = NULL;
int r;
assert(name);
diff --git a/src/network/networkd-conf.c b/src/network/networkd-conf.c
index b67a1f6d09..c03e2b2ebf 100644
--- a/src/network/networkd-conf.c
+++ b/src/network/networkd-conf.c
@@ -70,7 +70,7 @@ int config_parse_duid_rawdata(
for (;;) {
int n1, n2, len, r;
uint32_t byte;
- _cleanup_free_ char *cbyte = NULL;
+ _cleanup_free_ char *cbyte = NULL;
r = extract_first_word(&rvalue, &cbyte, ":", 0);
if (r < 0) {
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index bedc5bf20b..e4be0a2251 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -3125,7 +3125,6 @@ static int setup_uid_map(pid_t pid) {
}
static int nspawn_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t revents, void *userdata) {
- _cleanup_fdset_free_ FDSet *fds = NULL;
char buf[NOTIFY_BUFFER_MAX+1];
char *p = NULL;
struct iovec iovec = {
diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c
index ea0be56d98..a8ad8fe342 100644
--- a/src/resolve/resolved-dns-packet.c
+++ b/src/resolve/resolved-dns-packet.c
@@ -720,7 +720,7 @@ int dns_packet_append_opt(DnsPacket *p, uint16_t max_udp_size, bool edns0_do, in
goto fail;
/* RDLENGTH */
- if (edns0_do & !DNS_PACKET_QR(p)) {
+ if (edns0_do && !DNS_PACKET_QR(p)) {
/* If DO is on and this is not a reply, also append RFC6975 Algorithm data */
static const uint8_t rfc6975[] = {
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 9351b85eed..d04728f505 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -489,7 +489,7 @@ static int output_verbose(
off = ANSI_NORMAL;
}
- if (flags & OUTPUT_SHOW_ALL ||
+ if ((flags & OUTPUT_SHOW_ALL) ||
(((length < PRINT_CHAR_THRESHOLD) || flags & OUTPUT_FULL_WIDTH)
&& utf8_is_printable(data, length))) {
fprintf(f, " %s%.*s=", on, fieldlen, (const char*)data);
@@ -607,7 +607,7 @@ void json_escape(
if (!(flags & OUTPUT_SHOW_ALL) && l >= JSON_THRESHOLD)
fputs("null", f);
- else if (!utf8_is_printable(p, l)) {
+ else if (!(flags & OUTPUT_SHOW_ALL) && !utf8_is_printable(p, l)) {
bool not_first = false;
fputs("[ ", f);
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index b575437bcb..d3f437411a 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -5606,7 +5606,7 @@ static int mangle_names(char **original_names, char ***mangled_names) {
}
static int unit_exists(const char *unit) {
- _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL, *m = NULL;
+ _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_free_ char *path = NULL;
static const struct bus_properties_map property_map[] = {
diff --git a/src/test/test-process-util.c b/src/test/test-process-util.c
index 99c92780b8..562ad4acb8 100644
--- a/src/test/test-process-util.c
+++ b/src/test/test-process-util.c
@@ -45,7 +45,7 @@
static void test_get_process_comm(pid_t pid) {
struct stat st;
- _cleanup_free_ char *a = NULL, *c = NULL, *d = NULL, *f = NULL, *i = NULL, *cwd = NULL, *root = NULL;
+ _cleanup_free_ char *a = NULL, *c = NULL, *d = NULL, *f = NULL, *i = NULL;
_cleanup_free_ char *env = NULL;
char path[strlen("/proc//comm") + DECIMAL_STR_MAX(pid_t)];
pid_t e;