[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH] chattr: Fix the problem that the chattr cannot add -s attributes to the file.
From:       "=?utf-8?B?SVRjeGs=?=" <chunhui_r () foxmail ! com>
Date:       2023-10-12 0:29:28
Message-ID: tencent_5333D0370A6B833A6B1463D018A73E47CC09 () qq ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]

[Attachment #4 (text/plain)]

The chattr command cannot add the -s attribute to the file normally. When you enter "chattr +s testfile",



the content of --help will be displayed directly.




The reason is that commit 83dff7f43154cd41e4d2e5831060a2d2ddc6596e ("lsattr: support more ext2 flags")



changed the enumeration variable order, resulting in an error in the offset obtained in e2fs_lib.h.




Solution 1: Change the offset




The chattr command cannot add the -s attribute to the file normally.




Fixes: 83dff7f43154cd41e4d2e5831060a2d2ddc6596e ("lsattr: support more ext2 flags")




Signed-off-by: ITcxk <chunhui_r@foxmail.com&gt;

---

&nbsp;e2fsprogs/e2fs_lib.h | 8 ++++----

&nbsp;1 file changed, 4 insertions(+), 4 deletions(-)




diff --git a/e2fsprogs/e2fs_lib.h b/e2fsprogs/e2fs_lib.h

index bab447a94..c6b90d389 100644

--- a/e2fsprogs/e2fs_lib.h

+++ b/e2fsprogs/e2fs_lib.h

@@ -21,11 +21,11 @@ extern const char e2attr_flags_sname[];

&nbsp;/* If you plan to ENABLE_COMPRESSION, see e2fs_lib.c and chattr.c - */

&nbsp;/* make sure that chattr doesn't accept bad options! */

&nbsp;#ifdef ENABLE_COMPRESSION

-#define e2attr_flags_value_chattr (&amp;e2attr_flags_value[5])

-#define e2attr_flags_sname_chattr (&amp;e2attr_flags_sname[5])

+#define e2attr_flags_value_chattr (&amp;e2attr_flags_value[3])

+#define e2attr_flags_sname_chattr (&amp;e2attr_flags_sname[3])

&nbsp;#else

-#define e2attr_flags_value_chattr (&amp;e2attr_flags_value[1])

-#define e2attr_flags_sname_chattr (&amp;e2attr_flags_sname[1])

+#define e2attr_flags_value_chattr (&amp;e2attr_flags_value[0])

+#define e2attr_flags_sname_chattr (&amp;e2attr_flags_sname[0])

&nbsp;#endif




&nbsp;POP_SAVED_FUNCTION_VISIBILITY

--

2.37.0 (Apple Git-136)




Solution 2: Replace the devil's numbers




The chattr command cannot add the -s attribute to the file normally.




Fixes: 83dff7f43154cd41e4d2e5831060a2d2ddc6596e ("lsattr: support more ext2 flags")




Signed-off-by: ITcxk <chunhui_r@foxmail.com&gt;

---

&nbsp;e2fsprogs/e2fs_lib.h | 8 ++++----

&nbsp;1 file changed, 4 insertions(+), 4 deletions(-)




diff --git a/e2fsprogs/e2fs_lib.h b/e2fsprogs/e2fs_lib.h

index bab447a94..c6b90d389 100644

--- a/e2fsprogs/e2fs_lib.h

+++ b/e2fsprogs/e2fs_lib.h

@@ -21,11 +21,11 @@ extern const char e2attr_flags_sname[];

&nbsp;/* If you plan to ENABLE_COMPRESSION, see e2fs_lib.c and chattr.c - */

&nbsp;/* make sure that chattr doesn't accept bad options! */

&nbsp;#ifdef ENABLE_COMPRESSION

-#define e2attr_flags_value_chattr (&amp;e2attr_flags_value[5])

-#define e2attr_flags_sname_chattr (&amp;e2attr_flags_sname[5])

+#define e2attr_flags_value_chattr (&amp;EXT2_SECRM_FL)

+#define e2attr_flags_sname_chattr (&amp;EXT2_SECRM_FL)

&nbsp;#else

-#define e2attr_flags_value_chattr (&amp;e2attr_flags_value[1])

-#define e2attr_flags_sname_chattr (&amp;e2attr_flags_sname[1])

+#define e2attr_flags_value_chattr (&amp;EXT2_SECRM_FL)

+#define e2attr_flags_sname_chattr (&amp;EXT2_SECRM_FL)

&nbsp;#endif




&nbsp;POP_SAVED_FUNCTION_VISIBILITY

--

2.37.0
[Attachment #5 (text/html)]

<div style="min-height:22px;margin-bottom:8px;"><p \
style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.3); -webkit-text-size-adjust: \
auto; margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; \
font-family: Menlo; font-size-adjust: none; font-kerning: auto; \
font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;">The chattr command cannot add the -s attribute to \
the file normally. When you enter "chattr +s testfile",</p><p \
style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.3); -webkit-text-size-adjust: \
auto; margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; \
font-family: Menlo; font-size-adjust: none; font-kerning: auto; \
font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;"></p><p style="-webkit-tap-highlight-color: rgba(26, \
26, 26, 0.3); -webkit-text-size-adjust: auto; margin: 0px; font-stretch: normal; \
font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; \
font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;">the content of --help will be displayed \
directly.</p><p style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.3); \
-webkit-text-size-adjust: auto; margin: 0px; font-stretch: normal; font-size: 11px; \
line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; \
font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;"><br  /></p><p style="-webkit-tap-highlight-color: \
rgba(26, 26, 26, 0.3); -webkit-text-size-adjust: auto; margin: 0px; font-stretch: \
normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: \
none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: \
normal; font-variant-numeric: normal; font-variant-east-asian: normal; \
font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: \
auto; font-variation-settings: normal;">The reason is that commit \
83dff7f43154cd41e4d2e5831060a2d2ddc6596e ("lsattr: support more ext2 flags")</p><p \
style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.3); -webkit-text-size-adjust: \
auto; margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; \
font-family: Menlo; font-size-adjust: none; font-kerning: auto; \
font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;"></p><p style="-webkit-tap-highlight-color: rgba(26, \
26, 26, 0.3); -webkit-text-size-adjust: auto; margin: 0px; font-stretch: normal; \
font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; \
font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;">changed the enumeration variable order, resulting \
in an error in the offset obtained in e2fs_lib.h.</p><p \
style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.3); -webkit-text-size-adjust: \
auto; margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; \
font-family: Menlo; font-size-adjust: none; font-kerning: auto; \
font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;"><br  /></p><p style="-webkit-tap-highlight-color: \
rgba(26, 26, 26, 0.3); -webkit-text-size-adjust: auto; margin: 0px; font-stretch: \
normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: \
none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: \
normal; font-variant-numeric: normal; font-variant-east-asian: normal; \
font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: \
auto; font-variation-settings: normal;">Solution 1: Change the offset</p><p \
style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.3); -webkit-text-size-adjust: \
auto; margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; \
font-family: Menlo; font-size-adjust: none; font-kerning: auto; \
font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;"><br  /></p><p style="-webkit-tap-highlight-color: \
rgba(26, 26, 26, 0.3); -webkit-text-size-adjust: auto; margin: 0px; font-stretch: \
normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: \
none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: \
normal; font-variant-numeric: normal; font-variant-east-asian: normal; \
font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: \
auto; font-variation-settings: normal;">The chattr command cannot add the -s \
attribute to the file normally.</p><p style="-webkit-tap-highlight-color: rgba(26, \
26, 26, 0.3); -webkit-text-size-adjust: auto; margin: 0px; font-stretch: normal; \
font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; \
font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal; min-height: 13px;"><br  /></p><p \
style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.3); -webkit-text-size-adjust: \
auto; margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; \
font-family: Menlo; font-size-adjust: none; font-kerning: auto; \
font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;">Fixes: 83dff7f43154cd41e4d2e5831060a2d2ddc6596e \
("lsattr: support more ext2 flags")</p><p style="-webkit-tap-highlight-color: \
rgba(26, 26, 26, 0.3); -webkit-text-size-adjust: auto; margin: 0px; font-stretch: \
normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: \
none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: \
normal; font-variant-numeric: normal; font-variant-east-asian: normal; \
font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: \
auto; font-variation-settings: normal; min-height: 13px;"><br  /></p><p \
style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.3); -webkit-text-size-adjust: \
auto; margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; \
font-family: Menlo; font-size-adjust: none; font-kerning: auto; \
font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;">Signed-off-by: ITcxk &lt;<span \
dir="ltr">chunhui_r@foxmail.com</span>&gt;</p><p style="-webkit-tap-highlight-color: \
rgba(26, 26, 26, 0.3); -webkit-text-size-adjust: auto; margin: 0px; font-stretch: \
normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: \
none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: \
normal; font-variant-numeric: normal; font-variant-east-asian: normal; \
font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: \
auto; font-variation-settings: normal;">---</p><p style="-webkit-tap-highlight-color: \
rgba(26, 26, 26, 0.3); -webkit-text-size-adjust: auto; margin: 0px; font-stretch: \
normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: \
none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: \
normal; font-variant-numeric: normal; font-variant-east-asian: normal; \
font-variant-position: normal; font-feature-settings: normal; font-optical-sizing: \
auto; font-variation-settings: normal;">&nbsp;e2fsprogs/e2fs_lib.h | 8 ++++----</p><p \
style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.3); -webkit-text-size-adjust: \
auto; margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; \
font-family: Menlo; font-size-adjust: none; font-kerning: auto; \
font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;">&nbsp;1 file changed, 4 insertions(+), 4 \
deletions(-)</p><p style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.3); \
-webkit-text-size-adjust: auto; margin: 0px; font-stretch: normal; font-size: 11px; \
line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; \
font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal; min-height: 13px;"><br  /></p><p \
style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.3); -webkit-text-size-adjust: \
auto; margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; \
font-family: Menlo; font-size-adjust: none; font-kerning: auto; \
font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;">diff --git a/e2fsprogs/e2fs_lib.h \
b/e2fsprogs/e2fs_lib.h</p><p style="-webkit-tap-highlight-color: rgba(26, 26, 26, \
0.3); -webkit-text-size-adjust: auto; margin: 0px; font-stretch: normal; font-size: \
11px; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: \
auto; font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;">index bab447a94..c6b90d389 100644</p><p \
style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.3); -webkit-text-size-adjust: \
auto; margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; \
font-family: Menlo; font-size-adjust: none; font-kerning: auto; \
font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;">--- a/e2fsprogs/e2fs_lib.h</p><p \
style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.3); -webkit-text-size-adjust: \
auto; margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; \
font-family: Menlo; font-size-adjust: none; font-kerning: auto; \
font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;">+++ b/e2fsprogs/e2fs_lib.h</p><p \
style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.3); -webkit-text-size-adjust: \
auto; margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; \
font-family: Menlo; font-size-adjust: none; font-kerning: auto; \
font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;">@@ -21,11 +21,11 @@ extern const char \
e2attr_flags_sname[];</p><p style="-webkit-tap-highlight-color: rgba(26, 26, 26, \
0.3); -webkit-text-size-adjust: auto; margin: 0px; font-stretch: normal; font-size: \
11px; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: \
auto; font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;">&nbsp;/* If you plan to ENABLE_COMPRESSION, see \
e2fs_lib.c and chattr.c - */</p><p style="-webkit-tap-highlight-color: rgba(26, 26, \
26, 0.3); -webkit-text-size-adjust: auto; margin: 0px; font-stretch: normal; \
font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; \
font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;">&nbsp;/* make sure that chattr doesn't accept bad \
options! */</p><p style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.3); \
-webkit-text-size-adjust: auto; margin: 0px; font-stretch: normal; font-size: 11px; \
line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; \
font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;">&nbsp;#ifdef ENABLE_COMPRESSION</p><p \
style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.3); -webkit-text-size-adjust: \
auto; margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; \
font-family: Menlo; font-size-adjust: none; font-kerning: auto; \
font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;">-#define e2attr_flags_value_chattr \
(&amp;e2attr_flags_value[5])</p><p style="-webkit-tap-highlight-color: rgba(26, 26, \
26, 0.3); -webkit-text-size-adjust: auto; margin: 0px; font-stretch: normal; \
font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; \
font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; \
font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: \
normal; font-feature-settings: normal; font-optical-sizing: auto; \
font-variation-settings: normal;">-#define e2attr_flags_sname_chattr \
(&amp;e2attr_flags_sname[5])</p><p style="-webkit-tap-highlight-color: rgba(26, 26, \



_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic