1
0
mirror of https://github.com/systemd/systemd synced 2024-07-09 12:36:12 +00:00
Commit Graph

373 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
090ade7ee7 licensing: add spdx header to chromiumos helper, move license file
It makes it easier to process the license automatically like other files.
The text of the license in tools/chromiumos/LICENSE matches
https://spdx.org/licenses/BSD-3-Clause.html exactly.
2021-10-01 14:45:00 +02:00
Frantisek Sumsal
f7e0d22d76 tools: shellcheck-ify tool scripts 2021-09-30 12:27:06 +02:00
Luca Boccassi
95b63c755b git-contrib: copypaste-friendly output
Format output in a manner that can be copypasted as-is to NEWS.
That is, with 8 spaces indentation and wrapped at 80 columns.

Before:

$ tools/git-contrib.sh
        Ben Stockett,
        Carl Lei,
        Frantisek Sumsal,
        Gibeom Gwon,
        Hugo Osvaldo Barrera,
        James Hilliard,
        Jan Palus,
        Lennart Poettering,
        Luca Boccassi,
        Luca BRUNO,
        Mike Gilbert,
        nassir90,
        nl6720,
        Raul Tambre,
        Yegor Alexeyev,
        Yu Watanabe,
        Zbigniew Jędrzejewski-Szmek,

After:

        Contributions from: Ben Stockett, Carl Lei, Frantisek Sumsal,
        Gibeom Gwon, Hugo Osvaldo Barrera, James Hilliard, Jan Palus,
        Lennart Poettering, Luca Boccassi, Luca BRUNO, Mike Gilbert,
        nassir90, nl6720, Raul Tambre, Yegor Alexeyev, Yu Watanabe,
        Zbigniew Jędrzejewski-Szmek
2021-07-19 15:39:26 +09:00
Zbigniew Jędrzejewski-Szmek
d080734dcb man: add "DNS resource record types" section 2021-06-29 10:44:18 +02:00
Zbigniew Jędrzejewski-Szmek
19c79550b4 tools/analyze-dump-sort: a helper to compare two 'systemd-analyze dump' outputs
Lines in the dumps are ordered by some pseudo-random hashmap entry order, which
makes it hard to diff two outputs. This sort the entries alphabetically, and
also sorts items within the entries, and supresses timestamps and other fields
which always vary.

