[systemd-devel] [PATCH] systemd-analyze: filter dot output with a regular expression

Łukasz Stelmach l.stelmach at samsung.com
Tue Mar 26 00:58:49 PDT 2013

It was <2013-03-25 pon 23:48>, when Lennart Poettering wrote:
> On Mon, 25.03.13 21:19, Lukasz Stelmach (stlman at poczta.fm) wrote:
>> W dniu 25.03.2013 16:48, Lennart Poettering pisze:
>> > On Sun, 24.03.13 13:32, Łukasz Stelmach (stlman at poczta.fm) wrote:
>> > 
>> >> Make "systemd-analyze dot" output only lines matching a regular
>> >> expression passed on the command line. Without the regular expression
>> >> print everything.
>> > 
>> > So far we mostly used globs everywhere in system. Does it really make
>> > sense to use regexes here?
>> > 
>> > I mean, unit file names on purpose are "file-name like", and generally
>> > even show up in the file system, so it sounds more natural to me to use
>> > fnmatch here?
>> Indeed fnmatch() is better for matching unit names, however, I match the
>> whole line:
>>         "multi-user.target"->"basic.target" [color="green"];
> Well, I really wouldn't match the whole line. If people want that they
> can use grep, no?

Not grep, but at least sed (sed -ne '1p' -e '$p' -e
'/target.*target/p'). Grep removes the first and last line. This isn't
of course a major issue but a noticable annoyance.

> Wouldn't it be nicer to match either unit name, and that's it? 

OK. I will do it.

>> rather than the the unit names. To quickly match the line above I use
>> "target.*target". A glob that does tha same is "*target*target*" not as
>> nice, is it? (This is because globs are implicitly anchored at the
>> beginning of strings while regexps are not)
> Well, but if you apply the fnmatch to both the source and the dest, it
> will work fine!


I will post a v2 patch in the evening.

Thank you for your comments.
Łukasz Stelmach
Software wizzard
Samsung Poland R&D Center

Al. Armii Ludowej 26, 00-609 Warszawa

More information about the systemd-devel mailing list