apt 0.7.14: runtime error: filename too long (tmpdir length)

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]

(From OE-Core rev: 9a0c0393871eda4bbcecfdd4b595f0c1b8e42edf)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Robert Yang 2012-07-04 18:16:28 +08:00 committed by Richard Purdie
parent 460119a5b9
commit f06c1c3df0
4 changed files with 38 additions and 2 deletions

View File

@ -0,0 +1,35 @@
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: Pending
Signed-off-by: Robert Yang <liezhi.yang@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
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -399,7 +399,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 /*{{{*/
--
1.7.10.4

View File

@ -1,6 +1,6 @@
require apt-native.inc
PR = "r8"
PR = "r9"
SRC_URI += "file://nodoc.patch \
file://noconfigure.patch \

View File

@ -8,6 +8,7 @@ SRC_URI = "${DEBIAN_MIRROR}/main/a/apt/apt_${PV}.tar.gz \
file://localefixes.patch \
file://makerace.patch \
file://remove-redeclaration.patch \
file://truncate-filename.patch \
"
inherit autotools gettext

View File

@ -3,7 +3,7 @@ RDEPENDS_${PN} = "dpkg"
LIC_FILES_CHKSUM = "file://COPYING.GPL;md5=0636e73ff0215e8d672dc4c32c317bb3"
require apt.inc
PR = "r13"
PR = "r14"
SRC_URI += "file://nodoc.patch \
file://includes-fix.patch "