We could sort the output inside of systemd itself, but it'd make things more
complex, and we probably don't need output to be sorted in most cases. It also
wouldn't be enough, because timestamps and such would still need to be ignored
to do a nice diff. So I think doing the sorting and suppression in a python
helper is a better approach.
2021-06-04 12:09:58 +02:00
Luca Boccassi
c5fd89adcd core: make libbpf a dlopen() dependency 2021-05-25 12:59:26 +01:00
Zbigniew Jędrzejewski-Szmek
44ff8df777 Drop dependency on m4
m4 was hugely popular in the past, because autotools, automake, flex, bison and
many other things used it. But nowadays it much less popular, and might not even
be installed in the buildroot. (m4 is small, so it doesn't make a big difference.)

(FWIW, Fedora dropped make from the buildroot now,
https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot. I think it's
reasonable to assume that m4 will be dropped at some point too.)

The main reason to drop m4 is that the syntax is not very nice, and we should
minimize the number of different syntaxes that we use. We still have two
(configure_file() with @FOO@ and jinja2 templates with {{foo}} and the
pythonesque conditional expressions), but at least we don't need m4 (with
m4_dnl and `quotes').
2021-05-19 10:24:43 +09:00
Zbigniew Jędrzejewski-Szmek
6b1aac3ccf meson: replace some m4 templates with jinja2
m4 was nice in '85, but the syntax feels a bit dated. Since we use python for
meson, let's use a popular python templating engine to replace some m4 usage.

A little nicety is that typos are caught:

FAILED: sysusers.d/systemd-remote.conf
/usr/bin/meson --internal exe --capture sysusers.d/systemd-remote.conf -- /home/zbyszek/src/systemd/tools/meson-render-jinja2.py config.h ../sysusers.d/systemd-remote.conf.j2
Traceback (most recent call last):
  File "/home/zbyszek/src/systemd/tools/meson-render-jinja2.py", line 28, in <module>
    print(render(sys.argv[2], defines))
  File "/home/zbyszek/src/systemd/tools/meson-render-jinja2.py", line 24, in render
    return template.render(defines)
  File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/usr/lib/python3.9/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 8, in top-level template code
jinja2.exceptions.UndefinedError: 'HAVE_MICROHTTP' is undefined

This checking mirrors what 349cc4a507 did for C defines.
2021-05-19 10:24:43 +09:00
Jörg Thalheim
f96bc66901 fix bash shebangs 2021-05-17 22:27:41 +01:00
Zbigniew Jędrzejewski-Szmek
b8f1045fe7 Revert "tools/make-directive-index: parallelize"
This reverts commit a2031de849.

The patch itself seems OK, but it exposes a bug in lxml or libxml2-2.9.12 which
was just released. This is being resolved in
https://gitlab.gnome.org/GNOME/libxml2/-/issues/255, but it might be while. So
let's revert this for now to unbreak our CI.

Fixes #19601.
2021-05-14 23:16:24 +01:00
Zbigniew Jędrzejewski-Szmek
a2031de849 tools/make-directive-index: parallelize
I occasionally do 'build/man/man systemd.directives' when working on man pages,
and it's annoying slow. By paralellizing the parsing of xml, we can make it a
bit faster.

This is still rather innefficient. Only the parsing part is serialized, xml is
still produced serially at the end, which is hard to avoid.

$ ninja -C build man/systemd.directives.xml
before:
8.20s user 0.21s system 99% cpu 8.460 total
8.33s user 0.18s system 98% cpu 8.619 total
8.72s user 0.19s system 98% cpu 9.019 total

after:
13.99s user 0.73s system 345% cpu 4.262 total
14.15s user 0.35s system 348% cpu 4.161 total
14.33s user 0.35s system 339% cpu 4.321 total

I.e. it uses almost twice as much cpu, but cuts the wallclock time down (on a
2-core/4-thread cpu) to about half too, which is an overall win if you're just
trying to render the man page.

The change from list and .append() to set and .add() is something that could
have been done before too, but it's noticable now. It cuts down on the
serialization/deserialization time (about .2s).
2021-05-13 11:53:01 +02:00
Julia Kartseva
cf4f9a57f2 bpf: add build script for bpf programs
Add a build script to compile bpf source code. A program in restricted
C is compiled into an object file. Object file is converted to BPF
skeleton [0] header file.
If build with custom meson build rule, the target header will reside in
build/ directory (not in source tree), e.g the path for socket_bind:
`build/src/core/bpf/socket_bind/socket-bind.skel.h`

Script runs the phases:
* clang to generate *.o from restricted C
* llvm-strip to remove useless DWARF info
* bpf skeleton generation with bpftool
These phases are logged to stderr for debug purposes.

To include BTF debug information, -g option is passed to clang.

[0] https://lwn.net/Articles/806911/
2021-04-26 16:07:41 -07:00
Frantisek Sumsal
3b6fd3c1de tools: shellcheck-ify most of the tool scripts 2021-04-20 20:11:13 +02:00
Frantisek Sumsal
34fde9f898 test: check if the unit file fuzzer corpora is up to date
This follows a similar pattern we already have in place for
networkd-related directives.
2021-04-05 14:41:05 +01:00
Zbigniew Jędrzejewski-Szmek
b242d2dec9 git-contrib: use non-breaking spaces in names
Some people have initials or abbreviated parts in the name and looks strange
when a line break occurs in the middle. Let's keep each name in one line.
2021-03-30 13:17:59 +02:00
Lennart Poettering
1ab4edae12 tools: exclude Weblate bot from "ninja git-contrib"
Bots are not people, no reason to say thanks to them and list them as
authors or contributors.
2021-03-17 16:53:14 +01:00
Zbigniew Jędrzejewski-Szmek
a3fbf67180 hwdb: update for v248
Seems to be additions and corrections as usual.
Includes an update of the chromiumos autosuspend rules.
2021-03-08 14:27:48 +01:00
Zbigniew Jędrzejewski-Szmek
64eb60b8c5 update-dbus-docs: use color in summary 2021-02-06 11:41:42 +01:00
Zbigniew Jędrzejewski-Szmek
7bd5b8614d update-dbus-docs: say "MODIFIED" not "OUTDATED"
When executed in test mode, "OUTDATED" is appropriate. But when executed
to actually update the text, after the tool executes, those pages are the
opposite, not outdated.
2021-02-06 11:41:42 +01:00
Evgeny Vereshchagin
77591e9732 oss-fuzz: show meson logs
It should help to make it more clear what causes issues like
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30140
and https://github.com/google/oss-fuzz/pull/5084
2021-02-01 22:51:43 +09:00
Anita Zhang
934d0d023e tools: make update-dbus-docs compatible with Python 3.6
668b3a42fe allowed update-dbus-docs.py to start
running on Cent OS 8 (instead of skipping). But subprocess.check_output()'s
text argument didn't exist until Python 3.7 and C8 is still running
Python 3.6. Use universal_newlines instead for backwards compatibility.
2021-02-01 11:21:10 +00:00
Luca Boccassi
668b3a42fe tools: make update-dbus-docs compatible with Python 3.7
Debian Stable uses Python 3.7, but there are a couple of 3.8 features used
in the script. Add fallbacks.
2021-01-29 09:53:34 +00:00
Zbigniew Jędrzejewski-Szmek
d3821a339e tools: rename helper to match target name
The target is update-syscall-tables, so let's call the script
update-syscall-tables.sh to reduce the cognitive overhead when
trying to find the right file.
2021-01-28 09:55:35 +01:00
Zbigniew Jędrzejewski-Szmek
1f6f8cc803 Use .txt as the extension of arch syscall lists
This makes it easier to filter those files and tells editors that they should
be treated as plain text.
2021-01-28 09:55:35 +01:00
Zbigniew Jędrzejewski-Szmek
984b529684 Use .txt as the extension for syscall list file
Upstream uses .text, but this is rather unusual. Let's use .txt as the usual
suffix for text files. This tells various editors and such that the file should
be treated as plain text. I also want to a script to summarize license status,
and having an easy-to-recognize suffix makes this easier.
2021-01-28 09:55:35 +01:00
Zbigniew Jędrzejewski-Szmek
9ee03516df tree-wide: add spdx header on all scripts and helpers
Even though many of those scripts are very simple, it is easier to include
the header than to try to say whether each of those files is trivial enough
not to require one.
2021-01-28 09:55:35 +01:00
Zbigniew Jędrzejewski-Szmek
816f31d018 meson: rename target to update-hwdb-autosuspend
The script is renamed to match.

Now all targets are named uniformly in a tab-completion-friendly fashion, with
the exception of systemd-update-po which is generated by the i18n module
automatically:

$ ninja -C build -t targets | grep update
systemd-update-po: phony
update-syscall-tables: phony
update-syscall-header: phony
update-hwdb: phony
update-hwdb-autosuspend: phony
update-dbus-docs: CUSTOM_COMMAND
update-man-rules: CUSTOM_COMMAND
2021-01-27 09:24:30 +01:00
Zbigniew Jędrzejewski-Szmek
4095cff07e meson: rename target to update-hwdb
The goal is to have all "update-*" targets named uniformly so that
tab-completion works. The script is renamed to match.
2021-01-27 09:22:15 +01:00
Zbigniew Jędrzejewski-Szmek
e3c368f63c meson: rename target to update-man-rules
Same justification as for update-dbus-docs.
2021-01-27 09:10:25 +01:00
Zbigniew Jędrzejewski-Szmek
4c890ad3cc meson: rename target to update-dbus-docs
Very old versions of meson did not include the subdirectory name in the
target name, so we started adding various "top-level" custom targets in
subdirectories. This was nice because the main meson.build file wasn't
as cluttered. But then meson started including the subdir name in the
target name. So let's move the definition to the root so we can have all
targets named uniformly.
2021-01-27 08:46:42 +01:00
Benjamin Berg
b25e76eada hwdb: Pull autosuspend rules from upstream libfprint
libfprint includes a list of known fingerprint readers that can be
autosuspended. Upstream libfprint generates this file from the USB IDs
registered to drivers and a list of well-known readers that are
currently unsupported.

Closes: #17663
2021-01-20 22:14:23 +01:00
Benjamin Berg
84171ba179 tools: Pass source directory to autosuspend-update.sh
This makes sense so that we can extend the script to also update other
files.
2021-01-19 15:05:27 +01:00
Yu Watanabe
a0e150b2f4 meson: add missing license header 2021-01-19 07:06:32 +09:00
Zbigniew Jędrzejewski-Szmek
2b5a1402f6
Merge pull request #18263 from keszybz/syscalls-auto
Generate missing syscalls headers programatically
2021-01-16 17:21:34 +01:00
Daan De Meyer
064b8e2c99 meson: Use configure_file when version-tag is specified
vcs_tag() is slow. When the version-tag meson option is set,
we can use configure_file() directly to speed up incremental
builds.

Before (with version-tag set to v247):

```
‣ Running build script...
[1/418] Generating version.h with a custom command

real    0m0.521s
user    0m0.229s
sys     0m0.067s
```

After (with version-tag set to v247):

```
‣ Running build script...
ninja: no work to do.

real    0m0.094s
user    0m0.048s
sys     0m0.022s
```
2021-01-15 19:34:44 +01:00
Zbigniew Jędrzejewski-Szmek
7975857079 tree-wide: use curl --fail
curl will save the 404 response page (or another error) if the page
download fails, which we never want. Let it error out instead.
2021-01-15 18:35:02 +01:00
Zbigniew Jędrzejewski-Szmek
9a6da617db meson: download full syscall tables from hrw/syscalls-table
The target is renamed to 'update-syscall-tables'. (Other targets
with similar names will be added later.)
2021-01-15 18:35:02 +01:00
Frantisek Sumsal
86660d160b ci: move the Coverity job to GitHub Actions 2021-01-11 15:50:25 +01:00
Daan De Meyer
09422f9a28 meson: Respect MESON_INSTALL_QUIET
MESON_INSTALL_QUIET is set when --quiet is passed to meson install.
Make sure we check the variable in our custom install scripts and
don't output anything if it is set.
2020-12-06 22:11:11 +00:00
Zbigniew Jędrzejewski-Szmek
fe7576e345 hwdb: update chromiumos autosuspend rules 2020-11-26 13:54:37 +01:00
Yu Watanabe
45752a2495 tools: drop unnecessary "else" after for loop 2020-11-20 19:47:11 +09:00
Lennart Poettering
53eedd5011 git-contrib: exclude -rc tags 2020-11-10 14:12:27 +01:00
Yu Watanabe
db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Zbigniew Jędrzejewski-Szmek
3a7771c9c4 Partially revert "hwdb: add trailing ":*" everywhere"
This reverts commit c0443b97b7.

I got various cases wrong:
"usb:v04F3p2B7Cd5912dc00dsc00dp00ic03isc00ip00in00"
"usb:v0627p0001:QEMU USB Tablet"
"input:b0003v0627p0001e0001-e0,1,2,4,k110,111,112,r0,1,8,B,am4,lsfw"

OTOH:
-evdev:name:ETPS/2 Elantech Touchpad:dmi:*svnASUSTeKComputerInc.:pnN53SV:*
+evdev:name:ETPS/2 Elantech Touchpad:dmi:*svnASUSTeKComputerInc.:pnN53SV*
is OK. Other parts follow after 'pn'.

-mouse:*:name:*Trackball*:*
-mouse:*:name:*trackball*:*
-mouse:*:name:*TrackBall*:*
+mouse:*:name:*Trackball*:
+mouse:*:name:*trackball*:
+mouse:*:name:*TrackBall*:
... and anything else with :name should be OK too, because our imports always
include ":" at the end:
IMPORT{builtin}="hwdb 'joystick:$env{ID_BUS}:v$attr{id/vendor}p$attr{id/product}:name:$attr{name}:'"
Including '*' at the end makes the pattern work even if we decide to add
something to the match string later.

Fixes #17499.
2020-11-03 14:17:53 +01:00
Zbigniew Jędrzejewski-Szmek
c0443b97b7 hwdb: add trailing ":*" everywhere
No functional change is intended.
The general pattern of changes:

-usb:v04F3p2B7C*
+usb:v04F3p2B7C:*
This is mostly a clarification, to make the part that makes the usb vXXXXpYYYY
part visually separated. It would only make a difference if we added further
keys with a different number of digits, which is unlikely.

-usb:v0627p0001:*QEMU USB Keyboard*
-usb:v0627p0001:*QEMU USB Mouse*
-usb:v0627p0001:*QEMU USB Tablet*
+usb:v0627p0001:*QEMU USB Keyboard*:*
+usb:v0627p0001:*QEMU USB Mouse*:*
+usb:v0627p0001:*QEMU USB Tablet*:*
Again, only a clarification. We know that ":" will appear somewhere later in
the match key, so anything that matches "…Keyboard*" will also match "…Keyboard*:*".

-evdev:name:ETPS/2 Elantech Touchpad:dmi:*svnASUSTeKComputerInc.:pnN53SV*
+evdev:name:ETPS/2 Elantech Touchpad:dmi:*svnASUSTeKComputerInc.:pnN53SV:*
This makes the match narrower. Previously we would match product "N53SV"
and "N53SV2", "N53SV3", and others. Here we are saying that the ':pn' part must
match exactly. Most of the changes in this patch match this pattern. I made a few
judgement calls and used "pn…*:*" when I wasn't sure if the full pn is included:
-evdev:name:Dell WMI hotkeys:dmi:bvn*:bvr*:bd*:svnDell*:pnPrecision*
+evdev:name:Dell WMI hotkeys:dmi:bvn*:bvr*:bd*:svnDell*:pnPrecision*:*

-evdev:name:Cypress APA Trackpad ?cyapa?:dmi:*:svnHewlett-Packard*:pnFalco*:
+evdev:name:Cypress APA Trackpad ?cyapa?:dmi:*:svnHewlett-Packard*:pnFalco*:*
This more like the "QEMU" example above, since all dmi strings end in ":", so
anything which matches the old version will also match the new version.

-evdev:atkbd:dmi:bvn*:bvr*:bd*:svnGateway*:pnA0A1*:pvr*
+evdev:atkbd:dmi:bvn*:bvr*:bd*:svnGateway*:pnA0A1*:*

I replaced trailing ":pvr*" by ":*". This makes no functional difference because
we expect "pvr" to always appear in the dmi string. This makes patterns shorter.

-evdev:atkbd:dmi:bvn*:bvr*:bd*:svnAcer*:pn*
+evdev:atkbd:dmi:bvn*:bvr*:bd*:svnAcer*:pn*:*

OTOH, ":pn*" is kept. This is because almost patterns include ":pn*", and if we
skip it, we should make it clear that this is on purpose, that we really want to
match any product name.

The python script to generate autosuspend rules is updated to use ":*" too.

Inspired by https://github.com/systemd/systemd/pull/17281#discussion_r501489750.
2020-10-15 18:01:32 +02:00
Zbigniew Jędrzejewski-Szmek
cc17fa8511 hwdb: update chromiumos autosuspend rules 2020-10-15 13:29:01 +02:00
Zbigniew Jędrzejewski-Szmek
198fda4f48 update-dbus-docs: skip test if python is too old 2020-09-20 13:15:44 +02:00
Zbigniew Jędrzejewski-Szmek
8aaf611b9a update-dbus-docs: skip test lxml is not available 2020-09-18 18:51:42 +02:00
Zbigniew Jędrzejewski-Szmek
c91e3116f4 update-dbus-docs: add hint 2020-08-27 21:30:23 +02:00
Zbigniew Jędrzejewski-Szmek
04aa6fa8cd update-dbus-docs: omit verbose output when in --test mode
It makes the ninja output listing very long for no good purpose.
2020-08-27 21:30:23 +02:00
Zbigniew Jędrzejewski-Szmek
1b584f38a8 update-dbus-docs: add test mode 2020-08-27 20:22:52 +02:00
Zbigniew Jędrzejewski-Szmek
0f5cea0212 update-dbus-docs: use argparse 2020-08-27 20:22:52 +02:00
Zbigniew Jędrzejewski-Szmek
af4c7dc269 update-dbus-docs: print statistics at the end
Right now:
org.freedesktop.LogControl1.xml: 3/3
org.freedesktop.home1.xml:       44/44
org.freedesktop.hostname1.xml:   21/21
org.freedesktop.import1.xml:     17/19
org.freedesktop.locale1.xml:     10/10
org.freedesktop.login1.xml:      172/172
org.freedesktop.machine1.xml:    49/65
org.freedesktop.resolve1.xml:    25/61
org.freedesktop.systemd1.xml:    214/1468
org.freedesktop.timedate1.xml:   12/12
total:                           567/1875

:(
2020-08-27 20:22:40 +02:00
Zbigniew Jędrzejewski-Szmek
47354b440e meson: add syscall-names-update target
The calls to find_program("tools/*") are moved earlier so they can be used
in libshared/ (and it doesn't make sense to split them).
2020-08-19 15:30:24 +02:00
Haochen Tong
f331733645 tools/make-man-index: fix purpose text that contains tags 2020-08-17 18:32:51 +02:00
Zbigniew Jędrzejewski-Szmek
19b4864346 hwdb/autosuspend: add missing parenthesis 2020-07-16 18:06:35 +02:00
Zbigniew Jędrzejewski-Szmek
9c70fc2164 git-contrib: simplify implementation a bit 2020-07-08 17:31:43 +02:00
Luca Boccassi
87d25bdead make-autosuspend-rules: restore compatibility with Python3 < 3.6
The f'...' format was introduced in Python 3.6 ( https://www.python.org/dev/peps/pep-0498/ )
and returns an error when systemd is built on a system with an older Python3 version:

<...>
  File /home/bluca/git/systemd/tools/make-autosuspend-rules.py, line 15
    print(f'pci:v{vendor:08X}d{device:08X}*')
                                           ^
SyntaxError: invalid syntax
[2/388] Generating version.h with a custom command.
ninja: build stopped: subcommand failed.
$ python3 --version
Python 3.5.6

Use an older format to keep backward compatibility.
2020-06-23 21:02:15 +02:00
Lennart Poettering
c2c193f79a
Merge pull request #16179 from keszybz/auto-suspend-hwdb
Convert autosuspend rules to hwdb
2020-06-22 17:38:42 +02:00
Zbigniew Jędrzejewski-Szmek
7b33ff7388 make-autosuspend-rules: remove one instance of "whitelist"
Let's be clear what we mean exactly. Also see https://lwn.net/Articles/823224/
for general justification.
2020-06-22 14:47:49 +02:00
Zbigniew Jędrzejewski-Szmek
79dc5d35dd tools: rewrite make-autosuspend-rules.py and add udev rules
Concatenating strings is not a very efficient approach. And in this case fully
unnecessary. We also need some rules to make use of those hwdb entries.

PCI needs to be 8 characters, not 4. And we need to use uppercase hexadecimal
for both. With udev rules this made no difference, but hwdb match is case
sensitive.

Fixes #16119.
2020-06-22 14:45:20 +02:00
Lennart Poettering
b4564641be hwdb: generate a hwdb file instead of rules for autosuspend 2020-06-13 20:00:23 +02:00
Zbigniew Jędrzejewski-Szmek
4f0ef40deb man: drop obsolete HAVE_PYTHON conditional
It stopped making sense when automake support was dropped and python started
being required to perform a build.
Follow-up for 72cdb3e783.
2020-06-13 17:31:59 +02:00
Zbigniew Jędrzejewski-Szmek
a2095c0698 update-man-rules: properly filter out directives index again
When directives-template.xml was created in 282230882c,
this generator started picking it up. Let's filter it out properly again,
and also simply the filter while at it.
2020-06-13 17:31:59 +02:00
Zbigniew Jędrzejewski-Szmek
ea806175cd gdb: make output a bit nicer
Now: set, 0x7f19be8f7c20 <string_hash_ops>, False, 1, 1, 4, unit_new, src/core/unit.c:96
2020-05-30 11:40:53 +02:00
Zbigniew Jędrzejewski-Szmek
3aff6c7917 gdb: update accessors for bucket counts and entry sizes
Afaict, this code never worked, since even when this code was added in
2ea8c08306, neither all_entry_sizes nor
all_direct_buckets were defined.
2020-05-30 11:40:53 +02:00
Zbigniew Jędrzejewski-Szmek
31ca609f8a gdb: drop python2 support 2020-05-30 11:40:53 +02:00
Zbigniew Jędrzejewski-Szmek
c544fc319c tools/gdb: decrese indentation to 4 spaces
This follows PEP 8 and matces other python code in systemd.
2020-05-30 11:24:58 +02:00
Evgeny Vereshchagin
1f034000a5 oss-fuzz: turn on the pointer-overflow check
It's off by default on OSS-Fuzz but it should be safe to turn it on
manually: https://github.com/google/oss-fuzz/issues/659#issuecomment-631897889

Just a follow-up to https://github.com/systemd/systemd/pull/15865.
2020-05-21 08:52:18 +02:00
Zbigniew Jędrzejewski-Szmek
6dbf40256b man: put all pages which mention a specifier in the index
I wasn't 100% convinced that this is the right thing to do, hence the separate
commit. But e.g. for paths we index all mentions, so I think it's reasonable to
do the same here.
2020-05-07 16:30:10 +02:00
Zbigniew Jędrzejewski-Szmek
0d525a3e93 man: add specifiers section to directives index
The hack with getparent().txt is not very pretty, but the whole
thing seems to work well enough. It is useful to figure out whihc
specifiers are supported where.
2020-05-07 14:59:24 +02:00
Zbigniew Jędrzejewski-Szmek
282230882c tools: move directive index template to separate file
In the beginning, it was rather short, and reasonable to include inline.
Now it is long and unwieldy, let's split it out.

While at it, let's reindent and wrap using our current standards.
2020-05-07 14:40:10 +02:00
Zbigniew Jędrzejewski-Szmek
06689b8d11 meson: rename make-man-rules.py to update-man-rules.py
The name of the helper didn't match the name of the meson target, which was
always confusing me. With this change, we consistenly use "update" to
re-generate things which we otherwise keep in vc, and "make" for things
which are generated during each build.
2020-05-07 14:01:09 +02:00
Zbigniew Jędrzejewski-Szmek
dd1e33c8dc meson: drop "meson-" prefix from various helper script filenames
In a few cases, the prefix was originally necessary because a different helper
script was used for automake, and a different one for meson. But now we use
meson exclusively, and the prefix isn't useful. This also synchronizes the
target name, file name, and variable name in meson.build. The targets exposed
by meson didn't have the prefix, so the user interface is unchanged.

(The prefix is retained in the few tools that are used for meson itself,
e.g. meosn-vcs-tag.sh, meson-make-symlink.sh, etc.)
2020-05-07 13:57:48 +02:00
Zbigniew Jędrzejewski-Szmek
c351d568c3 update-dbus-docs: use executables in build/ 2020-05-05 22:41:23 +02:00
Frantisek Sumsal
86b52a3958 tree-wide: fix spelling errors
Based on a report from Fossies.org using Codespell.

Followup to #15436
2020-04-21 23:21:08 +02:00
Lennart Poettering
ede32a7cff
Merge pull request #15505 from keszybz/man-sd-hwdb-sd-journal
Document remaining sd-journal and sd-hwdb functions
2020-04-21 13:37:55 +02:00
Zbigniew Jędrzejewski-Szmek
622018c5b4 check-api-docs: sd_journal_open_container is deprecated 2020-04-21 09:08:14 +02:00
Jérémy Rosen
f92c8d1c67 update-dbus-docs: automatically add variablelist for introspected items
Add a <variablelist/> tag after every programlisting we auto-generate that
will be read by make-directive-index to cross-reference all dbus elements.
2020-04-20 21:03:03 +02:00
Jérémy Rosen
8906e26278 make-directive-index: allow variablelist to specify an element to index
This commit looks for a new "extra-ref" attribute in <variablelist>
If this attribute is specified, its content will be index as pointing to
the current man-page in systemd.directives
2020-04-20 18:49:58 +02:00
Jérémy Rosen
acbfdec33e make-directive-index: allow pages to specify the path to search
So far, make-directive-index would look for
./valistentry/term/varname for elements to add to the directive man page.

This commit allows to specify xpath= in the varlist directive to tell
the generator what to look for.
2020-04-20 18:49:58 +02:00
Lennart Poettering
09f8722801
Merge pull request #15396 from keszybz/dbus-api-docs
D-bus API docs
2020-04-17 23:40:50 +02:00
Zbigniew Jędrzejewski-Szmek
8f8cc84ba4 sd-login: get rid of seat_can_multi_session()
Follow-up for fa2cf64a91.
Backwards-compat is retained. A short note is added in docs, in case
people see sd_seat_can_multi_session() mentioned somewhere and wonder what
happened to it.

Also see https://github.com/systemd/systemd/pull/15337#issuecomment-610369404.
2020-04-17 16:15:30 +02:00
Zbigniew Jędrzejewski-Szmek
08fe1b6cdc update-dbus-docs: add support for settings printing just one selected interface
So far the units there were being documented had only one custom interface.
But for the pid1 case, something more flexibile is needed. So let's add
an annotation in the page what we want to print, and filter in the generator.
2020-04-16 19:46:40 +02:00
Zbigniew Jędrzejewski-Szmek
e5dd26cc20 Add updater for dbus introspection in man pages
Compares to gdbus output, the values of properties are replaced by ellipses.
For arrays and strings, the outer markers are kept. This is obviously also told
by the type string, but it seems a bit easier to read this way.

For any elements which are undocumented, a comment is inserted in sources.
"Undocumented" means that the expected element was not found. This might
require some adjustments if I missed some markup types.

Invocation is manual:
$ tools/update-dbus-docs.py tools/update-dbus-docs.py man/org.freedesktop.login1.xml
$ tools/update-dbus-docs.py tools/update-dbus-docs.py man/org.freedesktop.resolve1.xml
$ tools/update-dbus-docs.py tools/update-dbus-docs.py man/org.freedesktop.systemd1.xml
...

If some object is not found on the bus, the existing output is retained. So the
user needs to make sure that the appropriate objects have been instantiated
before calling this. We don't change the dbus interface very often, so I think
this manual mode is OK as a starting point. Making this fully automatic later
would be nice of course.
2020-04-16 19:46:40 +02:00
Daan De Meyer
eb74579d09 meson: Exclude more deprecated functions from check-api-docs 2020-04-11 21:08:34 +02:00
Frantisek Sumsal
15529f5cea
Merge pull request #14338 from keszybz/functional-test-rework
Functional test rework
2020-03-30 16:25:12 +02:00
Zbigniew Jędrzejewski-Szmek
c84752398b test: move TEST-08-ISSUE-2730 setup to static files and meson scripts
Unfortunately meson does not install symlinks, but copies the symlink
destination instead. So symlinks need to be created by a script.
This commit adds both symlinks in test/testsuite-08.units/ and meson
scriptlet calls. Strictly speaking, the first is not necessary, since nothing
reads stuff directly from the source tree.
2020-03-28 11:46:47 +01:00
Zbigniew Jędrzejewski-Szmek
cc3d85eb97 sd-bus: mark sd_bus_try_close() as deprecated
codesearch.debian.net shows no uses (except for the definition in systemd and
elogind).

$ cat > test.c

int main() {
  sd_bus_try_close(NULL);
  return 0;
}
$ gcc -Isrc/systemd -Wall -o testbus test.c -lsystemd
test.c: In function ‘main’:
test.c:4:3: warning: ‘sd_bus_try_close’ is deprecated [-Wdeprecated-declarations]
    4 |   sd_bus_try_close(NULL);
      |   ^~~~~~~~~~~~~~~~
In file included from test.c:1:
src/systemd/sd-bus.h:180:5: note: declared here
  180 | int sd_bus_try_close(sd_bus *bus) _sd_deprecated_; /* deprecated */
      |     ^~~~~~~~~~~~~~~~
2020-03-18 19:57:44 +01:00
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
Mario Limonciello
6e55b9b758 chromiumos: sync auto suspend rules with chromeos commit e348a229bacc3
Enables autosuspend for the following:
    - Microchip (Composite HID + CDC)
    - i915
    - proc_thermal
    - xchi_hdc
    - snd_hda
    - pcieport
    - lpc_ich
    - iosf_mbi_pci
    - Realtek RTL8822C BT
2020-02-07 13:22:05 +09:00
Frantisek Sumsal
a3e42c468f test: unpin meson from v0.52.1
The compatibility issue in meson v0.53 has been fixed in v0.53.1, which
is already available through pip, so let's remove the pin for meson
introduced before.

Reverts: 514793658c
2020-01-25 23:14:35 +03:00
Frantisek Sumsal
514793658c test: pin meson to 0.52.1 for fuzzit/fuzzbuzz
Latest meson doesn't work with older python 3.5, which is present on
Ubuntu 16.04. Let's pin in to the latest working version (0.52.1) until
we properly bump all necessary Ubuntu images to 18.04.

See: https://github.com/mesonbuild/meson/issues/6427
2020-01-08 13:56:30 +03:00
Zbigniew Jędrzejewski-Szmek
8c6c56c36f man: sort options without "=" in the directives index
Some options would appear twice in the index, e.g. --collect= and
--collect. Some man pages use one form, some the other, and the argument
might be mandatory for some commands but not others. Anyway, let's display
them as one entry, to reduce the total number of items listed.
2019-11-21 22:06:30 +01:00
Zbigniew Jędrzejewski-Szmek
f8b68539d0 man: fix a few bogus entries in directives index
When wrong element types are used, directives are sometimes placed in the wrong
section. Also, strip part of text starting with "'", which is used in a few
places and which is displayed improperly in the index.
2019-11-21 22:06:30 +01:00
Zbigniew Jędrzejewski-Szmek
b0343f8c96 man: change noindex="true" to index="false"
We nowadays prefer positive options over negative.
2019-11-21 22:03:57 +01:00
Zbigniew Jędrzejewski-Szmek
62d3999518 meson: add target to update the chromiumos rules
There is no change in the file right now, but the download seems to work
OK.

It's funny that the biggest company in the world cannot provide a
download link in plain text.
2019-11-15 11:36:59 +01:00
Evgeny Vereshchagin
738606e452 coverity: replace python with jq
Judging by https://travis-ci.org/systemd/systemd/jobs/604425785
(where the script failed with "tools/coverity.sh: line 45: python: command not found")
python-unversioned-command is no longer installed by default with python2.
Given that it's not the first time python has vanished and it's not clear
what exactly should be installed to make sure it's there, let's just use jq instead.
2019-10-30 09:17:04 +01:00
Tim Teichmann
0490b44031 trivial: rename chromeos to chromiumos 2019-10-07 08:58:13 +09:00
Mario Limonciello
f10bb2ce03 trivial: update tools/chromeos/gen_autosuspend_rules.py
Adds CNP PCH xHCI device PCIID to udev rules
2019-10-05 15:52:53 +02:00
Tim Teichmann
13cd6f0b98 Add missing license file and information for tools/chromeos/gen_autosuspend_rules.py (#13729)
The license file for the python script that was commited with b61d777abe was missing. The license was copied from https://chromium.googlesource.com/chromiumos/platform2/+/master/LICENSE.
2019-10-05 15:52:37 +02:00
Mario Limonciello
b61d777abe rules: Add automatic suspend udev rules
The ChromeOS ecosystem has a large amount of testing, both automated
and manual across devices including measurement of power regressions.

It's safe to assume that any of these devices will handle USB
auto-suspend appropriately.  Use the script from ChromeOS
https://chromium.googlesource.com/chromiumos/platform2/+/master/power_manager/udev/gen_autosuspend_rules.py
to generate udev rules at build time.

This script in systemd `tools/chromeos/gen_autosuspend_rules.py` should be kept
in sync with the ChromeOS version of the script.

Manually added autosuspend devices should be placed in the new
template `rules/61-autosuspend-manual.rules`

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
2019-10-04 08:57:29 +02:00
Evgeny Vereshchagin
2dd9b65778 oss-fuzz.sh: stop downloading the skia seed corpus
When the fuzz target was integrated, it was added as a stopgap
to get fuzz-json up and running. It served its purpose and can
safely be removed to prevent tools/oss-fuzz.sh from failing with
```
+wget -O /home/travis/build/systemd/systemd/out/fuzz-json_seed_corpus.zip https://storage.googleapis.com/skia-fuzzer/oss-fuzz/skjson_seed_corpus.zip
--2019-09-10 22:40:44--  https://storage.googleapis.com/skia-fuzzer/oss-fuzz/skjson_seed_corpus.zip
Resolving storage.googleapis.com (storage.googleapis.com)... 74.125.70.128, 2607:f8b0:4001:c05::80
Connecting to storage.googleapis.com (storage.googleapis.com)|74.125.70.128|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2019-09-10 22:40:44 ERROR 403: Forbidden.
```

Ideally we should put our seed corpus somewhere and download it from there
but I haven't got round to it.
2019-09-11 03:24:29 +03:00
Zbigniew Jędrzejewski-Szmek
cdfa3f0c76 meson: catch programs which ignore arguments
Don't try to use <<<. It seems to not work properly with old bash
versions or something.
2019-07-22 14:08:37 +02:00
Zbigniew Jędrzejewski-Szmek
34d2f9204c meson: update hint in man/rules/ 2019-07-19 07:09:34 +09:00
Yu Watanabe
d7c5b3ec3e
Merge pull request #12510 from keszybz/test-directives
test: run check-directives.sh as part of the test suite
2019-05-21 08:35:10 +09:00
Joe Lin
88e94c3810 meson-vcs-tag: enhance version info generation
When build from release tarball and where there is parent .git dir,
this situtaion will get wrong version info. (build with buildroot)

The systemd running show wrong version in dmesg log:
systemd[1]: systemd 2019.02-1086-gf5f17c4 running in system mode.
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Shoule be:
systemd[1]: systemd 241 running in system mode. (-PAM -AUDIT -SEL
            ^^^^^^^^^^^
2019-05-21 07:53:40 +09:00
Zbigniew Jędrzejewski-Szmek
c6448ee39e test: run check-directives.sh as part of the test suite 2019-05-20 15:44:31 +02:00
Evgeny Vereshchagin
9c5c4677fa fuzzers: use -fsanitizer=fuzzer if clang supports it
Closes https://github.com/systemd/systemd/issues/10645
2019-05-14 13:42:17 +02:00
Zbigniew Jędrzejewski-Szmek
291539b75e check-directives: use diff to show what the differences really are
This also makes the comparison more detailed, since we check spelling,
including case.
2019-05-08 06:52:58 +05:30
Ben Boeckel
5238e95759 codespell: fix spelling errors 2019-04-29 16:47:18 +02: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
Paul Menzel
55a37d7117 Update UEFI URLs (#12260)
* Use more secure https://www.uefi.org

http://www.uefi.org directs to https://uefi.org/, so this saves one
redirect.

    $ curl -I http://www.uefi.org
    HTTP/1.1 302 Found
    Server: nginx
    Date: Tue, 09 Apr 2019 14:54:46 GMT
    Content-Type: text/html; charset=iso-8859-1
    Connection: keep-alive
    X-Content-Type-Options: nosniff
    Location: https://uefi.org/
    Cache-Control: max-age=1209600
    Expires: Tue, 23 Apr 2019 14:54:46 GMT

Run the command below to update all occurrences.

    git grep -l http://www.uefi.org | xargs sed -i 's,http://www.uefi.org,https://www.uefi.org,'

* Use https://uefi.org to save redirect

Save one redirect by using the target location.

    $ curl -I https://www.uefi.org
    HTTP/1.1 301 Moved Permanently
    Server: nginx
    Date: Tue, 09 Apr 2019 14:55:42 GMT
    Content-Type: text/html; charset=iso-8859-1
    Connection: keep-alive
    X-Content-Type-Options: nosniff
    Location: https://uefi.org/
    Cache-Control: max-age=1209600
    Expires: Tue, 23 Apr 2019 14:55:42 GMT

Run the command below to update all occurrences.

    git grep -l https://www.uefi.org | xargs sed -i 's,https://www.uefi.org,https://uefi.org,'
2019-04-09 18:37:46 +02:00
Yu Watanabe
051f39c227 tools: check all directives even if it detects non-updated files 2019-02-25 12:41:11 +09:00
Yu Watanabe
810d43a8e8 tools: update check-directives.sh to support fuzz-link-parser 2019-02-25 12:41:11 +09:00
Zbigniew Jędrzejewski-Szmek
bc61c2b1c7 man: add a new section for EFI variables
We should probably refer to them from other man pages
for programs which use them, since right now all refs are
in systemd-boot(7). But creating the section is a good step
anyway.
2019-02-13 11:17:41 +01:00
Zbigniew Jędrzejewski-Szmek
37dac218b4 man: add a new directives section for .nspawn
They is quite a bit of those directives and they were in "MISCELLANEOUS" because
they don't quite fit anywhere. When the OCI-compat stuff is merged, there'll
be even more, so let's make a separate section for them.
2019-02-13 11:17:41 +01:00
Zbigniew Jędrzejewski-Szmek
d2acdcc646 man: move all config file options to one section
We had "SYSTEM MANAGER DIRECTIVES" which was a misnomer already, because
it also listed user manager stuff. Let's make this a more general section
and move the items for other services there too (from "MISCELANENOUS").
2019-02-13 11:17:41 +01:00
Zbigniew Jędrzejewski-Szmek
833fc9802c man: move os-release, machine-info, vconsole.conf vars to envvar section
Strictly speaking, those are not environment variables, but they are compatible
and people think about them like this. Moving them makes them easier to find.
2019-02-13 11:17:41 +01:00
Jörg Thalheim
990bb60a6f tools/choose-default-locale.sh: set shebang to /bin/sh
The script does not use any bash features.
On NixOS we have /bin/sh and /usr/bin/env for posix compatibility
but not /bin/bash as it is stored in our nix store.
With this change one can run the `meson configure` without patching
which greatly helps, when working on upstream contributions.
2019-01-17 18:06:16 +01:00
Zbigniew Jędrzejewski-Szmek
d27d60b3bc
Merge pull request #11317 from filbranden/docs1
Improvements to systemd.io generation
2019-01-03 18:38:57 +01:00
Yu Watanabe
a92f2af28a
Merge pull request #11230 from keszybz/version-string-alt
Generate version string from git describe (alternative approach)
2019-01-03 21:33:55 +09:00
Filipe Brandenburger
357211a426 docs: generate index.md in Jekyll
This uses a {% for %} loop in Jekyll to render the page, from the "title"
information in the Front Matter of the actual page files.

This also makes `make-index-md` build rule unnecessary, since generation is
done by the template engine itself.

Tested this by running Jekyll locally.
2019-01-02 14:23:18 -08:00
Yu Watanabe
03475e2232 meson: check whether C.UTF-8 exists or not and use it if exists
If C.UTF-8 does not exist, then fallback to en_US.UTF-8 or C.
2019-01-02 03:41:36 +09:00
Zbigniew Jędrzejewski-Szmek
dcb905b61b meson: use /bin/bash for script
It seems -o pipefail does not work on Ubunut. /bin/sh is most likely resolved
to dash.
2018-12-21 13:43:20 +01:00
Zbigniew Jędrzejewski-Szmek
e1ca734edd meson: allow setting the version string during configuration
This will be useful when building distro packages, because we can set the
version string to the rpm/dpkg/whatever version string, and getter reports
from end users.
2018-12-21 13:43:20 +01:00
Zbigniew Jędrzejewski-Szmek
e4d5753bd0 meson-vcs-tag: add work-around for git bug 2018-12-21 13:43:20 +01:00
Zbigniew Jędrzejewski-Szmek
681bd2c524 meson: generate version tag from git
$ build/systemctl --version
systemd 239-3555-g6178cbb5b5
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid
$ git tag v240 -m 'v240'
$ ninja -C build
ninja: Entering directory `build'
[76/76] Linking target fuzz-unit-file.
$ build/systemctl --version
systemd 240
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid

This is very useful during development, because a precise version string is
embedded in the build product and displayed during boot, so we don't have to
guess answers for questions like "did I just boot the latest version or the one
from before?".

This change creates an overhead for "noop" builds. On my laptop, 'ninja -C
build' that does nothing goes from 0.1 to 0.5 s. It would be nice to avoid
this, but I think that <1 s is still acceptable.

Fixes #7183.

PACKAGE_VERSION is renamed to GIT_VERSION, to make it obvious that this is the
more dynamically changing version string.

Why save to a file? It would be easy to generate the version tag using
run_command(), but we want to go through a file so that stuff gets rebuilt when
this file changes. If we just defined an variable in meson, ninja wouldn't know
it needs to rebuild things.
2018-12-21 13:43:20 +01:00
Yu Watanabe
d8a0bcfd77 tree-wide: drop header for emacs from python scripts 2018-12-10 03:17:33 +09:00
Yu Watanabe
87421ff560 tools: add one more SPDX license header 2018-12-10 03:08:52 +09:00
Yu Watanabe
2f6c9b6f3f tools: drop unused variable 2018-12-10 03:07:08 +09:00
Lennart Poettering
f7db73528f docs: work around GitHub pages weirdness
Fixes: #10546
2018-11-29 19:09:09 +01:00
Yu Watanabe
50ae773f85
Merge pull request #10970 from yuwata/from-name-return-negative-errno
util: make *_from_name() returns negative errno on error
2018-11-29 03:18:03 +09:00
Yu Watanabe
6ec439fd4b tools: move generate-gperfs.py to tools/ 2018-11-28 20:19:41 +09:00
Evgeny Vereshchagin
a2ab58da1a travis: make sure that *.perf and directives.* files are in sync
New features are constantly added to networkd. Apparently, not everybody
knows that the "directives" files should be updated too to make
the fuzzers aware of them.
2018-11-28 05:12:58 +01:00
Lennart Poettering
6fdc4831bb docs: tweak index.md generation and run it again 2018-11-16 17:44:27 +01:00
Evgeny Vereshchagin
3ff074bd85 oss-fuzz.sh: copy dictionaries along with "options" files
We currently don't have any upstream but it doesn't mean that
it should be impossible to experiment with local ones :-)
2018-11-06 19:55:11 +01:00
Evgeny Vereshchagin
6315d12bba tests: add a fuzzer for the json parser and dumper 2018-10-10 10:13:30 +02:00
Yu Watanabe
f6d783ac3d meson: use same compilers to build fuzzers 2018-10-09 11:54:10 +02:00
Lennart Poettering
c3281539da
Merge pull request #10246 from keszybz/fuzz-buss
Bus fuzzer
2018-10-02 15:45:21 +02:00
Lennart Poettering
0bc7a22d93 docs: add a simple, auto-generated index.md
This is useful for the github pages feature
2018-10-02 10:43:54 +02:00
Zbigniew Jędrzejewski-Szmek
93b575b266 fuzz: rename "fuzz-corpus" directory to just "fuzz"
Also, all corpus subdirectories are named exactly the same as the fuzzer they
are for. This makes the paths a bit longer, but easier.
2018-10-02 09:41:25 +02:00
Lucas Werkmeister
e12f397683 tools: use print function in Python 3 code
This GDB script was converted to use Python 3 along with all other
Python scripts in commit b95f5528cc, but still used the Python 2 print
statement syntax instead of the Python 3 print function. Fix that.

