icu 3.6: do_install failed: Segmentation fault
cover icu 3.6: do_install failed: Segmentation fault
The following changes since commit f4b5afe46ff018570c1949653eb6995428827f6f:
sanity.bbclass: Increase LAYER_CONF_VERSION to match bblayers change (2012-06-25 17:20:06 +0100)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib robert/icu
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/icu
Robert Yang (2):
icu 3.6: dropp apply=yes from path
icu 3.6: do_install failed: Segmentation fault
.../icu/files/larger-cmd-size.patch | 27 ++++++++++++++++++++ meta/recipes-support/icu/icu-3.6.inc | 9 ++++-- meta/recipes-support/icu/icu_3.6.bb | 2 +- 3 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 meta/recipes-support/icu/files/larger-cmd-size.patch
PATCH 1/2 icu 3.6: dropp apply=yes from path
The "apply=yes" doesn't appear to be necessary, so drop it.
[YOCTO #2664]
--- meta/recipes-support/icu/icu-3.6.inc | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
meta/recipes-support/icu/icu-3.6.inc +5 -3
@@ -3,11 +3,13 @@ DESCRIPTION = "The International Component for Unicode (ICU) is a mature, portab HOMEPAGE = "http://www-01.ibm.com/software/globalization/icu/index.jsp" BASE_SRC_URI = "ftp://ftp.software.ibm.com/software/globalization/icu/3.6/icu4c-3_6-src.tgz \ - file://gccfix.patch;apply=yes \ + file://gccfix.patch \ file://fix-parallel-build.patch \ - file://use-g++-for-linking.patch;apply=yes" + file://use-g++-for-linking.patch \ + " SRC_URI = "${BASE_SRC_URI} \ - file://noldlibpath.patch;apply=yes" + file://noldlibpath.patch \ + " SRC_URI_virtclass-native = "${BASE_SRC_URI}" LICENSE = "ICU"
Signature · 1 line
1.7.1
PATCH 2/2 icu 3.6: do_install failed: Segmentation fault
In reply to Robert YangThere is a "Segmentation fault" error when the tmpdir is longer than 470 (or less), this is because it used "char cmd[1024]" which is not enough for the command line. Allocate a larger memory size should fix this problem.
[YOCTO #2664]
--- .../icu/files/larger-cmd-size.patch | 27 ++++++++++++++++++++ meta/recipes-support/icu/icu-3.6.inc | 1 + meta/recipes-support/icu/icu_3.6.bb | 2 +- 3 files changed, 29 insertions(+), 1 deletions(-) create mode 100644 meta/recipes-support/icu/files/larger-cmd-size.patch
meta/recipes-support/icu/files/larger-cmd-size.patch new file +27 -0
@@ -0,0 +1,27 @@ +Allocate a larger memory size for cmd + +The length of the command line can be longer than 1024 sometimes, +which will cause a "Segmentation fault" error. + +Signed-off-by: Robert Yang <[email protected]> + +Upstream-Status: Pending +--- + tools/pkgdata/pkgdata.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/pkgdata/pkgdata.c b/tools/pkgdata/pkgdata.c +--- a/tools/pkgdata/pkgdata.c ++++ b/tools/pkgdata/pkgdata.c +@@ -439,7 +439,7 @@ main(int argc, char* argv[]) { + /* POSIX - execute makefile */ + static int executeMakefile(const UPKGOptions *o) + { +- char cmd[1024]; ++ char cmd[BUFSIZ]; + /*char pwd[1024];*/ + const char *make; + int rc; +-- +1.7.10.2 +
meta/recipes-support/icu/icu-3.6.inc +1 -0
@@ -6,6 +6,7 @@ BASE_SRC_URI = "ftp://ftp.software.ibm.com/software/globalization/icu/3.6/icu4c- file://gccfix.patch \ file://fix-parallel-build.patch \ file://use-g++-for-linking.patch \ + file://larger-cmd-size.patch \ " SRC_URI = "${BASE_SRC_URI} \ file://noldlibpath.patch \
meta/recipes-support/icu/icu_3.6.bb +1 -1
@@ -1,6 +1,6 @@ require icu-3.6.inc -PR = "r8" +PR = "r9" SRC_URI[md5sum] = "6243f7a19e03e05403ce84e597510d4c" SRC_URI[sha256sum] = "5135e8d69d6206d320515df7aeee7027711ab1aef9d8dbf29571a97a9746b041"
Signature · 1 line
1.7.1
Quoted 31 lines · Robert Yang
There is a "Segmentation fault" error when the tmpdir is longer than 470 (or less), this is because it used "char cmd[1024]" which is not enough for the command line. Allocate a larger memory size should fix this problem.
[YOCTO #2664]
Signed-off-by Robert Yang<[email protected]>--- .../icu/files/larger-cmd-size.patch | 27 ++++++++++++++++++++ meta/recipes-support/icu/icu-3.6.inc | 1 + meta/recipes-support/icu/icu_3.6.bb | 2 +- 3 files changed, 29 insertions(+), 1 deletions(-)create mode 100644
meta/recipes-support/icu/files/larger-cmd-size.patchmeta/recipes-support/icu/files/larger-cmd-size.patch new file +11
-0@@ -0,0 +1,27 @@ +Allocate a larger memory size for cmd + +The length of the command line can be longer than 1024 sometimes, +which will cause a "Segmentation fault" error. + +Signed-off-by: Robert Yang<[email protected]> + +Upstream-Status: Pending +--- + tools/pkgdata/pkgdata.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-support/icu/files/larger-cmd-size.patch line 21
Quoted 10 lines
meta/recipes-support/icu/files/larger-cmd-size.patch new file +10
-0+ +diff --git a/tools/pkgdata/pkgdata.c b/tools/pkgdata/pkgdata.c +--- a/tools/pkgdata/pkgdata.c ++++ b/tools/pkgdata/pkgdata.c +@@ -439,7 +439,7 @@ main(int argc, char* argv[]) { + /* POSIX - execute makefile */ + static int executeMakefile(const UPKGOptions *o) + { +- char cmd[1024]; ++ char cmd[BUFSIZ];
I've changed the cmd[BUFSIZ] to cmd[2048], which should be enough for us, and pushed it to the git repo again:
git://git.pokylinux.org/poky-contrib robert/icu
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/icu
// Robert
Quoted 30 lines
meta/recipes-support/icu/files/larger-cmd-size.patch new file +6
-0+ /*char pwd[1024];*/ + const char *make; + int rc; +-- +1.7.10.2 +meta/recipes-support/icu/icu-3.6.inc +1
-0@@ -6,6 +6,7 @@ BASE_SRC_URI = "ftp://ftp.software.ibm.com/software/globalization/icu/3.6/icu4c- file://gccfix.patch \ file://fix-parallel-build.patch \ file://use-g++-for-linking.patch \ + file://larger-cmd-size.patch \ " SRC_URI = "${BASE_SRC_URI} \ file://noldlibpath.patch \meta/recipes-support/icu/icu_3.6.bb +1
-1@@ -1,6 +1,6 @@ require icu-3.6.inc -PR = "r8" +PR = "r9" SRC_URI[md5sum] = "6243f7a19e03e05403ce84e597510d4c" SRC_URI[sha256sum] = "5135e8d69d6206d320515df7aeee7027711ab1aef9d8dbf29571a97a9746b041"
Quoted 3 lines · Robert Yang
I've changed the cmd[BUFSIZ] to cmd[2048], which should be enough for us, and
pushed it to the git repo again:
ideally allocating a string on heap and then freeing it after use would fix this issue once for all.
Quoted 8 lines · Khem Raj
Quoted 3 lines · Robert Yang
I've changed the cmd[BUFSIZ] to cmd[2048], which should be enough for us, and
pushed it to the git repo again:ideally allocating a string on heap and then freeing it after use would fix this issue once for all.
Thanks Khem, but the problem is that even we use:
void *malloc(size_t size)
We should still use a constant size since the length of the command is unknown (or not obviously known):
#else
sprintf(cmd, "%s %s%s -f %s %s %s %s %s",
make,
o->install ? "INSTALLTO=" : "",
o->install ? o->install : "",
o->makeFile,
o->clean ? "clean" : "",
o->rebuild ? "rebuild" : "",
o->install ? "install" : "",
o->makeArgs);So I simply increase the size of cmd[] which is a simple fix.
// Robert
Quoted 6 lines
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Quoted 2 lines · Robert Yang
We should still use a constant size since the length of the command is unknown (or not obviously known):
thats the point. Cant you use srtlen(cmd) ?
Quoted 6 lines · Khem Raj
Quoted 2 lines · Robert Yang
We should still use a constant size since the length of the command is unknown (or not obviously known):
thats the point. Cant you use srtlen(cmd) ?
I'm afraid not, as the code shows below, we should strlen() each component of the cmd:
sprintf(cmd, "%s %s%s -f %s %s %s %s %s",
make,
o->install ? "INSTALLTO=" : "",
o->install ? o->install : "",
o->makeFile,
o->clean ? "clean" : "",
o->rebuild ? "rebuild" : "",
o->install ? "install" : "",
o->makeArgs);and this is only the part for linux os, it still has similar parts for U_WINDOWS and OS400 (the component are different), if we strlen() each one of them, that would make it complicated. the icu pkg does use many malloc() in the other part of code, but it uses the char array here, I think that maybe this is the reason.
// Robert
Quoted 1 line
Quoted 28 lines · Robert Yang
Quoted 10 lines · Khem Raj
Quoted 3 lines · Robert Yang
We should still use a constant size since the length of the command is unknown (or not obviously known):
thats the point. Cant you use srtlen(cmd) ?
I'm afraid not, as the code shows below, we should
strlen()each component of the cmd:sprintf(cmd, "%s %s%s -f %s %s %s %s %s",
make,
o->install ? "INSTALLTO=" : "",
o->install ?o->install: "",
o->makeFile,
o->clean ? "clean" : "",
o->rebuild ? "rebuild" : "",
o->install ? "install" : "",
o->makeArgs);
Quoted 6 lines
and this is only the part for linux os, it still has similar parts for
U_WINDOWSand OS400 (the component are different), if westrlen()each one of them, that would make it complicated. the icu pkg does use manymalloc()in the other part of code, but it uses the char array here, I think that maybe this is the reason.
OK its fine what you have
Quoted 4 lines
// Robert
Quoted 1 line
Quoted 16 lines · Robert Yang
The following changes since commit
f4b5afe46ff018570c1949653eb6995428827f6f:sanity.bbclass: Increase LAYER_CONF_VERSION to match bblayers change (2012-06-25 17:20:06 +0100)are available in the git repository at:
git://git.pokylinux.org/poky-contribrobert/icu
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/icuRobert Yang (2):
icu 3.6: dropp apply=yes from path
icu 3.6:do_installfailed: Segmentation fault.../icu/files/larger-cmd-size.patch | 27 ++++++++++++++++++++ meta/recipes-support/icu/icu-3.6.inc | 9 ++++-- meta/recipes-support/icu/icu_3.6.bb | 2 +- 3 files changed, 34 insertions(+), 4 deletions(-)
Quoted 9 lines
create mode 100644
meta/recipes-support/icu/files/larger-cmd-size.patch_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Merged into OE-Core the latest version with 2048
Thanks
Sau!