Skip to contentSkip to conversation

icu: increase pkgdata command buffer size

PATCH Superseded Joe Slater 3 participants 4 messages Aug 23, 2021 – Aug 25, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Joe Slater

author
#0 lore raw

PATCH 1/1 icu: increase pkgdata command buffer size

Mitigate pathname truncation when installing in a project with a very long pathname. The patch is on the master branch, but they have moved to a later version of icu so we cannot cherry-pick.

---
 ...pkgdata-increase-command-buffer-size.patch | 43 +++++++++++++++++++
 meta/recipes-support/icu/icu_68.2.bb          |  1 +
 2 files changed, 44 insertions(+)
 create mode 100644 meta/recipes-support/icu/icu/0001-pkgdata-increase-command-buffer-size.patch
meta/recipes-support/icu/icu/0001-pkgdata-increase-command-buffer-size.patch new file +43 -0
new file mode 100644
index 0000000000..ea68e4be9f
@@ -0,0 +1,43 @@
+From ab6b1acdeed76899f8227c38ab7e7675c7673ff1 Mon Sep 17 00:00:00 2001
+From: Joe Slater <[email protected]>
+Date: Thu, 5 Aug 2021 09:23:48 -0700
+Subject: [PATCH 1/1] pkgdata: increase command buffer size
+
+Make cmd LARGE_BUFFER_SIZE to avoid pathname truncation
+when install paths are longer than about 150 characters.
+
+Upstream-Status: Pending
+
+Signed-off-by: Joe Slater <[email protected]>
+---
+ source/tools/pkgdata/pkgdata.cpp | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/source/tools/pkgdata/pkgdata.cpp b/source/tools/pkgdata/pkgdata.cpp
+index 5ab682e..d4b70ef 100644
+--- a/tools/pkgdata/pkgdata.cpp
++++ b/tools/pkgdata/pkgdata.cpp
+@@ -1131,17 +1131,17 @@ normal_symlink_mode:
+ 
+ static int32_t pkg_installLibrary(const char *installDir, const char *targetDir, UBool noVersion) {
+     int32_t result = 0;
+-    char cmd[SMALL_BUFFER_MAX_SIZE];
++    char cmd[LARGE_BUFFER_MAX_SIZE];
+ 
+     auto ret = snprintf(cmd,
+-            SMALL_BUFFER_MAX_SIZE,
++            LARGE_BUFFER_MAX_SIZE,
+             "cd %s && %s %s %s%s%s",
+             targetDir,
+             pkgDataFlags[INSTALL_CMD],
+             libFileNames[LIB_FILE_VERSION],
+             installDir, PKGDATA_FILE_SEP_STRING, libFileNames[LIB_FILE_VERSION]);
+     (void)ret;
+-    U_ASSERT(0 <= ret && ret < SMALL_BUFFER_MAX_SIZE);
++    U_ASSERT(0 <= ret && ret < LARGE_BUFFER_MAX_SIZE);
+ 
+     result = runCommand(cmd);
+ 
+-- 
+2.29.2
+
meta/recipes-support/icu/icu_68.2.bb +1 -0
index 1ca87feee4..130212d245 100644
@@ -107,6 +107,7 @@ SRC_URI = "${BASE_SRC_URI};name=code \
            file://filter.json \
            file://fix-install-manx.patch \
            file://0001-icu-Added-armeb-support.patch \
+           file://0001-pkgdata-increase-command-buffer-size.patch \
            "
 
 SRC_URI_append_class-target = "\
Signature · 1 line
2.31.1
#1 lore raw

Hi Joe,

Quoted 22 lines · Joe Slater

Mitigate pathname truncation when installing in a project with a very long pathname.  The patch is on the master branch, but they have moved to a later version of icu so we cannot cherry-pick.

---
 ...pkgdata-increase-command-buffer-size.patch | 43 +++++++++++++++++++ meta/recipes-support/icu/icu_68.2.bb          |  1 +

 2 files changed, 44 insertions(+)

 create mode 100644 meta/recipes-support/icu/icu/0001-pkgdata-increase- command-buffer-size.patch

(quoted diff) +0 -0

command-buffer-size.patch b/meta/recipes-support/icu/icu/0001-pkgdata- increase-command-buffer-size.patch
new file mode 100644
index 0000000000..ea68e4be9f

meta/recipes-support/icu/icu/0001-pkgdata-increase-command- new file +0 -0

buffer-size.patch

meta/recipes-support/icu/icu/0001-pkgdata-increase-command- line 9

Quoted 9 lines
meta/recipes-support/icu/icu/0001-pkgdata-increase-command- new file +9 -0
@@ -0,0 +1,43 @@
+From ab6b1acdeed76899f8227c38ab7e7675c7673ff1 Mon Sep 17 00:00:00 2001
+From: Joe Slater <[email protected]>
+Date: Thu, 5 Aug 2021 09:23:48 -0700
+Subject: [PATCH 1/1] pkgdata: increase command buffer size
+
+Make cmd LARGE_BUFFER_SIZE to avoid pathname truncation
+when install paths are longer than about 150 characters.
+
+Upstream-Status: Pending

I think there was a comment from Alex on the original patch for master requesting this be sent upstream first. Can you do that please?

Thanks,

Anuj

Quoted 53 lines
meta/recipes-support/icu/icu/0001-pkgdata-increase-command- new file +7 -0
+
+Signed-off-by: Joe Slater <[email protected]>
+---
+ source/tools/pkgdata/pkgdata.cpp | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/source/tools/pkgdata/pkgdata.cpp

b/source/tools/pkgdata/pkgdata.cpp
+index 5ab682e..d4b70ef 100644
+--- a/tools/pkgdata/pkgdata.cpp
++++ b/tools/pkgdata/pkgdata.cpp
+@@ -1131,17 +1131,17 @@ normal_symlink_mode:
+
+ static int32_t pkg_installLibrary(const char *installDir, const char *targetDir, UBool noVersion) {
+     int32_t result = 0;
+-    char cmd[SMALL_BUFFER_MAX_SIZE];
++    char cmd[LARGE_BUFFER_MAX_SIZE];
+
+     auto ret = snprintf(cmd,
+-            SMALL_BUFFER_MAX_SIZE,
++            LARGE_BUFFER_MAX_SIZE,
+             "cd %s && %s %s %s%s%s",
+             targetDir,
+             pkgDataFlags[INSTALL_CMD],
+             libFileNames[LIB_FILE_VERSION],
+             installDir, PKGDATA_FILE_SEP_STRING, libFileNames[LIB_FILE_VERSION]);
+     (void)ret;
+-    U_ASSERT(0 <= ret && ret < SMALL_BUFFER_MAX_SIZE);
++    U_ASSERT(0 <= ret && ret < LARGE_BUFFER_MAX_SIZE);
+
+     result = runCommand(cmd);
+
+--
+2.29.2

meta/recipes-support/icu/icu/0001-pkgdata-increase-command- new file +1 -0
+
meta/recipes- renamed from meta/recipes-support/icu/icu_68.2.bb +0 -0

support/icu/icu_68.2.bb
index 1ca87feee4..130212d245 100644

meta/recipes-support/icu/icu_68.2.bb +1 -0
@@ -107,6 +107,7 @@ SRC_URI = "${BASE_SRC_URI};name=code \
             file://filter.json \
             file://fix-install-manx.patch \
             file://0001-icu-Added-armeb-support.patch \
+           file://0001-pkgdata-increase-command-buffer-size.patch \

            "

 SRC_URI_append_class-target = "\

author
#2 lore raw

https://unicode-org.atlassian.net/browse/ICU-21702 has been accepted. My patch just mitigates the problem but does not take care of issues around lack of error reporting.

Joe

Quoted 105 lines

-----Original Message-----
From: Mittal, Anuj <[email protected]>
Sent: Monday, August 23, 2021 9:04 PM
To: Slater, Joseph <[email protected]>; openembedded- [email protected]
Cc: MacLeod, Randy <[email protected]>
Subject: Re: [oe-core][hardknott][PATCH 1/1] icu: increase pkgdata command buffer size

Hi Joe,

Quoted 23 lines · Joe Slater

Mitigate pathname truncation when installing in a project with a very long pathname.  The patch is on the master branch, but they have moved to a later version of icu so we cannot cherry-pick.

---
 ...pkgdata-increase-command-buffer-size.patch | 43
+++++++++++++++++++
 meta/recipes-support/icu/icu_68.2.bb          |  1 +

 2 files changed, 44 insertions(+)

 create mode 100644 meta/recipes-support/icu/icu/0001-pkgdata-increase- command-buffer-size.patch

(quoted diff) +0 -0

command-buffer-size.patch b/meta/recipes-support/icu/icu/0001-pkgdata- increase-command-buffer-size.patch
new file mode 100644
index 0000000000..ea68e4be9f

meta/recipes-support/icu/icu/0001-pkgdata-increase-command- new file +0 -0

buffer-size.patch

meta/recipes-support/icu/icu/0001-pkgdata-increase-command- line 10

Quoted 10 lines
meta/recipes-support/icu/icu/0001-pkgdata-increase-command- new file +10 -0
@@ -0,0 +1,43 @@
+From ab6b1acdeed76899f8227c38ab7e7675c7673ff1 Mon Sep 17 00:00:00
+2001
+From: Joe Slater <[email protected]>
+Date: Thu, 5 Aug 2021 09:23:48 -0700
+Subject: [PATCH 1/1] pkgdata: increase command buffer size
+
+Make cmd LARGE_BUFFER_SIZE to avoid pathname truncation when install
+paths are longer than about 150 characters.
+
+Upstream-Status: Pending

I think there was a comment from Alex on the original patch for master requesting this be sent upstream first. Can you do that please?

Thanks,

Anuj

Quoted 52 lines
meta/recipes-support/icu/icu/0001-pkgdata-increase-command- new file +7 -0
+
+Signed-off-by: Joe Slater <[email protected]>
+---
+ source/tools/pkgdata/pkgdata.cpp | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/source/tools/pkgdata/pkgdata.cpp

b/source/tools/pkgdata/pkgdata.cpp

meta/recipes-support/icu/icu/0001-pkgdata-increase-command- new file +6 -0
+index 5ab682e..d4b70ef 100644
+--- a/tools/pkgdata/pkgdata.cpp
++++ b/tools/pkgdata/pkgdata.cpp
+@@ -1131,17 +1131,17 @@ normal_symlink_mode:
+
+ static int32_t pkg_installLibrary(const char *installDir, const char

*targetDir, UBool noVersion) {
+     int32_t result = 0;
+-    char cmd[SMALL_BUFFER_MAX_SIZE];
++    char cmd[LARGE_BUFFER_MAX_SIZE];
+
+     auto ret = snprintf(cmd,
+-            SMALL_BUFFER_MAX_SIZE,
++            LARGE_BUFFER_MAX_SIZE,
+             "cd %s && %s %s %s%s%s",
+             targetDir,
+             pkgDataFlags[INSTALL_CMD],
+             libFileNames[LIB_FILE_VERSION],
+             installDir, PKGDATA_FILE_SEP_STRING, libFileNames[LIB_FILE_VERSION]);
+     (void)ret;
+-    U_ASSERT(0 <= ret && ret < SMALL_BUFFER_MAX_SIZE); ++    U_ASSERT(0 <= ret && ret < LARGE_BUFFER_MAX_SIZE);

meta/recipes-support/icu/icu/0001-pkgdata-increase-command- new file +6 -0
+
+     result = runCommand(cmd);
+
+--
+2.29.2
+
meta/recipes- renamed from meta/recipes-support/icu/icu_68.2.bb +0 -0

support/icu/icu_68.2.bb index 1ca87feee4..130212d245 100644

meta/recipes-support/icu/icu_68.2.bb +1 -0
@@ -107,6 +107,7 @@ SRC_URI = "${BASE_SRC_URI};name=code \
             file://filter.json \
             file://fix-install-manx.patch \
             file://0001-icu-Added-armeb-support.patch \
+           file://0001-pkgdata-increase-command-buffer-size.patch \

            "

 SRC_URI_append_class-target = "\

#3 lore raw
Quoted 3 lines · Joseph

https://unicode-org.atlassian.net/browse/ICU-21702 has been accepted. My patch just mitigates the problem but does not take care of issues around lack of error reporting.

Joe

That's good. Can you update the patch to include that link and pick a different Upstream-Status:  such as "Submitted"

https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines#Patch_Header_Recommendations:_Upstream-Status

so that when we eventually update we know where to check if the change was made.

Thanks,

../Randy

Quoted 105 lines
Quoted 105 lines

-----Original Message-----
From: Mittal, Anuj <[email protected]>
Sent: Monday, August 23, 2021 9:04 PM
To: Slater, Joseph <[email protected]>; openembedded- [email protected]
Cc: MacLeod, Randy <[email protected]>
Subject: Re: [oe-core][hardknott][PATCH 1/1] icu: increase pkgdata command buffer size

Hi Joe,

Quoted 23 lines · Joe Slater

Mitigate pathname truncation when installing in a project with a very long pathname.  The patch is on the master branch, but they have moved to a later version of icu so we cannot cherry-pick.

---
  ...pkgdata-increase-command-buffer-size.patch | 43
+++++++++++++++++++
  meta/recipes-support/icu/icu_68.2.bb          |  1 +
  2 files changed, 44 insertions(+)

 create mode 100644
meta/recipes-support/icu/icu/0001-pkgdata-increase- command-buffer-size.patch

(quoted diff) +0 -0

command-buffer-size.patch b/meta/recipes-support/icu/icu/0001-pkgdata- increase-command-buffer-size.patch
new file mode 100644
index 0000000000..ea68e4be9f

meta/recipes-support/icu/icu/0001-pkgdata-increase-command- new file +0 -0

buffer-size.patch

meta/recipes-support/icu/icu/0001-pkgdata-increase-command- line 10

Quoted 10 lines
meta/recipes-support/icu/icu/0001-pkgdata-increase-command- new file +10 -0
@@ -0,0 +1,43 @@
+From ab6b1acdeed76899f8227c38ab7e7675c7673ff1 Mon Sep 17 00:00:00
+2001
+From: Joe Slater <[email protected]>
+Date: Thu, 5 Aug 2021 09:23:48 -0700
+Subject: [PATCH 1/1] pkgdata: increase command buffer size
+
+Make cmd LARGE_BUFFER_SIZE to avoid pathname truncation when install
+paths are longer than about 150 characters.
+
+Upstream-Status: Pending

I think there was a comment from Alex on the original patch for master requesting this be sent upstream first. Can you do that please?

Thanks,

Anuj

Quoted 52 lines
meta/recipes-support/icu/icu/0001-pkgdata-increase-command- new file +7 -0
+
+Signed-off-by: Joe Slater <[email protected]>
+---
+ source/tools/pkgdata/pkgdata.cpp | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/source/tools/pkgdata/pkgdata.cpp

b/source/tools/pkgdata/pkgdata.cpp

meta/recipes-support/icu/icu/0001-pkgdata-increase-command- new file +6 -0
+index 5ab682e..d4b70ef 100644
+--- a/tools/pkgdata/pkgdata.cpp
++++ b/tools/pkgdata/pkgdata.cpp
+@@ -1131,17 +1131,17 @@ normal_symlink_mode:
+
+ static int32_t pkg_installLibrary(const char *installDir, const char

*targetDir, UBool noVersion) {
+     int32_t result = 0;
+-    char cmd[SMALL_BUFFER_MAX_SIZE];
++    char cmd[LARGE_BUFFER_MAX_SIZE];
+
+     auto ret = snprintf(cmd,
+-            SMALL_BUFFER_MAX_SIZE,
++            LARGE_BUFFER_MAX_SIZE,
+             "cd %s && %s %s %s%s%s",
+             targetDir,
+             pkgDataFlags[INSTALL_CMD],
+             libFileNames[LIB_FILE_VERSION],
+             installDir, PKGDATA_FILE_SEP_STRING, libFileNames[LIB_FILE_VERSION]);
+     (void)ret;
+-    U_ASSERT(0 <= ret && ret < SMALL_BUFFER_MAX_SIZE); ++    U_ASSERT(0 <= ret && ret < LARGE_BUFFER_MAX_SIZE);

meta/recipes-support/icu/icu/0001-pkgdata-increase-command- new file +6 -0
+
+     result = runCommand(cmd);
+
+--
+2.29.2
+
meta/recipes- renamed from meta/recipes-support/icu/icu_68.2.bb +0 -0

support/icu/icu_68.2.bb index 1ca87feee4..130212d245 100644

meta/recipes-support/icu/icu_68.2.bb +1 -0
@@ -107,6 +107,7 @@ SRC_URI = "${BASE_SRC_URI};name=code \
             file://filter.json \
             file://fix-install-manx.patch \
             file://0001-icu-Added-armeb-support.patch \
+           file://0001-pkgdata-increase-command-buffer-size.patch \
             "
 
  SRC_URI_append_class-target = "\
Signature · 2 lines
# Randy MacLeod
# Wind River Linux