Skip to contentSkip to conversation

makedevs: only warn on xattr when not enabled

RFC PATCH New Petr Vorel 2 participants 4 messages Jul 29, 2019 – Jul 30, 2019

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

RFC PATCH v2 1/2 makedevs: only warn on xattr when not enabled

Previously makedevs failed on adding xattr when BR2_ROOTFS_DEVICE_TABLE_SUPPORTS_EXTENDED_ATTRIBUTES was not enabled. Now only warn. Therefore check for this configuration would be required in each use. But no package is using it so far (it's used only in tests).

---
Hi,

this supersede this patch:
https://patchwork.ozlabs.org/patch/1138055/

Unfortunately I wasn't able to test it as buildroot/output/build/buildroot-fs/tar/fakeroot is not working for me. Can anyone test it?

Kind regards,
Petr

 package/makedevs/makedevs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
package/makedevs/makedevs.c +3 -2
index c57b964f5c..ab35b8e70d 100644
@@ -518,8 +518,9 @@ 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",
+			bb_error_msg("line %d not supported: '%s'\nEnable "
+					     "BR2_ROOTFS_DEVICE_TABLE_SUPPORTS_EXTENDED_ATTRIBUTES"
+						 "to get xattr support\n",
 					     linenum, line);
 #endif /* EXTENDED_ATTRIBUTES */
 			continue;
Signature · 1 line
2.22.0
author
#1 lore raw

RFC PATCH v2 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

---
 package/iputils/iputils.mk | 3 +++
 1 file changed, 3 insertions(+)
package/iputils/iputils.mk +3 -0
index 8e6a3e2fc5..f1d3e1fc6a 100644
@@ -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
#2 lore raw

RFC PATCH v2 1/2 makedevs: only warn on xattr when not enabled

In reply to Petr Vorel

Petr, All,

On 2019-07-30 01:06 +0200, Petr Vorel spake thusly:

Quoted 27 lines

Previously makedevs failed on adding xattr when BR2_ROOTFS_DEVICE_TABLE_SUPPORTS_EXTENDED_ATTRIBUTES was not enabled. Now only warn. Therefore check for this configuration would be required in each use. But no package is using it so far (it's used only in tests).

---
Hi,

this supersede this patch:
https://patchwork.ozlabs.org/patch/1138055/

Unfortunately I wasn't able to test it as buildroot/output/build/buildroot-fs/tar/fakeroot is not working for me. Can anyone test it?

Kind regards,
Petr

 package/makedevs/makedevs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
package/makedevs/makedevs.c +0 -0
index c57b964f5c..ab35b8e70d 100644

package/makedevs/makedevs.c int main(int argc, char **argv) · line 523

Quoted 8 lines
package/makedevs/makedevs.c +3 -2
@@ -518,8 +518,9 @@ 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",
+			bb_error_msg("line %d not supported: '%s'\nEnable "
+					     "BR2_ROOTFS_DEVICE_TABLE_SUPPORTS_EXTENDED_ATTRIBUTES"
+						 "to get xattr support\n",

It would be nice if the message was displayed only the first time an xattr line is encountered, something like:

    if (!xattr_warned) {
        bb_error_msg(...);
        xattr_warned = 1;
    }

Regards,
Yann E. MORIN.

Quoted 6 lines
package/makedevs/makedevs.c +0 -0
 					     linenum, line);
 #endif /* EXTENDED_ATTRIBUTES */
 			continue;
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.  |
'------------------------------^-------^------------------^--------------------'
author
#3 lore raw

RFC PATCH v2 1/2 makedevs: only warn on xattr when not enabled

Hi Yann,

...

Quoted 7 lines

It would be nice if the message was displayed only the first time an xattr line is encountered, something like:

    if (!xattr_warned) {
        bb_error_msg(...);
        xattr_warned = 1;
    }

OK, I'll send another version. I'll probably don't print the line content as it's why to print only 1st of N discharged lines? Or (maybe better) I'll count them and print warning with count of discharged lines at the end. It will be also more visible when it's at the end.

Kind regards,
Petr