Bug 214909 - Mistaken command output for setcap
Summary: Mistaken command output for setcap
Status: RESOLVED CODE_FIX
Alias: None
Product: Tools
Classification: Unclassified
Component: libcap (show other bugs)
Hardware: All Linux
: P1 enhancement
Assignee: Andrew G. Morgan
URL:
Keywords:
: 214907 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-11-02 06:40 UTC by meitingli
Modified: 2021-11-06 15:08 UTC (History)
1 user (show)

See Also:
Kernel Version: 4.19.90-2106.3.0.0095
Subsystem:
Regression: No
Bisected commit-id:


Attachments
command output (6.47 KB, image/png)
2021-11-02 06:41 UTC, meitingli
Details

Description meitingli 2021-11-02 06:40:24 UTC
Hello, 

When I executed below command:
$ setcap -n 0 cap_net_raw,cap_net_admin=eip /usr/bin/ping
$ setcap -n root cap_net_raw,cap_net_admin=eip /usr/bin/ping

The ouput displayed: invalid rootid!=0 of 'xxx', the message was mistaken the line did.'t wrap.

Could you check the parameter value, and set clearly output message?

And more details, please see:
https://gitee.com/src-openeuler/libcap/issues/I4FR7U?from=project-issue
Comment 1 meitingli 2021-11-02 06:41:01 UTC
Created attachment 299395 [details]
command output
Comment 2 Artem S. Tashkinov 2021-11-02 12:33:19 UTC
*** Bug 214907 has been marked as a duplicate of this bug. ***
Comment 3 Andrew G. Morgan 2021-11-06 15:08:49 UTC
Thanks for the bug report.

This commit should fix it (will be included in 2.61):

https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=8e1e967bc8d99a3233d51f67f6b88620cdff78dc


$ sudo ./setcap -n 5 cap_net_raw,cap_net_admin=eip ./setcap
$ ./getcap -n ./setcap
./setcap cap_net_admin,cap_net_raw=eip [rootid=5]
$ sudo ./setcap -n 0 cap_net_raw,cap_net_admin=eip ./setcap
bad ns rootid: want positive integer, got "0"
$ sudo ./setcap -n -5 cap_net_raw,cap_net_admin=eip ./setcap
bad ns rootid: want positive integer, got "-5"
$ sudo ./setcap -n root cap_net_raw,cap_net_admin=eip ./setcap
bad ns rootid: want positive integer, got "root"

Note You need to log in before you can comment on or make changes to this bug.