sanity: Check for non ascii chars in TOPDIR
PATCH 1/1 sanity: Check for non ascii chars in TOPDIR
Some modules (like Perl's MakeMaker) do not support non ASCII characters in build folder's path, which leads to task failures. A sanity check is added to warn the user.
Fixes [YOCTO #15764]
--- meta/classes-global/sanity.bbclass | 9 +++++++++ 1 file changed, 9 insertions(+)
meta/classes-global/sanity.bbclass +9 -0
@@ -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 unexpected errors, please use a ASCII-only path.\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 + status.addresult(check_non_ascii(topdir, "TOPDIR")) + # Check that TMPDIR isn't located on nfs status.addresult(check_not_nfs(tmpdir, "TMPDIR"))
Quoted 17 lines · Sofiane HAMAM via lists.openembedded.org
Some modules (like Perl's MakeMaker) do not support non ASCII characters in build folder's path, which leads to task failures. A sanity check is added to warn the user.
Fixes [YOCTO #15764]
Signed-off-by Sofiane HAMAM <[email protected]>---
meta/classes-global/sanity.bbclass | 9 +++++++++1 file changed, 9 insertions(+)meta/classes-global/sanity.bbclass +0
-0@@ -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)
Quoted 5 lines
return ""
+defcheck_non_ascii(filepath, pathname):
+ if(notfilepath.isascii()):
+ return "Non-ASCII character(s) in %s path (\"%s\") detected. This would cause unexpected errors, please use a ASCII-only path.\n" % (pathname, filepath)
Thanks for the patch!
I'd rephrase the second sentence to "This would cause build failures as we build software that doesn't support this."
I'd also leave a comment in the code against that check which says that it is Perl MakeMaker that has this issue, just so we know in future why we added this.
Cheers,
Richard