diff mbox series

[v2] sanity: Check for non ascii chars in TOPDIR

Message ID 20250219123102.3288782-2-sofiane.hamam@smile.fr
State Accepted, archived
Commit 2b3be97a0d0d60d026786a4465b24b6f6752ba32
Headers show
Series [v2] sanity: Check for non ascii chars in TOPDIR | expand

Commit Message

Sofiane HAMAM Feb. 19, 2025, 12:31 p.m. UTC
Some modules (like Perl's MakeMaker) do not support non ASCII
characters in build folder's path, this would cause build failures
of software that does not support non ASCII.
A sanity check is added to warn the user.

Fixes [YOCTO #15764]

Signed-off-by: Sofiane HAMAM <sofiane.hamam@smile.fr>
---
 meta/classes-global/sanity.bbclass | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Yoann Congal Feb. 19, 2025, 12:34 p.m. UTC | #1
Le mer. 19 févr. 2025 à 13:31, Sofiane HAMAM via lists.openembedded.org
<sofiane.hamam=smile.fr@lists.openembedded.org> a écrit :

> Some modules (like Perl's MakeMaker) do not support non ASCII
> characters in build folder's path, this would cause build failures
> of software that does not support non ASCII.
> A sanity check is added to warn the user.
>
> Fixes [YOCTO #15764]
>
> Signed-off-by: Sofiane HAMAM <sofiane.hamam@smile.fr>
>

Reviewed-by: Yoann Congal <yoann.congal@smile.fr>


> ---
>  meta/classes-global/sanity.bbclass | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/meta/classes-global/sanity.bbclass
> b/meta/classes-global/sanity.bbclass
> index 66693fc9b9..1bae998f74 100644
> --- a/meta/classes-global/sanity.bbclass
> +++ b/meta/classes-global/sanity.bbclass
> @@ -299,6 +299,11 @@ def check_path_length(filepath, pathname, limit):
>          return "The length of %s is longer than %s, this would cause
> unexpected errors, please use a shorter path.\n" % (pathname, limit)
>      return ""
>
> +def check_non_ascii(filepath, pathname):
> +    if(not filepath.isascii()):
> +        return "Non-ASCII character(s) in %s path (\"%s\") detected. This
> would cause build failures as we build software that doesn't support
> this.\n" % (pathname, filepath)
> +    return ""
> +
>  def get_filesystem_id(path):
>      import subprocess
>      try:
> @@ -719,6 +724,7 @@ def check_sanity_version_change(status, d):
>      # Check that TMPDIR isn't on a filesystem with limited filename
> length (eg. eCryptFS)
>      import stat
>      tmpdir = d.getVar('TMPDIR')
> +    topdir = d.getVar('TOPDIR')
>      status.addresult(check_create_long_filename(tmpdir, "TMPDIR"))
>      tmpdirmode = os.stat(tmpdir).st_mode
>      if (tmpdirmode & stat.S_ISGID):
> @@ -785,6 +791,9 @@ def check_sanity_version_change(status, d):
>      # The length of TMPDIR can't be longer than 400
>      status.addresult(check_path_length(tmpdir, "TMPDIR", 400))
>
> +    # Check that TOPDIR does not contain non ascii chars (perl_5.40.0,
> Perl-native and shadow-native build failures)
> +    status.addresult(check_non_ascii(topdir, "TOPDIR"))
> +
>      # Check that TMPDIR isn't located on nfs
>      status.addresult(check_not_nfs(tmpdir, "TMPDIR"))
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#211703):
> https://lists.openembedded.org/g/openembedded-core/message/211703
> Mute This Topic: https://lists.openembedded.org/mt/111268354/4316185
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> yoann.congal@smile.fr]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
diff mbox series

Patch

diff --git a/meta/classes-global/sanity.bbclass b/meta/classes-global/sanity.bbclass
index 66693fc9b9..1bae998f74 100644
--- a/meta/classes-global/sanity.bbclass
+++ b/meta/classes-global/sanity.bbclass
@@ -299,6 +299,11 @@  def check_path_length(filepath, pathname, limit):
         return "The length of %s is longer than %s, this would cause unexpected errors, please use a shorter path.\n" % (pathname, limit)
     return ""
 
+def check_non_ascii(filepath, pathname):
+    if(not filepath.isascii()):
+        return "Non-ASCII character(s) in %s path (\"%s\") detected. This would cause build failures as we build software that doesn't support this.\n" % (pathname, filepath)
+    return ""
+
 def get_filesystem_id(path):
     import subprocess
     try:
@@ -719,6 +724,7 @@  def check_sanity_version_change(status, d):
     # Check that TMPDIR isn't on a filesystem with limited filename length (eg. eCryptFS)
     import stat
     tmpdir = d.getVar('TMPDIR')
+    topdir = d.getVar('TOPDIR')
     status.addresult(check_create_long_filename(tmpdir, "TMPDIR"))
     tmpdirmode = os.stat(tmpdir).st_mode
     if (tmpdirmode & stat.S_ISGID):
@@ -785,6 +791,9 @@  def check_sanity_version_change(status, d):
     # The length of TMPDIR can't be longer than 400
     status.addresult(check_path_length(tmpdir, "TMPDIR", 400))
 
+    # Check that TOPDIR does not contain non ascii chars (perl_5.40.0, Perl-native and shadow-native build failures)
+    status.addresult(check_non_ascii(topdir, "TOPDIR"))
+
     # Check that TMPDIR isn't located on nfs
     status.addresult(check_not_nfs(tmpdir, "TMPDIR"))