Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 562354 - sys-apps/openrc - /lib64/rc/sh/rc-cgroup.sh: /lib64/rc/sh/rc-cgroup.sh: line 64: printf: write error: Invalid argument
Summary: sys-apps/openrc - /lib64/rc/sh/rc-cgroup.sh: /lib64/rc/sh/rc-cgroup.sh: line ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-05 21:24 UTC by andcycle-gentoo.bugs
Modified: 2015-10-06 17:19 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description andcycle-gentoo.bugs 2015-10-05 21:24:56 UTC
I follow the OpenRC wiki example trying to set a cgroup to restrict service cpu usage,
turns out it doesn't work at all

Reproducible: Always

Steps to Reproduce:
1. 
    follow example at https://wiki.gentoo.org/wiki/OpenRC/CGroups
2. 
    put the example line 
        rc_cgroup_cpu="cpu.shares 512"
    at /etc/conf.d/boinc
3.
    /etc/init.d/boinc start

Actual Results:  
/lib64/rc/sh/rc-cgroup.sh: line 64: printf: write error: Invalid argument

Expected Results:  
boinc correct start with specific cpu shares val

log from /etc/init.d/boinc start --debug
as you can see there is a leading space in $val

++ echo /
+ local controller=cpu h=/
+ cgroup=/sys/fs/cgroup/cpu/openrc_boinc
+ '[' -d /sys/fs/cgroup/cpu/openrc_boinc ']'
+ set -- cpu.shares 16
+ local name val
+ '[' -n cpu.shares -a cpu '!=' cpuacct ']'
+ case "$1" in
+ '[' -n '' -a -f /sys/fs/cgroup/cpu/openrc_boinc/ -a -n '' ']'
+ name=cpu.shares
+ val=
+ shift
+ '[' -n 16 -a cpu '!=' cpuacct ']'
+ case "$1" in
+ val=' 16'
+ shift
+ '[' -n '' -a cpu '!=' cpuacct ']'
+ '[' -n cpu.shares -a -f /sys/fs/cgroup/cpu/openrc_boinc/cpu.shares -a -n ' 16' ']'
+ veinfo 'boinc: Setting /sys/fs/cgroup/cpu/openrc_boinc/cpu.shares to  16'
+ printf %s ' 16'
/lib64/rc/sh/rc-cgroup.sh: line 64: printf: write error: Invalid argument
+ '[' -f /sys/fs/cgroup/cpu/openrc_boinc/tasks ']'
+ veinfo 'boinc: adding to /sys/fs/cgroup/cpu/openrc_boinc/tasks'
+ printf %d 0
+ return 0
+ local cpuacct=
+ '[' -n '' ']'
+ local cpuset=
+ '[' -n '' ']'
+ local devices=
+ '[' -n '' ']'
+ local memory=
+ '[' -n '' ']'
+ local net_prio=
+ '[' -n '' ']'
+ return 0
Comment 1 William Hubbs gentoo-dev 2015-10-06 17:19:44 UTC
This is fixed in commit b20a195.
This will be part of OpenRC-0.18.
Thanks for the report and the debug log.