Skip to contentSkip to conversation

makedevs: allow leading whitespace for capabilities

PATCH New Ricardo Martincoski 3 participants 8 messages Aug 6, 2018 – Aug 10, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 makedevs: allow leading whitespace for capabilities

Currently makedevs silently ignores extended attributes with leading whitespace, for example those added to a <PACKAGE>_PERMISSIONS following the recommended style from check-package.

Makedevs already ignores leading whitespace for normal entries (file permission changes and device files creation). Do the same for extended attributes.

Fixes #11191.
---
 package/makedevs/makedevs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/makedevs/makedevs.c +1 -1
index 1ba5936342..c57b964f5c 100644
@@ -510,7 +510,7 @@ int main(int argc, char **argv)
 
 		linenum++;
 
-		if (1 == sscanf(line, "|xattr %254s", xattr)) {
+		if (1 == sscanf(line, " |xattr %254s", xattr)) {
 #ifdef EXTENDED_ATTRIBUTES
 			if (!full_name)
 				bb_error_msg_and_die("line %d should be after a file\n", linenum);
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 support/testing: add test for file capabilities

---
complete run on GitLab CI on top of 2018.02.4 with the series applied:
https://gitlab.com/RicardoMartincoski/buildroot/pipelines/27226377

only the test on top of 2018.02.4:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/86985431

only the test on top of 2018.05.1:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/86985455

only the test on top of 2018.08-rc1:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/86985484

---
 .gitlab-ci.yml                                |  1 +
 support/testing/tests/core/device_table2.txt  |  7 +++
 .../tests/core/squashfs-xattr-kernel.config   |  1 +
 .../tests/core/test_file_capabilities.py      | 47 +++++++++++++++++++
 4 files changed, 56 insertions(+)
 create mode 100644 support/testing/tests/core/device_table2.txt
 create mode 100644 support/testing/tests/core/squashfs-xattr-kernel.config
 create mode 100644 support/testing/tests/core/test_file_capabilities.py
.gitlab-ci.yml +1 -0
index 59ce6ae59e..271b938842 100644
@@ -237,6 +237,7 @@ zynq_zybo_defconfig: *defconfig
 tests.boot.test_atf.TestATFAllwinner: *runtime_test
 tests.boot.test_atf.TestATFMarvell: *runtime_test
 tests.boot.test_atf.TestATFVexpress: *runtime_test
+tests.core.test_file_capabilities.TestFileCapabilities: *runtime_test
 tests.core.test_post_scripts.TestPostScripts: *runtime_test
 tests.core.test_rootfs_overlay.TestRootfsOverlay: *runtime_test
 tests.core.test_timezone.TestGlibcAllTimezone: *runtime_test
support/testing/tests/core/device_table2.txt new file +7 -0
new file mode 100644
index 0000000000..f8323217f3
@@ -0,0 +1,7 @@
+# <name>				<type>	<mode>	<uid>	<gid>	<major>	<minor>	<start>	<inc>	<count>
+/usr/sbin/getcap                        f       755     0       0	-	-	-	-	-
+|xattr cap_sys_nice+eip
+# leading spaces are ignored for xattr
+  |xattr cap_kill+eip
+# leading tabs are ignored for xattr
+	|xattr cap_sys_time+eip
support/testing/tests/core/squashfs-xattr-kernel.config new file +1 -0
new file mode 100644
index 0000000000..81b21b94c5
@@ -0,0 +1 @@
+CONFIG_SQUASHFS_XATTR=y
support/testing/tests/core/test_file_capabilities.py new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/2 support/testing: add test for file capabilities

Hello,

Please notice this test case could be applied to master or next, but it will fail until we fix #11216.

On Mon, Aug 06, 2018 at 12:17 AM, Ricardo Martincoski wrote:

[snip]

Quoted 2 lines

complete run on GitLab CI on top of 2018.02.4 with the series applied:
https://gitlab.com/RicardoMartincoski/buildroot/pipelines/27226377

https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/86985522
passed, #11191 fixed

Quoted 2 lines

only the test on top of 2018.02.4:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/86985431

failed, detects #11191

Quoted 2 lines

only the test on top of 2018.05.1:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/86985455

failed, detects #11216

Quoted 2 lines

only the test on top of 2018.08-rc1:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/86985484

failed, detects #11216

Regards,
Ricardo

#3 lore raw

PATCH 2/2 support/testing: add test for file capabilities

In reply to Ricardo Martincoski
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Ricardo" == Ricardo Martincoski <[email protected]> writes:

---
complete run on GitLab CI on top of 2018.02.4 with the series applied:
https://gitlab.com/RicardoMartincoski/buildroot/pipelines/27226377

Quoted 8 lines

only the test on top of 2018.02.4:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/86985431

only the test on top of 2018.05.1:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/86985455

only the test on top of 2018.08-rc1:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/86985484

I know it fails on master, but then we are atleast aware of it, so:

Committed to master, and then backported to 2018.02.x and 2018.05.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 1/2 makedevs: allow leading whitespace for capabilities

In reply to Ricardo Martincoski

Hello Ricardo,

Quoted 8 lines · Ricardo Martincoski

Currently makedevs silently ignores extended attributes with leading whitespace, for example those added to a <PACKAGE>_PERMISSIONS following the recommended style from check-package.

Makedevs already ignores leading whitespace for normal entries (file permission changes and device files creation). Do the same for extended attributes.

Quoted 6 lines
Fixes #11191.

It is not clear to me why you have the "2018.02.x" prefix in your patch title. I would assume this patch is needed in master, not just in 2018.02.x. We generally include 2018.02.x in the patch title when the patch should only be applied to 2018.02.x. For patches going in master, and needing a backport, we normally rely on Peter being smart and realizing that the patch is a fix that makes sense for 2018.02.x.

Could you clarify what was your intention with this 2018.02.x prefix ?

Perhaps we need to have some tags ?

Backport-to: 2018.02.x

when the patch is for master, but needs to be backported. And perhaps:

Apply-to: 2018.02.x

when the patch is to be applied only on 2018.02.x.

Or simply rely on informal notes below the "---" sign ?

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#5 lore raw

PATCH 1/2 makedevs: allow leading whitespace for capabilities

Hello,

Quoted 16 lines · Thomas Petazzoni
Quoted 8 lines · Ricardo Martincoski

Currently makedevs silently ignores extended attributes with leading whitespace, for example those added to a <PACKAGE>_PERMISSIONS following the recommended style from check-package.

Makedevs already ignores leading whitespace for normal entries (file permission changes and device files creation). Do the same for extended attributes.

Quoted 6 lines
Fixes #11191.
Quoted 8 lines

It is not clear to me why you have the "2018.02.x" prefix in your patch title. I would assume this patch is needed in master, not just in 2018.02.x. We generally include 2018.02.x in the patch title when the patch should only be applied to 2018.02.x. For patches going in master, and needing a backport, we normally rely on Peter being smart and realizing that the patch is a fix that makes sense for 2018.02.x.

Could you clarify what was your intention with this 2018.02.x prefix ?

I developed and runtime tested the patch for 2018.02.x.
But now I tested the patch (by temporarily adding a printf to makedevs) in the master branch too. It works well.

This patch can/should be applied to master.

In the branch 2018.02.x this patch unbreaks xattr with leading whitespace. In the master branch (and also 2018.05.x), which use a per-fs target dir, there are other issues with xattr, this patch is only part of the solution to unbreak xattrs, see #11216.

Quoted 5 lines

Perhaps we need to have some tags ?

Backport-to: 2018.02.x

Quoted 7 lines

when the patch is for master, but needs to be backported. And perhaps:

Apply-to: 2018.02.x

when the patch is to be applied only on 2018.02.x.

Or simply rely on informal notes below the "---" sign ?

Sorry, I should have added such informal notes.

Regards,
Ricardo

#6 lore raw

PATCH 1/2 makedevs: allow leading whitespace for capabilities

Quoted 34 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Ricardo" == Ricardo Martincoski <[email protected]> writes:

Hello,

Quoted 16 lines · Thomas Petazzoni
Quoted 8 lines · Ricardo Martincoski

Currently makedevs silently ignores extended attributes with leading whitespace, for example those added to a <PACKAGE>_PERMISSIONS following the recommended style from check-package.

Makedevs already ignores leading whitespace for normal entries (file permission changes and device files creation). Do the same for extended attributes.

Quoted 6 lines
Fixes #11191.
Quoted 8 lines

It is not clear to me why you have the "2018.02.x" prefix in your patch title. I would assume this patch is needed in master, not just in 2018.02.x. We generally include 2018.02.x in the patch title when the patch should only be applied to 2018.02.x. For patches going in master, and needing a backport, we normally rely on Peter being smart and realizing that the patch is a fix that makes sense for 2018.02.x.

Could you clarify what was your intention with this 2018.02.x prefix ?

I developed and runtime tested the patch for 2018.02.x.
But now I tested the patch (by temporarily adding a printf to makedevs) in the master branch too. It works well.

Quoted 6 lines

This patch can/should be applied to master.

In the branch 2018.02.x this patch unbreaks xattr with leading whitespace. In the master branch (and also 2018.05.x), which use a per-fs target dir, there are other issues with xattr, this patch is only part of the solution to unbreak xattrs, see #11216.

Ok, thanks.

Committed to master, and then backported to 2018.02.x and 2018.05.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#7 lore raw

PATCH 1/2 makedevs: allow leading whitespace for capabilities

In reply to Thomas Petazzoni
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hi,

Quoted 13 lines

It is not clear to me why you have the "2018.02.x" prefix in your patch title. I would assume this patch is needed in master, not just in 2018.02.x. We generally include 2018.02.x in the patch title when the patch should only be applied to 2018.02.x. For patches going in master, and needing a backport, we normally rely on Peter being smart and realizing that the patch is a fix that makes sense for 2018.02.x.

Could you clarify what was your intention with this 2018.02.x prefix ?

Perhaps we need to have some tags ?

Backport-to: 2018.02.x

Quoted 7 lines

when the patch is for master, but needs to be backported. And perhaps:

Apply-to: 2018.02.x

when the patch is to be applied only on 2018.02.x.

Or simply rely on informal notes below the "---" sign ?

Just stating it below the --- sign is IMHO good enough, and in the worst case send a mail if I miss something.

Signature · 1 line
Bye, Peter Korsgaard