diff mbox series

[scarthgap,master,2/2] apt: runtime error: filename too long (tmpdir length)

Message ID 20240618033019.1181198-3-changqing.li@windriver.com
State Superseded
Delegated to: Steve Sakoman
Headers show
Series apt: Take back two old patches | expand

Commit Message

Changqing Li June 18, 2024, 3:30 a.m. UTC
From: Changqing Li <changqing.li@windriver.com>

when the tmpdir dir is longer than 220, there is no files saved in
tmp/sysroots/x86_64-linux/var/lib/apt/lists/ after run apt-get update,
this is because apt-get uses the path as the file name, but the file
name can't be longer than 255 according to /usr/include/linux/limits.h.

[YOCTO #2688]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>

Take back from https://git.openembedded.org/openembedded-core/commit/?id=9a0c0393871eda4bbcecfdd4b595f0c1b8e42edf
Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
 ...he-filename-can-t-be-longer-than-255.patch | 40 +++++++++++++++++++
 meta/recipes-devtools/apt/apt_2.6.1.bb        |  1 +
 2 files changed, 41 insertions(+)
 create mode 100644 meta/recipes-devtools/apt/apt/0001-strutl.cc-the-filename-can-t-be-longer-than-255.patch

Comments

Alexander Kanavin June 18, 2024, 8:01 a.m. UTC | #1
On Tue, 18 Jun 2024 at 05:30, Changqing Li via lists.openembedded.org
<changqing.li=windriver.com@lists.openembedded.org> wrote:
>
> From: Changqing Li <changqing.li@windriver.com>
>
> when the tmpdir dir is longer than 220, there is no files saved in
> tmp/sysroots/x86_64-linux/var/lib/apt/lists/ after run apt-get update,
> this is because apt-get uses the path as the file name, but the file
> name can't be longer than 255 according to /usr/include/linux/limits.h.
>
> [YOCTO #2688]
>
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
>
> Take back from https://git.openembedded.org/openembedded-core/commit/?id=9a0c0393871eda4bbcecfdd4b595f0c1b8e42edf
> Signed-off-by: Changqing Li <changqing.li@windriver.com>
> ---
>  ...he-filename-can-t-be-longer-than-255.patch | 40 +++++++++++++++++++
>  meta/recipes-devtools/apt/apt_2.6.1.bb        |  1 +
>  2 files changed, 41 insertions(+)
>  create mode 100644 meta/recipes-devtools/apt/apt/0001-strutl.cc-the-filename-can-t-be-longer-than-255.patch
>
> diff --git a/meta/recipes-devtools/apt/apt/0001-strutl.cc-the-filename-can-t-be-longer-than-255.patch b/meta/recipes-devtools/apt/apt/0001-strutl.cc-the-filename-can-t-be-longer-than-255.patch
> new file mode 100644
> index 0000000000..c88efa3aae
> --- /dev/null
> +++ b/meta/recipes-devtools/apt/apt/0001-strutl.cc-the-filename-can-t-be-longer-than-255.patch
> @@ -0,0 +1,40 @@
> +From 918295aa1320718d342116f76c98d2289d377800 Mon Sep 17 00:00:00 2001
> +From: Changqing Li <changqing.li@windriver.com>
> +Date: Tue, 18 Jun 2024 10:32:55 +0800
> +Subject: [PATCH] strutl.cc: the filename can't be longer than 255
> +
> +The URItoFileName translates the path into the filename, but the
> +filename can't be longer than 255 according to
> +/usr/include/linux/limits.h.
> +
> +Truncate it when it is longer than 240 (leave some spaces for
> +".Packages" and "._Release" suffix)
> +
> +Upstream-Status: Submitted [submit@bugs.debian.org]

Was this submitted just now, or is the status from the original patch?

In any case, we need to trace the submissions, so please include a
link to the bug page if there is one, or (better) re-submit as a pull
request:
https://salsa.debian.org/apt-team/apt

Alex
Changqing Li June 18, 2024, 9:05 a.m. UTC | #2
On 6/18/24 16:01, Alexander Kanavin wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Tue, 18 Jun 2024 at 05:30, Changqing Li via lists.openembedded.org
> <changqing.li=windriver.com@lists.openembedded.org>  wrote:
>> From: Changqing Li<changqing.li@windriver.com>
>>
>> when the tmpdir dir is longer than 220, there is no files saved in
>> tmp/sysroots/x86_64-linux/var/lib/apt/lists/ after run apt-get update,
>> this is because apt-get uses the path as the file name, but the file
>> name can't be longer than 255 according to /usr/include/linux/limits.h.
>>
>> [YOCTO #2688]
>>
>> Signed-off-by: Robert Yang<liezhi.yang@windriver.com>
>>
>> Take back fromhttps://git.openembedded.org/openembedded-core/commit/?id=9a0c0393871eda4bbcecfdd4b595f0c1b8e42edf
>> Signed-off-by: Changqing Li<changqing.li@windriver.com>
>> ---
>>   ...he-filename-can-t-be-longer-than-255.patch | 40 +++++++++++++++++++
>>   meta/recipes-devtools/apt/apt_2.6.1.bb        |  1 +
>>   2 files changed, 41 insertions(+)
>>   create mode 100644 meta/recipes-devtools/apt/apt/0001-strutl.cc-the-filename-can-t-be-longer-than-255.patch
>>
>> diff --git a/meta/recipes-devtools/apt/apt/0001-strutl.cc-the-filename-can-t-be-longer-than-255.patch b/meta/recipes-devtools/apt/apt/0001-strutl.cc-the-filename-can-t-be-longer-than-255.patch
>> new file mode 100644
>> index 0000000000..c88efa3aae
>> --- /dev/null
>> +++ b/meta/recipes-devtools/apt/apt/0001-strutl.cc-the-filename-can-t-be-longer-than-255.patch
>> @@ -0,0 +1,40 @@
>> +From 918295aa1320718d342116f76c98d2289d377800 Mon Sep 17 00:00:00 2001
>> +From: Changqing Li<changqing.li@windriver.com>
>> +Date: Tue, 18 Jun 2024 10:32:55 +0800
>> +Subject: [PATCH] strutl.cc: the filename can't be longer than 255
>> +
>> +The URItoFileName translates the path into the filename, but the
>> +filename can't be longer than 255 according to
>> +/usr/include/linux/limits.h.
>> +
>> +Truncate it when it is longer than 240 (leave some spaces for
>> +".Packages" and "._Release" suffix)
>> +
>> +Upstream-Status: Submitted [submit@bugs.debian.org]
> Was this submitted just now, or is the status from the original patch?

It was submitted to that maillist just now. And it did automatically 
reply me a bug link later.

I will send a V2 for this patch to update the bug link.

Thanks

Changqing

>
> In any case, we need to trace the submissions, so please include a
> link to the bug page if there is one, or (better) re-submit as a pull
> request:
> https://salsa.debian.org/apt-team/apt
>
> Alex
diff mbox series

Patch

diff --git a/meta/recipes-devtools/apt/apt/0001-strutl.cc-the-filename-can-t-be-longer-than-255.patch b/meta/recipes-devtools/apt/apt/0001-strutl.cc-the-filename-can-t-be-longer-than-255.patch
new file mode 100644
index 0000000000..c88efa3aae
--- /dev/null
+++ b/meta/recipes-devtools/apt/apt/0001-strutl.cc-the-filename-can-t-be-longer-than-255.patch
@@ -0,0 +1,40 @@ 
+From 918295aa1320718d342116f76c98d2289d377800 Mon Sep 17 00:00:00 2001
+From: Changqing Li <changqing.li@windriver.com>
+Date: Tue, 18 Jun 2024 10:32:55 +0800
+Subject: [PATCH] strutl.cc: the filename can't be longer than 255
+
+The URItoFileName translates the path into the filename, but the
+filename can't be longer than 255 according to
+/usr/include/linux/limits.h.
+
+Truncate it when it is longer than 240 (leave some spaces for
+".Packages" and "._Release" suffix)
+
+Upstream-Status: Submitted [submit@bugs.debian.org]
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+Signed-off-by: Changqing Li <changqing.li@windriver.com>
+---
+ apt-pkg/contrib/strutl.cc | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
+index 67100f1..5076b35 100644
+--- a/apt-pkg/contrib/strutl.cc
++++ b/apt-pkg/contrib/strutl.cc
+@@ -565,7 +565,12 @@ string URItoFileName(const string &URI)
+    // "\x00-\x20{}|\\\\^\\[\\]<>\"\x7F-\xFF";
+    string NewURI = QuoteString(U,"\\|{}[]<>\"^~_=!@#$%^&*");
+    replace(NewURI.begin(),NewURI.end(),'/','_');
+-   return NewURI;
++
++   // Truncate from the head when it is longer than 240
++   if(NewURI.length() > 240)
++       return NewURI.substr(NewURI.length() - 240, NewURI.length() - 1);
++   else
++       return NewURI;
+ }
+ 									/*}}}*/
+ // Base64Encode - Base64 Encoding routine for short strings		/*{{{*/
+-- 
+2.25.1
+
diff --git a/meta/recipes-devtools/apt/apt_2.6.1.bb b/meta/recipes-devtools/apt/apt_2.6.1.bb
index 26a6d99f84..b6b56c0010 100644
--- a/meta/recipes-devtools/apt/apt_2.6.1.bb
+++ b/meta/recipes-devtools/apt/apt_2.6.1.bb
@@ -14,6 +14,7 @@  SRC_URI = "${DEBIAN_MIRROR}/main/a/apt/${BPN}_${PV}.tar.xz \
            file://0001-Hide-fstatat64-and-prlimit64-defines-on-musl.patch \
            file://0001-aptwebserver.cc-Include-array.patch \
            file://0001-Remove-using-std-binary_function.patch \
+           file://0001-strutl.cc-the-filename-can-t-be-longer-than-255.patch \
            "
 
 SRC_URI:append:class-native = " \