We also add the Python 2 compatibility statement, just in case some GDB
still uses Python 2 instead of Python 3.
2018-08-27 14:22:32 +02:00
Evgeny Vereshchagin
7cd98cc495 oss-fuzz.sh: just install the shared library
The workaround is no longer necessary, because the scripts
checking fuzzers have stopped going down to the subdirectories
of $OUT and started to look for the string "LLVMFuzzerTestOneInput"
to tell fuzzers and random binaries apart. Some more details can be
found at https://github.com/google/oss-fuzz/issues/1566.
2018-08-16 06:45:49 +00:00
Zbigniew Jędrzejewski-Szmek
65889ab72d meson: print stats in check-api-docs 2018-08-02 15:49:45 +02:00
Zbigniew Jędrzejewski-Szmek
ae1d4a70a6
Merge pull request #8876 from yuwata/meson-0.46
meson: bump minimum required version to 0.46
2018-07-24 13:41:57 +02:00
Zbigniew Jędrzejewski-Szmek
820d14e3df Drop "Copyright abandonded" header
Add CC0 as the license. SPDX does not have a "public domain" tag, but CC0 is
more or less equivalent. We should have *some* header to avoid doubts in the
future.
2018-07-24 11:14:44 +02:00
Yu Watanabe
7a6397d2b3 meson: use has_link_argument() and friends
This bumps the minimum required version of meson to 0.46, as
`has_link_argument()` and friends are supported since 0.46.
2018-07-24 01:31:22 +09:00
Yu Watanabe
0a924a775a meson: check the existence of ninja.build for fuzzer tests 2018-07-23 08:50:26 +02:00
Evegeny Vereshchagin
f3a020d153 coverity.sh: fail if uploading data to Coverity Scan is forbidden 2018-06-25 22:22:29 +00:00
Evegeny Vereshchagin
1e79d09ef9 coverity.sh: use a comma to separate module names
Otherwise Python bails out with
```
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'json' is not defined
```

