nfs-utils: Fix const qualifier error
PATCH 1/1 nfs-utils: Fix const qualifier error
From: Wang Mingyu <[email protected]>
error with clang:
file.c:200:8: error: assigning to 'char *' from 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
| 200 | base = pathname; | | ^ ~~~~~~~~
--- .../0001-Fix-const-qualifier-error.patch | 35 +++++++++++++++++++ .../nfs-utils/nfs-utils_2.8.2.bb | 1 + 2 files changed, 36 insertions(+) create mode 100644 meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Fix-const-qualifier-error.patch
meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Fix-const-qualifier-error.patch new file +35 -0
@@ -0,0 +1,35 @@ +From a21344466e4c315d6d7098920819983f2d15573b Mon Sep 17 00:00:00 2001 +From: Wang Mingyu <[email protected]> +Date: Thu, 19 Dec 2024 06:18:59 +0000 +Subject: [PATCH] Fix const qualifier error + +Fixes clang error +file.c:200:8: error: assigning to 'char *' from 'const char *' +discards qualifiers +[-Werror,-Wincompatible-pointer-types-discards-qualifiers] +| 200 | base = pathname; +| | ^ ~~~~~~~~ + +Upstream-Status: Pending + +Signed-off-by: Wang Mingyu <[email protected]> +--- + support/nsm/file.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/support/nsm/file.c b/support/nsm/file.c +index de122b0..2733210 100644 +--- a/support/nsm/file.c ++++ b/support/nsm/file.c +@@ -197,7 +197,7 @@ nsm_make_temp_pathname(const char *pathname) + + base = strrchr(pathname, '/'); + if (base == NULL) +- base = pathname; ++ base = (char*)(&pathname); + else + base++; + +-- +2.43.0 +
meta/recipes-connectivity/nfs-utils/nfs-utils_2.8.2.bb +1 -0
@@ -31,6 +31,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.x file://0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch \ file://clang-warnings.patch \ file://0001-locktest-Makefile.am-Do-not-use-build-flags.patch \ + file://0001-Fix-const-qualifier-error.patch \ " SRC_URI[sha256sum] = "a39bbea76ac0ab9e6e8699caf3c308b6b310c20d458e8fa8606196d358e7fb15"
Signature · 1 line
2.43.0
Please do not add new ‘Penfing’ patches. They should be submitted upstream first or there should be an explanation of what is pending.
Alex
Quoted 92 lines · wangmy via lists.openembedded.org
From: Wang Mingyu <[email protected]>
error with clang:
file.c:200:8: error: assigning to 'char *' from 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]| 200 | base = pathname; | | ^ ~~~~~~~~Signed-off-by Wang Mingyu <[email protected]>--- .../0001-Fix-const-qualifier-error.patch | 35 +++++++++++++++++++ .../nfs-utils/nfs-utils_2.8.2.bb | 1 + 2 files changed, 36 insertions(+) create mode 100644
meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Fix-const-qualifier-error.patchdiff --git
a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Fix-const-qualifier-error.patchb/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Fix-const-qualifier-error.patchnew file mode 100644
index 0000000000..8fc327e7aa
---/dev/null
+++b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Fix-const-qualifier-error.patchmeta/recipes-connectivity/nfs-utils/nfs-utils/0001-Fix-const-qualifier-error.patch new file +35
-0@@ -0,0 +1,35 @@ +From a21344466e4c315d6d7098920819983f2d15573b Mon Sep 17 00:00:00 2001 +From: Wang Mingyu <[email protected]> +Date: Thu, 19 Dec 2024 06:18:59 +0000 +Subject: [PATCH] Fix const qualifier error + +Fixes clang error +file.c:200:8: error: assigning to 'char *' from 'const char *' +discards qualifiers +[-Werror,-Wincompatible-pointer-types-discards-qualifiers] +| 200 | base = pathname; +| | ^ ~~~~~~~~ + +Upstream-Status: Pending + +Signed-off-by: Wang Mingyu <[email protected]> +--- + support/nsm/file.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/support/nsm/file.c b/support/nsm/file.c +index de122b0..2733210 100644 +--- a/support/nsm/file.c ++++ b/support/nsm/file.c +@@ -197,7 +197,7 @@ nsm_make_temp_pathname(const char *pathname) + + base = strrchr(pathname, '/'); + if (base == NULL) +- base = pathname; ++ base = (char*)(&pathname); + else + base++; + +-- +2.43.0 +meta/recipes-connectivity/nfs-utils/nfs-utils_2.8.2.bb +0
-0@@ -31,6 +31,7 @@ SRC_URI ="${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.x
file://0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch \ file://clang-warnings.patch \ file://0001-locktest-Makefile.am-Do-not-use-build-flags.patch \ + file://0001-Fix-const-qualifier-error.patch \ "SRC_URI[sha256sum] =
"a39bbea76ac0ab9e6e8699caf3c308b6b310c20d458e8fa8606196d358e7fb15" --
2.43.0-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#208898):
https://lists.openembedded.org/g/openembedded-core/message/208898
Mute This Topic: https://lists.openembedded.org/mt/110195053/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 2 lines · Alexander Kanavin via lists.openembedded.org
Please do not add new ‘Penfing’ patches. They should be submitted upstream first or there should be an explanation of what is pending.
Yeah, i did another patch which is also not correct sadly. Perhaps we need to address it differently than simply trying
type punning.
Quoted 89 lines
Alex
Quoted 71 lines · wangmy via lists.openembedded.org
From: Wang Mingyu <[email protected]>
error with clang:
file.c:200:8: error: assigning to 'char *' from 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]| 200 | base = pathname; | | ^ ~~~~~~~~Signed-off-by Wang Mingyu <[email protected]>--- .../0001-Fix-const-qualifier-error.patch | 35 +++++++++++++++++++ .../nfs-utils/nfs-utils_2.8.2.bb | 1 + 2 files changed, 36 insertions(+) create mode 100644 meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Fix-const-qualifier-error.patchmeta/recipes-connectivity/nfs-utils/nfs-utils/0001-Fix-const-qualifier-error.patch new file +35
-0@@ -0,0 +1,35 @@ +From a21344466e4c315d6d7098920819983f2d15573b Mon Sep 17 00:00:00 2001 +From: Wang Mingyu <[email protected]> +Date: Thu, 19 Dec 2024 06:18:59 +0000 +Subject: [PATCH] Fix const qualifier error + +Fixes clang error +file.c:200:8: error: assigning to 'char *' from 'const char *' +discards qualifiers +[-Werror,-Wincompatible-pointer-types-discards-qualifiers] +| 200 | base = pathname; +| | ^ ~~~~~~~~ + +Upstream-Status: Pending + +Signed-off-by: Wang Mingyu <[email protected]> +--- + support/nsm/file.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/support/nsm/file.c b/support/nsm/file.c +index de122b0..2733210 100644 +--- a/support/nsm/file.c ++++ b/support/nsm/file.c +@@ -197,7 +197,7 @@ nsm_make_temp_pathname(const char *pathname) + + base = strrchr(pathname, '/'); + if (base == NULL) +- base = pathname; ++ base = (char*)(&pathname); + else + base++; + +-- +2.43.0 +meta/recipes-connectivity/nfs-utils/nfs-utils_2.8.2.bb +1
-1@@ -31,6 +31,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.x file://0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch \ file://clang-warnings.patch \ file://0001-locktest-Makefile.am-Do-not-use-build-flags.patch \ + file://0001-Fix-const-qualifier-error.patch \ " SRC_URI[sha256sum] = "a39bbea76ac0ab9e6e8699caf3c308b6b310c20d458e8fa8606196d358e7fb15" --Quoted 5 lines
2.43.0
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#208899): https://lists.openembedded.org/g/openembedded-core/message/208899
Mute This Topic: https://lists.openembedded.org/mt/110195053/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 11 lines · Khem Raj
Quoted 2 lines · Alexander Kanavin via lists.openembedded.org
Please do not add new ‘Penfing’ patches. They should be submitted upstream first or there should be an explanation of what is pending.
Yeah, i did another patch which is also not correct sadly. Perhaps we need to address it differently than simply trying
type punning.
looking a bit closer, it seems changing the type of base from char* to const char* is enough to get types correct. I have send a v2 patch to upstream as well as for oe-core.
Quoted 89 lines
Quoted 89 lines
Alex
Quoted 71 lines · wangmy via lists.openembedded.org
From: Wang Mingyu <[email protected]>
error with clang:
file.c:200:8: error: assigning to 'char *' from 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]| 200 | base = pathname; | | ^ ~~~~~~~~Signed-off-by Wang Mingyu <[email protected]>--- .../0001-Fix-const-qualifier-error.patch | 35 +++++++++++++++++++ .../nfs-utils/nfs-utils_2.8.2.bb | 1 + 2 files changed, 36 insertions(+) create mode 100644 meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Fix-const-qualifier-error.patchmeta/recipes-connectivity/nfs-utils/nfs-utils/0001-Fix-const-qualifier-error.patch new file +35
-0@@ -0,0 +1,35 @@ +From a21344466e4c315d6d7098920819983f2d15573b Mon Sep 17 00:00:00 2001 +From: Wang Mingyu <[email protected]> +Date: Thu, 19 Dec 2024 06:18:59 +0000 +Subject: [PATCH] Fix const qualifier error + +Fixes clang error +file.c:200:8: error: assigning to 'char *' from 'const char *' +discards qualifiers +[-Werror,-Wincompatible-pointer-types-discards-qualifiers] +| 200 | base = pathname; +| | ^ ~~~~~~~~ + +Upstream-Status: Pending + +Signed-off-by: Wang Mingyu <[email protected]> +--- + support/nsm/file.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/support/nsm/file.c b/support/nsm/file.c +index de122b0..2733210 100644 +--- a/support/nsm/file.c ++++ b/support/nsm/file.c +@@ -197,7 +197,7 @@ nsm_make_temp_pathname(const char *pathname) + + base = strrchr(pathname, '/'); + if (base == NULL) +- base = pathname; ++ base = (char*)(&pathname); + else + base++; + +-- +2.43.0 +meta/recipes-connectivity/nfs-utils/nfs-utils_2.8.2.bb +1
-1@@ -31,6 +31,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.x file://0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch \ file://clang-warnings.patch \ file://0001-locktest-Makefile.am-Do-not-use-build-flags.patch \ + file://0001-Fix-const-qualifier-error.patch \ " SRC_URI[sha256sum] = "a39bbea76ac0ab9e6e8699caf3c308b6b310c20d458e8fa8606196d358e7fb15" --Quoted 5 lines
2.43.0
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#208899): https://lists.openembedded.org/g/openembedded-core/message/208899
Mute This Topic: https://lists.openembedded.org/mt/110195053/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-