Commit Graph

33 Commits

Author SHA1 Message Date
Yu Watanabe d9b6baa699 test: make test-catalog relocatable
Fixes #10045.
2018-09-11 09:19:36 +09: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
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
Zbigniew Jędrzejewski-Szmek 627d2bac24 fs-util,test: add helper to remove tempfiles
This simplifies the use of tempfiles in tests and fixes "leaked"
temporary files in test-fileio, test-catalog, test-conf-parser.

Not the whole tree is converted.
2018-05-18 20:11:31 +02:00
Zbigniew Jędrzejewski-Szmek f201daec89 Introduce _cleanup_(strbuf_cleanupp) and use it to fix null deref on error
catalog_update() would call strbuf_cleanup(NULL) on allocation error.
CID #1390928.
2018-05-10 01:36:50 +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
Zbigniew Jędrzejewski-Szmek 53e1b68390 Add SPDX license identifiers to source files under the LGPL
This follows what the kernel is doing, c.f.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
2017-11-19 19:08:15 +01:00
Topi Miettinen 646853bdd8 fileio: simplify mkostemp_safe() (#4090)
According to its manual page, flags given to mkostemp(3) shouldn't include
O_RDWR, O_CREAT or O_EXCL flags as these are always included. Beyond
those, the only flag that all callers (except a few tests where it
probably doesn't matter) use is O_CLOEXEC, so set that unconditionally.
2016-09-13 08:20:38 +02:00
Zbigniew Jędrzejewski-Szmek 06466a7f03 journal/catalog: fix memory leaks
Various buffers were lost because finish_item() either consumed
the buffer or allocated a new one (if an entry with the same key existed).
The caller would simply forget the buffer in either case.

Also add a check for the case when a valid identifier is followed by
an empty body. We should not allow this.

Also be more consistent in error handling and always print an error
message.
2016-02-18 19:39:09 -05:00
Daniel Mack b26fa1a2fb tree-wide: remove Emacs lines from all files
This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file.
2016-02-10 13:41:57 +01:00
Stef Walter c059b62fe6 journal: Add test for merging journal entries 2016-02-05 17:07:01 +01:00
Stef Walter 9d85882aa8 journal: Refactor test-catalog importing tests
One function per test. Remove shared state between tests.
2016-02-05 17:07:01 +01:00
Stef Walter dbae138dc1 journal: Combine journal catalog entries with the same id
Instead of discarding duplicate catalog entries, we now combine
them. This allows software or admins to add or override catalog
headers, or add additional text to the catalog message.
2016-02-05 17:06:59 +01:00
Thomas Hindoe Paaboel Andersen cf0fbc49e6 tree-wide: sort includes
Sort the includes accoding to the new coding style.
2015-11-16 22:09:36 +01:00
Lennart Poettering b5efdb8af4 util-lib: split out allocation calls into alloc-util.[ch] 2015-10-27 13:45:53 +01:00
Lennart Poettering 0d39fa9c69 util-lib: move more file I/O related calls into fileio.[ch] 2015-10-27 13:25:55 +01:00
Lennart Poettering 3ffd4af220 util-lib: split out fd-related operations into fd-util.[ch]
There are more than enough to deserve their own .c file, hence move them
over.
2015-10-25 13:19:18 +01:00
Lennart Poettering 07630cea1f util-lib: split our string related calls from util.[ch] into its own file string-util.[ch]
There are more than enough calls doing string manipulations to deserve
its own files, hence do something about it.

This patch also sorts the #include blocks of all files that needed to be
updated, according to the sorting suggestions from CODING_STYLE. Since
pretty much every file needs our string manipulation functions this
effectively means that most files have sorted #include blocks now.

Also touches a few unrelated include files.
2015-10-24 23:05:02 +02:00
Thomas Hindoe Paaboel Andersen 2eec67acbb remove unused includes
This patch removes includes that are not used. The removals were found with
include-what-you-use which checks if any of the symbols from a header is
in use.
2015-02-23 23:53:42 +01:00
Ronny Chevalier 787784c4c1 tests: use assert_se instead of assert
Otherwise they can be optimized away with -DNDEBUG
2014-11-30 02:35:52 +01:00
Michal Schmidt d5099efc47 hashmap: introduce hash_ops to make struct Hashmap smaller
It is redundant to store 'hash' and 'compare' function pointers in
struct Hashmap separately. The functions always comprise a pair.
Store a single pointer to struct hash_ops instead.

systemd keeps hundreds of hashmaps, so this saves a little bit of
memory.
2014-09-15 16:08:50 +02:00
Zbigniew Jędrzejewski-Szmek e3b9d9c802 journal: cleanup up error handling in update_catalog()
- Negative/positive errno mixup caused duplicates not to be detected properly.
  Now we get a warning about some duplicate entries in our own catalogs...
- Errors in update_catalog would be ignored, but they should not be.
2014-04-12 10:20:55 -04:00
Lennart Poettering 2d5bdf5bc0 always use the same code for creating temporary files
Let's unify our code here, and also always specifiy O_CLOEXEC.
2014-01-28 13:47:35 +01:00
Zbigniew Jędrzejewski-Szmek 4b8268f843 catalog: fix language detection
Detection would fail if language was not specified in the filename
but a dot appeared somewhere higher in the path.
2013-12-15 23:36:36 -05:00
Zbigniew Jędrzejewski-Szmek c7332b0844 catalog: determine language from the filename 2013-12-02 22:12:02 -05:00
Holger Hans Peter Freyther 143bfdaf0b test: Make testing work on systems without or old systemd
* Introduce a macro to conditionally execute tests. This avoids
  skipping the entire test if some parts require systemd
* Skip the journal tests when no /etc/machine-id is present
* Change test-catalog to load the catalog from the source directory
  of systemd.
* /proc/PID/comm got introduced in v2.6.33 but travis is still
  using v2.6.32.
* Enable make check and make distcheck on the travis build
* Use -D"CATALOG_DIR=STR($(abs_top_srcdir)/catalog)" as a STRINGIY
  would result in the path '/home/ich/source/linux' to be expanded
  to '/home/ich/source/1' as linux is defined to 1.
2013-08-22 00:52:14 -04:00
Harald Hoyer 7fd1b19bc9 move _cleanup_ attribute in front of the type
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-04-18 09:11:22 +02:00
Zbigniew Jędrzejewski-Szmek 737563e4bb test-catalog,core/load-dropin: remove unused variables 2013-04-05 00:17:35 -04:00
Zbigniew Jędrzejewski-Szmek 844ec79b3c catalog: open up catalog internals
In order to write tests for the catalog functions, they
are made non-static and start taking a 'database' parameter,
which is the name of a file with the preprocessed catalog
entries.

This makes it possible to make test-catalog part of the
normal test suite, since it now only operates on files
in /tmp.

Some more tests are added.
2013-03-28 23:45:59 -04:00
Zbigniew Jędrzejewski-Szmek 54b7254c1f journalct: beef up entry listing
The ability to dump catalog entries in full and by id is added.
2013-03-19 21:50:43 -04:00
Lennart Poettering d4205751d4 journal: implement message catalog
The message catalog can be used to attach short help texts to log lines,
keyed by their MESSAGE_ID= fields. This is useful to help the
administrator understand the context and cause of a message, find
possible solutions and find further related documentation.

Since this is keyed off MESSAGE_ID= this will only work for native
journal messages.

The message catalog supports i18n, and is useful to augment english
language system messages with explanations in the local language.

This commit only includes short explanatory messages for a few example
message IDs, we'll add more complete documentation for the relevant
systemd messages later on.
2012-11-15 23:09:07 +01:00