See https://travis-ci.org/systemd/systemd/jobs/397490437
2018-06-25 22:02:41 +00:00
Evegeny Vereshchagin
096eec29cd coverity.sh: make the script compatible with Python 3 2018-06-25 21:59:28 +00:00
Evegeny Vereshchagin
eeeaebf9c5 coverity.sh: fix a couple indents 2018-06-25 21:57:43 +00:00
Zbigniew Jędrzejewski-Szmek
d9b02e1697 tree-wide: drop copyright headers from frequent contributors
Fixes #9320.

for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do
  git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms'
done
2018-06-20 11:58:53 +02:00
Lennart Poettering
30ce657e5d
Merge pull request #9301 from keszybz/man-drop-authorgroup
man: drop unused <authorgroup> tags from man sources
2018-06-14 15:29:24 +02:00
Zbigniew Jędrzejewski-Szmek
0cd41d4dff Drop my copyright headers
perl -i -0pe 's/\s*Copyright © .... Zbigniew Jędrzejewski.*?\n/\n/gms' man/*xml
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/(#\n)?# +Copyright © [0-9, -]+ Zbigniew Jędrzejewski.*?\n//gms'
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s*\/\*\*\*\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*?\s*\*\*\*\/\s*/\n\n/gms'
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*//gms'
2018-06-14 13:03:20 +02:00
Zbigniew Jędrzejewski-Szmek
49a2d9a2ae Also drop <authorgroup> from autogenerated pages 2018-06-14 12:28:53 +02:00
Lennart Poettering
96b2fb93c5 tree-wide: beautify remaining copyright statements
Let's unify an beautify our remaining copyright statements, with a
unicode ©. This means our copyright statements are now always formatted
the same way. Yay.
2018-06-14 10:20:21 +02:00
Lennart Poettering
0c69794138 tree-wide: remove Lennart's copyright lines
These lines are generally out-of-date, incomplete and unnecessary. With
SPDX and git repository much more accurate and fine grained information
about licensing and authorship is available, hence let's drop the
per-file copyright notice. Of course, removing copyright lines of others
is problematic, hence this commit only removes my own lines and leaves
all others untouched. It might be nicer if sooner or later those could
go away too, making git the only and accurate source of authorship
information.
2018-06-14 10:20:20 +02:00
Lennart Poettering
818bf54632 tree-wide: drop 'This file is part of systemd' blurb
This part of the copyright blurb stems from the GPL use recommendations:

