Commit Graph

11 Commits

Author SHA1 Message Date
Jörg Thalheim ff12a7954c treewide: more portable bash shebangs
As in 2a5fcfae02
and in 3e67e5c992
using /usr/bin/env allows bash to be looked up in PATH
rather than being hard-coded.

As with the previous changes the same arguments apply
- distributions have scripts to rewrite shebangs on installation and
  they know what locations to rely on.
- For tests/compilation we should rather rely on the user to have setup
  there PATH correctly.

In particular this makes testing from git easier on NixOS where do not provide
/bin/bash to improve compose-ability.
2020-03-05 17:27:07 +01:00
Lorenz Bauer 09d0b46ab6 journal: refresh cached credentials of stdout streams
journald assumes that getsockopt(SO_PEERCRED) correctly identifies the
process on the remote end of the socket. However, this is incorrect
according to man 7 socket:

    The returned  credentials  are  those that were in effect at the
    time of the call to connect(2) or socketpair(2).

This becomes a problem when a new process inherits the stdout stream
from a parent. First, log messages from the child process will
be attributed to the parent. Second, the struct ucred used by journald
becomes invalid as soon as the parent exits. Further sendmsg calls then
fail with ENOENT. Logs for the child process then vanish from the journal.

Fix this by using recvmsg on the stdout stream, and refreshing the cached
struct ucred if SCM_CREDENTIALS indicate a new process.

Fixes #13708
2019-11-05 10:41:03 +01:00
Zbigniew Jędrzejewski-Szmek cc5549ca12 scripts: use 4 space indentation
We had all kinds of indentation: 2 sp, 3 sp, 4 sp, 8 sp, and mixed.
4 sp was the most common, in particular the majority of scripts under test/
used that. Let's standarize on 4 sp, because many commandlines are long and
there's a lot of nesting, and with 8sp indentation less stuff fits. 4 sp
also seems to be the default indentation, so this will make it less likely
that people will mess up if they don't load the editor config. (I think people
often use vi, and vi has no support to load project-wide configuration
automatically. We distribute a .vimrc file, but it is not loaded by default,
and even the instructions in it seem to discourage its use for security
reasons.)

Also remove the few vim config lines that were left. We should either have them
on all files, or none.

Also remove some strange stuff like '#!/bin/env bash', yikes.
2019-04-12 08:30:31 +02:00
dana 4890482531 journalctl: support `-b all` to negate effect of -b
Also fix an issue where -b without argument didn't always behave as -b0
2019-03-19 10:48:26 +01:00
Lars Karlitski cc25a67e2a journalctl: add --output-fields= (#7181)
This option allows restricting the shown fields in the output modes that
would normally show all fields. It allows clients that are only
interested in a subset of the fields to access those more efficiently.
Also, it makes the resulting size of the output more predictable.

It has no effect on the various `short` output modes, because those
already only show a subset of the fields.
2017-10-27 12:10:47 +09:00
Evgeny Vereshchagin bff653e397 tests: add test that journald keeps fds over termination by signal
This test fails before previous commit, and passes with it.
2016-11-01 21:20:26 -04:00
Phillip Sz e3ceb75be3 test: remove exit 0 at the end
We don't need that at the end, as it will always exit with 0 if
everything is okey.
2016-02-05 11:38:58 +01:00
Evgeny Vereshchagin 3889613ec6 tests: add regression test for `systemctl restart systemd-journald`
See https://github.com/systemd/systemd/issues/2236
2015-12-30 05:00:14 +00:00
Evgeny Vereshchagin e8e5a6e255 tests: use sync instead of flush
flush doesn't sync a journal -> tests sometimes fail
2015-11-27 13:55:23 +00:00
Evgeny Vereshchagin 45d39b4f81 tests: journal-stdout-stream: add cases for leading and trailing spaces 2015-11-17 23:47:23 +00:00
Evgeny Vereshchagin 1c36b4a73b tests: add basic journal test 2015-11-17 23:46:31 +00:00