Compare commits
6 Commits
a2aa4f6bff
...
73d5eb35b7
Author | SHA1 | Date |
---|---|---|
Lennart Poettering | 73d5eb35b7 | |
Luca Boccassi | 6fd3496cfd | |
Daan De Meyer | bb486fe9df | |
Daan De Meyer | 0e44a351ea | |
Lennart Poettering | 9391030e6e | |
Lennart Poettering | 302e8bbce3 |
10
mkosi.clangd
10
mkosi.clangd
|
@ -1,12 +1,18 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
|
||||||
MKOSI_CONFIG="$(mkosi --json summary | jq -r .Images[-1])"
|
if command -v flatpak-spawn >/dev/null; then
|
||||||
|
SPAWN=(flatpak-spawn --host)
|
||||||
|
else
|
||||||
|
SPAWN=()
|
||||||
|
fi
|
||||||
|
|
||||||
|
MKOSI_CONFIG="$("${SPAWN[@]}" --host mkosi --json summary | jq -r .Images[-1])"
|
||||||
DISTRIBUTION="$(jq -r .Distribution <<< "$MKOSI_CONFIG")"
|
DISTRIBUTION="$(jq -r .Distribution <<< "$MKOSI_CONFIG")"
|
||||||
RELEASE="$(jq -r .Release <<< "$MKOSI_CONFIG")"
|
RELEASE="$(jq -r .Release <<< "$MKOSI_CONFIG")"
|
||||||
ARCH="$(jq -r .Architecture <<< "$MKOSI_CONFIG")"
|
ARCH="$(jq -r .Architecture <<< "$MKOSI_CONFIG")"
|
||||||
|
|
||||||
exec mkosi \
|
exec "${SPAWN[@]}" mkosi \
|
||||||
--incremental=strict \
|
--incremental=strict \
|
||||||
--build-sources-ephemeral=no \
|
--build-sources-ephemeral=no \
|
||||||
--format=none \
|
--format=none \
|
||||||
|
|
|
@ -38,9 +38,8 @@ SignExpectedPcr=yes
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
ExtraTrees=
|
ExtraTrees=
|
||||||
|
mkosi.extra.common
|
||||||
mkosi.crt:/usr/lib/verity.d/mkosi.crt # sysext verification key
|
mkosi.crt:/usr/lib/verity.d/mkosi.crt # sysext verification key
|
||||||
mkosi.leak-sanitizer-suppressions:/usr/lib/systemd/leak-sanitizer-suppressions
|
|
||||||
mkosi.coredump-journal-storage.conf:/usr/lib/systemd/coredump.conf.d/10-coredump-journal-storage.conf
|
|
||||||
%O/minimal-0.root-%a.raw:/usr/share/minimal_0.raw
|
%O/minimal-0.root-%a.raw:/usr/share/minimal_0.raw
|
||||||
%O/minimal-0.root-%a-verity.raw:/usr/share/minimal_0.verity
|
%O/minimal-0.root-%a-verity.raw:/usr/share/minimal_0.verity
|
||||||
%O/minimal-0.root-%a-verity-sig.raw:/usr/share/minimal_0.verity.sig
|
%O/minimal-0.root-%a-verity-sig.raw:/usr/share/minimal_0.verity.sig
|
||||||
|
|
|
@ -6,9 +6,7 @@ Include=
|
||||||
%D/mkosi.sanitizers
|
%D/mkosi.sanitizers
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
ExtraTrees=
|
ExtraTrees=%D/mkosi.extra.common
|
||||||
%D/mkosi.leak-sanitizer-suppressions:/usr/lib/systemd/leak-sanitizer-suppressions
|
|
||||||
%D/mkosi.coredump-journal-storage.conf:/usr/lib/systemd/coredump.conf.d/10-coredump-journal-storage.conf
|
|
||||||
|
|
||||||
Packages=
|
Packages=
|
||||||
findutils
|
findutils
|
||||||
|
|
|
@ -732,10 +732,12 @@ char* strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]) {
|
||||||
|
|
||||||
for (const char *i = *ibuf; i < *ibuf + isz + 1; i++) {
|
for (const char *i = *ibuf; i < *ibuf + isz + 1; i++) {
|
||||||
|
|
||||||
|
bool eot = i >= *ibuf + isz;
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
|
|
||||||
case STATE_OTHER:
|
case STATE_OTHER:
|
||||||
if (i >= *ibuf + isz) /* EOT */
|
if (eot)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (*i == '\r') {
|
if (*i == '\r') {
|
||||||
|
@ -760,7 +762,7 @@ char* strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]) {
|
||||||
case STATE_ESCAPE:
|
case STATE_ESCAPE:
|
||||||
assert(n_carriage_returns == 0);
|
assert(n_carriage_returns == 0);
|
||||||
|
|
||||||
if (i >= *ibuf + isz) { /* EOT */
|
if (eot) {
|
||||||
fputc('\x1B', f);
|
fputc('\x1B', f);
|
||||||
advance_offsets(i - *ibuf, highlight, shift, 1);
|
advance_offsets(i - *ibuf, highlight, shift, 1);
|
||||||
break;
|
break;
|
||||||
|
@ -782,8 +784,7 @@ char* strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]) {
|
||||||
case STATE_CSI:
|
case STATE_CSI:
|
||||||
assert(n_carriage_returns == 0);
|
assert(n_carriage_returns == 0);
|
||||||
|
|
||||||
if (i >= *ibuf + isz || /* EOT … */
|
if (eot || !strchr("01234567890;m", *i)) { /* EOT or invalid chars in sequence */
|
||||||
!strchr("01234567890;m", *i)) { /* … or invalid chars in sequence */
|
|
||||||
fputc('\x1B', f);
|
fputc('\x1B', f);
|
||||||
fputc('[', f);
|
fputc('[', f);
|
||||||
advance_offsets(i - *ibuf, highlight, shift, 2);
|
advance_offsets(i - *ibuf, highlight, shift, 2);
|
||||||
|
@ -800,8 +801,7 @@ char* strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]) {
|
||||||
/* There are three kinds of OSC terminators: \x07, \x1b\x5c or \x9c. We only support
|
/* There are three kinds of OSC terminators: \x07, \x1b\x5c or \x9c. We only support
|
||||||
* the first two, because the last one is a valid UTF-8 codepoint and hence creates
|
* the first two, because the last one is a valid UTF-8 codepoint and hence creates
|
||||||
* an ambiguity (many Terminal emulators refuse to support it as well). */
|
* an ambiguity (many Terminal emulators refuse to support it as well). */
|
||||||
if (i >= *ibuf + isz || /* EOT … */
|
if (eot || (!IN_SET(*i, '\x07', '\x1b') && !osc_char_is_valid(*i))) { /* EOT or invalid chars in sequence */
|
||||||
(!IN_SET(*i, '\x07', '\x1b') && (uint8_t) *i < 32U) || (uint8_t) *i > 126U) { /* … or invalid chars in sequence */
|
|
||||||
fputc('\x1B', f);
|
fputc('\x1B', f);
|
||||||
fputc(']', f);
|
fputc(']', f);
|
||||||
advance_offsets(i - *ibuf, highlight, shift, 2);
|
advance_offsets(i - *ibuf, highlight, shift, 2);
|
||||||
|
@ -815,8 +815,7 @@ char* strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STATE_OSC_CLOSING:
|
case STATE_OSC_CLOSING:
|
||||||
if (i >= *ibuf + isz || /* EOT … */
|
if (eot || *i != '\x5c') { /* EOT or incomplete two-byte ST in sequence */
|
||||||
*i != '\x5c') { /* … or incomplete two-byte ST in sequence */
|
|
||||||
fputc('\x1B', f);
|
fputc('\x1B', f);
|
||||||
fputc(']', f);
|
fputc(']', f);
|
||||||
advance_offsets(i - *ibuf, highlight, shift, 2);
|
advance_offsets(i - *ibuf, highlight, shift, 2);
|
||||||
|
|
|
@ -157,3 +157,9 @@ int terminal_is_pty_fd(int fd);
|
||||||
|
|
||||||
int pty_open_peer_racefree(int fd, int mode);
|
int pty_open_peer_racefree(int fd, int mode);
|
||||||
int pty_open_peer(int fd, int mode);
|
int pty_open_peer(int fd, int mode);
|
||||||
|
|
||||||
|
static inline bool osc_char_is_valid(char c) {
|
||||||
|
/* Checks whether the specified character is safe to be included inside an ANSI OSC sequence, as per
|
||||||
|
* ECMA-48 5th edition, section 8.3.89 */
|
||||||
|
return (unsigned char) c >= 32U && (unsigned char) c < 127;
|
||||||
|
}
|
||||||
|
|
|
@ -76,6 +76,25 @@ bool urlify_enabled(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool url_suitable_for_osc8(const char *url) {
|
||||||
|
assert(url);
|
||||||
|
|
||||||
|
/* Not all URLs are safe for inclusion in OSC 8 due to charset and length restrictions. Let's detect
|
||||||
|
* which ones those are */
|
||||||
|
|
||||||
|
/* If the URL is longer than 2K let's not try to do OSC 8. As per recommendation in
|
||||||
|
* https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda#length-limits */
|
||||||
|
if (strlen(url) > 2000)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/* OSC sequences may only contain chars from the 32..126 range, as per ECMA-48 */
|
||||||
|
for (const char *c = url; *c; c++)
|
||||||
|
if (!osc_char_is_valid(*c))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int terminal_urlify(const char *url, const char *text, char **ret) {
|
int terminal_urlify(const char *url, const char *text, char **ret) {
|
||||||
char *n;
|
char *n;
|
||||||
|
|
||||||
|
@ -87,7 +106,7 @@ int terminal_urlify(const char *url, const char *text, char **ret) {
|
||||||
if (isempty(text))
|
if (isempty(text))
|
||||||
text = url;
|
text = url;
|
||||||
|
|
||||||
if (urlify_enabled())
|
if (urlify_enabled() && url_suitable_for_osc8(url))
|
||||||
n = strjoin(ANSI_OSC "8;;", url, ANSI_ST,
|
n = strjoin(ANSI_OSC "8;;", url, ANSI_ST,
|
||||||
text,
|
text,
|
||||||
ANSI_OSC "8;;" ANSI_ST);
|
ANSI_OSC "8;;" ANSI_ST);
|
||||||
|
|
|
@ -6,6 +6,14 @@ set -o pipefail
|
||||||
# shellcheck source=test/units/test-control.sh
|
# shellcheck source=test/units/test-control.sh
|
||||||
. "$(dirname "$0")"/test-control.sh
|
. "$(dirname "$0")"/test-control.sh
|
||||||
|
|
||||||
|
if systemd-detect-virt --quiet --container; then
|
||||||
|
# This comes from the selinux package and tries to write
|
||||||
|
# some files under sysfs, which will be read-only in a container,
|
||||||
|
# so mask it. It's not our tmpfiles.d file anyway.
|
||||||
|
mkdir -p /run/tmpfiles.d/
|
||||||
|
ln -s /dev/null /run/tmpfiles.d/selinux-policy.conf
|
||||||
|
fi
|
||||||
|
|
||||||
run_subtests
|
run_subtests
|
||||||
|
|
||||||
touch /testok
|
touch /testok
|
||||||
|
|
Loading…
Reference in New Issue