https://www.gnu.org/licenses/gpl-howto.en.html

The concept appears to originate in times where version control was per
file, instead of per tree, and was a way to glue the files together.
Ultimately, we nowadays don't live in that world anymore, and this
information is entirely useless anyway, as people are very welcome to
copy these files into any projects they like, and they shouldn't have to
change bits that are part of our copyright header for that.

hence, let's just get rid of this old cruft, and shorten our codebase a
bit.
2018-06-14 10:20:20 +02:00
Lennart Poettering
d5ef342dfe hwdb-update: make sure it works when run from meson
let's make the argument optional again, so that the command line "ninja
-C build hwdb-update" runs works.
2018-06-13 14:20:03 +02:00
Evegeny Vereshchagin
3b8e98818d coverity.sh: check that coverity responds with 200
This is mostly inspired by 7b103fd2dd

Closes https://github.com/systemd/systemd/issues/9186.
2018-06-07 17:49:54 +00:00
Lennart Poettering
12b74c38e2 tools: make various scripts find the top-levle git dir automatically 2018-06-07 16:22:16 +02:00
Lennart Poettering
3dfd31c8d2 find-double-newline: look in headers too 2018-05-22 16:13:45 +02:00
Lennart Poettering
8244a87768 tools: add a script for fixing up TABs
This is similar to "find-double-newline.sh" but looks for TABs that
should not be there.
2018-05-22 16:13:45 +02:00
Zbigniew Jędrzejewski-Szmek
3c31f3a575 tools/oss-fuzz: install private shared library non-executable (#8927)
Apparently oss-fuzz's "bad build check" is confused by the library.
Let's make it non-executable, so the checker ignores it.

Should fix https://github.com/google/oss-fuzz/issues/1330.
2018-05-08 18:00:19 +03:00
Yu Watanabe
348b44372f meson: generate m4 preprocessor from config.h (#8914) 2018-05-07 11:17:35 +02:00
Lennart Poettering
5d13a15b1d tree-wide: drop spurious newlines (#8764)
Double newlines (i.e. one empty lines) are great to structure code. But
let's avoid triple newlines (i.e. two empty lines), quadruple newlines,
quintuple newlines, …, that's just spurious whitespace.

It's an easy way to drop 121 lines of code, and keeps the coding style
of our sources a bit tigther.
2018-04-19 12:13:23 +02:00
Zbigniew Jędrzejewski-Szmek
11a1589223 tree-wide: drop license boilerplate
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
2018-04-06 18:58:55 +02:00
Filipe Brandenburger
63554ed907 oss-fuzz: Fallback to ninja-build when available (#8641)
The ninja binary is deployed as `ninja-build` in older distros such as
RHEL 7/CentOS 7.  Detect that and use `ninja-build` instead of `ninja`
when it's available.
2018-04-04 09:32:59 +02:00
Zbigniew Jędrzejewski-Szmek
36cd9913ce tools/oss-fuzz: add clang library dir using -L
I have no idea why clang doesn't do this on its own, and why clang
makes it so hard to query this path (-dumpversion returns something
unrelated...).

I know this is an ugly hack, but this is a very specialized script,
so it should be OK to make it a bit hacky.

Tested to work on Fedora (27) and Debian (unstable).

Fixes #8428.
2018-03-12 15:59:25 +01:00
Zbigniew Jędrzejewski-Szmek
9037a0e022 Rename scripts/oss-fuzz.sh to tools/oss-fuzz.sh 2018-03-12 15:40:37 +01:00
Zbigniew Jędrzejewski-Szmek
748c59b110 Rename scripts/coverity.sh to tools/coverity.sh
There are only two files in tools/, I don't think we need a separate
directory for them.
2018-03-12 15:39:21 +01:00
Zbigniew Jędrzejewski-Szmek
299597f8d5 tools/hwdb-update: allow downloads to fail
sf.net is down, and linux-usb.org which is hosted there also fails.
That's not nice, but there's not we can do about it now.
2018-03-02 12:06:32 +01:00
Zbigniew Jędrzejewski-Szmek
4af1aea411 tools/hwdb-update: print what is being executed 2018-03-02 11:50:43 +01:00
Batuhan Osman Taşkaya
7c4a807277 [gdb-sd_dump_hashmaps.py] String Formatting Update (#7819)
Changes: % changed as .format()
2018-01-27 14:03:08 +01:00
Zbigniew Jędrzejewski-Szmek
b68dfb9e83 Hook up oss-fuzz test cases as tests
This is a bit painful because a separate build of systemd is necessary. The
tests are guarded by tests!=false and slow-tests==true. Running them is not
slow, but compilation certainly is. If this proves unwieldy, we can add a
separate option controlling those builds later.

The build for each sanitizer has its own directory, and we build all fuzzer
tests there, and then pull them out one-by-one by linking into the target
position as necessary. It would be nicer to just build the desired fuzzer, but
we need to build the whole nested build as one unit.

[I also tried making systemd and nested meson subproject. This would work
nicely, but meson does not allow that because the nested target names are the
same as the outer project names. If that is ever fixed, that would be the way
to go.]

v2:
- make sure things still work if memory sanitizer is not available
v3:
- switch to syntax which works with meson 0.42.1 found in Ubuntu
2018-01-27 09:03:46 +01:00
Jonathan Rudenberg
7db7d5b733 fuzz: add initial fuzzing infrastructure
The fuzzers will be used by oss-fuzz to automatically and
continuously fuzz systemd.

This commit includes the build tooling necessary to build fuzz
targets, and a fuzzer for the DNS packet parser.
2018-01-17 13:57:06 -05:00
Lennart Poettering
51b13863a2 meson: resurrect API documentation target
We had this functionality back in Automake times, let's resurrect it.
2018-01-05 13:58:33 +01:00
bleep_blop
7629744a3d separate flags from shebang 2017-12-25 19:48:49 +01:00
Jörg Thalheim
2a5fcfae02 more portable perl shebangs (#7701)
same motivation as in #5816:

- 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.
2017-12-19 11:13:34 +01:00
Zbigniew Jędrzejewski-Szmek
c6801f502c meson-hwdb-update: fix undefined variable access
I added the test if an optional parameter is not empty, but that doesn't work
with -u. Provide an empty "fallback" value to fix the issue.

Also group the update steps so that it's easier to see what is going on.
2017-12-14 15:45:21 +01:00
Zbigniew Jędrzejewski-Szmek
ded65775a2 tests: try to autodetect directory better
Ignore mkosi.builddir. In the future we can also add other patterns
if necessary.

run-intergration-tests.sh is updated to use the new script, and modified
to work from arbitrary directory.

Follow-up for #7494.
2017-12-06 15:16:35 +01:00
Yu Watanabe
07b3a02643 test: set log_level to info in test-hwdb and check-help-*
These tests check the stderr. So, if the systemd.log_level=debug
is set in the kernel command line, then these tests fail.
This set log_level to info in hwdb-test.sh and meson-check-help.sh,
the kernel command line not to change the output of the target
programs.

Fixes #7362.
2017-11-26 00:01:55 +09:00
Zbigniew Jędrzejewski-Szmek
35df744355 Add SPDX license headers to python scripts 2017-11-19 19:08:15 +01:00
Zbigniew Jędrzejewski-Szmek
57056020c5 hwdb: switch meson to use ids_parser.py (#6964)
Also drop the now-unused perl implementation (that doesn't do sorting),
so it's incompatible anyway.
2017-10-04 19:32:59 +02:00
Zbigniew Jędrzejewski-Szmek
689f489812 hwdb: update
http://www.uefi.org/uefi-pnp-export is returning an internal server error,
so the previous version was used.
2017-10-02 13:19:21 +02:00
Zbigniew Jędrzejewski-Szmek
91dab98ffc meson-hwdb-update.sh: add -n param to skip downloads
Useful to experiment with the patching part w/o redownloading the files.
2017-10-02 13:19:21 +02:00
Zbigniew Jędrzejewski-Szmek
003c887967 meson: install the git hook (#6425)
This was done autogen.sh previously and was dropped in
72cdb3e783. Let's add it back.
The meson configuration step is the only reasonable place.

Note that this only works for the most standard git dirs, e.g.
the hook will not be installed if git worktree is used or if
$GIT_DIR is specified, etc. I think that's OK because most of
the time meson will be run at least once in the original cloned
dir.
2017-07-24 10:41:45 +02:00
Zbigniew Jędrzejewski-Szmek
1c6c3ef0bf python: remove star imports
Star imports are discouraged and break pyflakes.

I'm happy to report that pyflakes finds no issues ;)
2017-07-18 10:04:44 -04:00
Zbigniew Jędrzejewski-Szmek
0689f766dc build-sys: drop support for generation of Makefile-man.am 2017-07-18 10:04:44 -04:00
Lennart Poettering
7c34a0a306 git-contrib: drop weird non-breaking spaces
For some reason git shortlog spits out non-breaking spaces, let's remove
that, as for our purposes (inclusion in NEWS) we really want breaking
(i.e. normal) spaces.
2017-07-03 11:22:38 +02:00
Zbigniew Jędrzejewski-Szmek
6b0c49e036 Mark python scripts executable
Since all our python scripts have a proper python3 shebang, there is no benefit
to letting meson autodetect them. On linux, meson will just uses exec(), so the
shebang is used anyway. The only difference should be in how meson reports the
script and that the detection won't fail for (most likely misconfigured)
non-UTF8 locales.

Closes #5855.
2017-05-07 20:16:47 -04:00
Jörg Thalheim
3e67e5c992 more portable python shebangs (#5816)
This is useful on systems like NixOS, where python3 is not in
/usr/bin/python3 as well as for people using alternative ways to
install python such as virtualenv/pyenv.
2017-04-30 20:26:56 -04:00
Zbigniew Jędrzejewski-Szmek
6e2afb1cab meson: fix checking of linker args
Previous checks did nothing, because cc.has_argument only does compilation,
without any linking. Unfortunately cc.links() cannot be used, because it does
not accept any options. Providing the test file as a static source is easiest,
even if not every elegant.

https://github.com/mesonbuild/meson/issues/1676
2017-04-25 08:49:16 -04:00
Zbigniew Jędrzejewski-Szmek
b884196cc1 meson: also indent scripts with 8 spaces 2017-04-25 08:49:16 -04:00
Zbigniew Jędrzejewski-Szmek
dc25d2adb5 meson: $DESTDIR might be undefined
This causes an error with -u. Just add an empty fallback.
2017-04-24 19:25:33 -04:00
Zbigniew Jędrzejewski-Szmek
86b3ca7a66 meson: use "sh -eu" and make .sh +x, .py -x
Shell scripts should be executable so that meson reports their
invocation succinctly (does not print 'sh' '-e').
Python scripts should not be executable so that meson does the
detection of the right python binary itself.

Add -u everywhere to catch potential errors.
2017-04-23 21:47:29 -04:00
Zbigniew Jędrzejewski-Szmek
fdd147a88e meson: add dist-check-includes replacement
This is more-or-less the same as dist-check-includes. meson doesn't exactly
make it easy to call a compiler with a custom set of options. The tests
are included in the test listing.
2017-04-23 21:47:29 -04:00
Zbigniew Jędrzejewski-Szmek
734005fe75 hwdb: use curl instead of wget, and regenerate patch after successful update
libcurl is already our build dependency, so using curl reduces the deps
a bit, and curl also has a more modern codebase.

Regenerating the patch makes it more likely that the patch will apply
in the future.

Also, update URLs which return 302 to the new location.

(Patch suggested by Igor Gnatenko.)
2017-04-23 21:47:29 -04:00