[systemd-devel] [PATCH] sysctl: don't replace dots with slashes in prefix

David Herrmann dh.herrmann at gmail.com
Wed Sep 17 00:17:10 PDT 2014


Hi

On Mon, Sep 15, 2014 at 2:00 PM, Jan Synacek <jsynacek at redhat.com> wrote:
> David Herrmann <dh.herrmann at gmail.com> writes:
>> Your original patch is right, too. But I'm not sure which one to
>> prefer. Given that we export systemd-sysctl as rpm macro, I guess we
>> have to go with your patch. Otherwise, we'd break ABI.
>>
>> Thanks and sorry for the confusion!
>> David
>
> Not requiring /proc/sys prefixes and normalizing them totally makes
> sense. I'm glad we cleared the confusion!

I now pushed a fix to systemd master [1]. It makes sure to keep
compatibility by treating arguments prefixed with /proc/sys as legacy
arguments. All other arguments are properly converted and prefixed wit
/proc/sys/ now.

I also replaced the dot->slash conversion with normalize_sysctl().
This effectively drops any conversion on legacy arguments as they
start with a slash and thus are not converted (see the function for
details). But this now allows you to specify sysctl names instead of
paths and everything just works.

I tested it with:
    systemd-sysctl --prefix /proc/sys/kernel --prefix net.ipv4 --prefix net/ipv6
and it worked as expected. It's turned into:
    systemd-sysctl --prefix /proc/sys/kernel --prefix
/proc/sys/net/ipv4 --prefix proc/sys/net/ipv6

If there's something left to do, please let me know.

Thanks for the report! And again, sorry for the confusion.
David


[1] http://cgit.freedesktop.org/systemd/systemd/commit/?id=0e1f579227b08832437a7ac2227c7e4007a89d23


More information about the systemd-devel mailing list