makedevs: only warn when xattr support disabled
RFC PATCH v3 1/2 makedevs: only warn when xattr support disabled
Previously makedevs failed when xattr configuration defined while disabled BR2_ROOTFS_DEVICE_TABLE_SUPPORTS_EXTENDED_ATTRIBUTES. Therefore check for this configuration would be required
in each use. Therefore only print warning with number of discharged lines.
No package is using this feature so far (it's used only in tests), thus no need to change any package config.
---
Changes v2->v3:
* print warning only once at the end, print number of discharged lines
* put into single line (feel free to add new line)
package/makedevs/makedevs.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
package/makedevs/makedevs.c +11 -3
@@ -493,6 +493,7 @@ int main(int argc, char **argv)printf ("table=<stdin>\n" ); } +unsigned int xattr_warned =0 ;while ((line =bb_get_chomped_line_from_file (table))) {char type;unsigned int mode =0755 ;
@@ -518,9 +519,7 @@ int main(int argc, char **argv)if (bb_set_xattr (full_name, xattr) <0 )bb_error_msg_and_die ("can't set cap %s on file %s\n" , xattr, full_name);#else -bb_error_msg_and_die ("line %d not supported: '%s'\nDid you forget to enable " -"BR2_ROOTFS_DEVICE_TABLE_SUPPORTS_EXTENDED_ATTRIBUTES?\n" , - linenum, line); + xattr_warned++;#endif /* EXTENDED_ATTRIBUTES */ continue ; }
@@ -641,6 +640,15 @@ int main(int argc, char **argv) loop:free (line); } + +if (xattr_warned) { +bb_error_msg ("%u lines with xattr configuration discharged, enable " +"BR2_ROOTFS_DEVICE_TABLE_SUPPORTS_EXTENDED_ATTRIBUTES " +"to get xattr support\n" , + xattr_warned); + ret =EXIT_FAILURE ; + } +fclose (table);return ret;
Signature · 1 line
2.22.0
RFC PATCH v3 2/2 iputils: add capability for clockdiff, ping, traceroute6
Not setting for arping as it can be used for ARP Poisoning.
Use cap_net_raw+p (drop +e) as upstream sets that via cap_set_flag(), see https://github.com/iputils/iputils/issues/194
---
Same as v2.
package/iputils/iputils.mk | 3 +++ 1 file changed, 3 insertions(+)
package/iputils/iputils.mk +3 -0
@@ -76,8 +76,11 @@ IPUTILS_CONF_OPTS += -DNO_SETCAP_OR_SUID=true define IPUTILS_PERMISSIONS /usr/sbin/arping f 4755 0 0 - - - - - /usr/bin/clockdiff f 4755 0 0 - - - - - + |xattr cap_net_raw+p /bin/ping f 4755 0 0 - - - - - + |xattr cap_net_raw+p /usr/bin/traceroute6 f 4755 0 0 - - - - - + |xattr cap_net_raw+p endef $(eval $(meson-package))
Signature · 1 line
2.22.0
RFC PATCH v3 1/2 makedevs: only warn when xattr support disabled
In reply to Petr VorelPetr, All,
On 2019-07-30 22:31 +0200, Petr Vorel spake thusly:
Quoted 9 lines
Previously makedevs failed when xattr configuration defined while disabled
BR2_ROOTFS_DEVICE_TABLE_SUPPORTS_EXTENDED_ATTRIBUTES. Therefore check for this configuration would be required
in each use. Therefore only print warning with number of discharged lines.No package is using this feature so far (it's used only in tests), thus no need to change any package config.
Signed-off-by Petr Vorel <[email protected]>
[--SNIP--]
package/makedevs/makedevs.c int main(int argc, char **argv) · line 645
Quoted 7 lines
package/makedevs/makedevs.c +3
-0@@ -641,6 +640,15 @@ int main(int argc, char **argv) loop:free (line); } + +if (xattr_warned) { + bb_error_msg("%u lines with xattr configuration discharged, enable "
"discharged" is not the most appropriate term. I'd have just said "ignored".
package/makedevs/makedevs.c int main(int argc, char **argv) · line 648
Quoted 3 lines
package/makedevs/makedevs.c +3
-0+"BR2_ROOTFS_DEVICE_TABLE_SUPPORTS_EXTENDED_ATTRIBUTES " +"to get xattr support\n" , + xattr_warned);
Yes, that's nice! :-)
package/makedevs/makedevs.c int main(int argc, char **argv) · line 649
Quoted 1 line
package/makedevs/makedevs.c +1
-0+ ret =EXIT_FAILURE ;
Why do you want to exit in failure?
When makedevs exits in error, then whole fakeroot script aborts even before attempting to generate the image.
I can see two problems with that:
- first, when iputils is enabled, then the build will by default fail, as xattr support is by default disabled,
- I can very well see a scenario where xattr, and thus capabilities, are not desired. For example, if I need iputils, but will only ever call clockdiff as root, then I don't care about its capabilities.
So, I think it is nice that we warn that xattrs are dropped, but we should not fail the build.
Regards,
Yann E. MORIN.
Quoted 8 lines
package/makedevs/makedevs.c +2
-0+ } +fclose (table);return ret;Signature · 1 line
2.22.0
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
RFC PATCH v3 1/2 makedevs: only warn when xattr support disabled
Hi Yann, others,
Quoted 10 lines
Why do you want to exit in failure?
When makedevs exits in error, then whole fakeroot script aborts even before attempting to generate the image.
I can see two problems with that:
- first, when iputils is enabled, then the build will by default fail, as xattr support is by default disabled,
Quoted 6 lines
- I can very well see a scenario where xattr, and thus capabilities, are not desired. For example, if I need iputils, but will only ever call clockdiff as root, then I don't care about its capabilities.
So, I think it is nice that we warn that xattrs are dropped, but we should not fail the build.
Good point, I've sent v4 with this change.
Thanks for your review!
Regards to xattr support by default disabled, could you please have a look at other my patch, which set default according to xattr support of used rootfs?
https://patchwork.ozlabs.org/project/buildroot/list/?series=120582
NOTE to reviewers: I've cleaned up previous versions in patchwork (set superseded)
Kind regards,
Petr