Skip to contentSkip to conversation

fetch2/git.py: fix the filename too long error

RFC PATCH New Robert Yang 1 participant 2 messages Nov 8, 2013

lore
Share & tools
lore
#0 lore raw

cover fetch2/git.py: fix the filename too long error

The following changes since commit d6cc7c8ed76c8b1117cf03c7bd4b0742f98f79b3:

toolchain-scripts/meta-environment: Further cleanup code duplication (2013-11-06 11:02:27 +0000)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib rbt/toolong
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=rbt/toolong

Robert Yang (1):
fetch2/git.py: fix the filename too long error

 bitbake/lib/bb/fetch2/git.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.3.1
#1 lore raw

RFC PATCH 1/1 fetch2/git.py: fix the filename too long error

When we use the PREMIRROR/MIRROR from the local disk, and if it is in a deep directory, for example, when len(path) > 255 (The NAME_MAX), we will get the "filename too long error".

This is becuase we use ud.path.replace('/', '.') to change the path to the filename. We seldom see such a long url, but it is easy to produce it on the local machine.

Another problem is that:

file:///local/path

will be converted into .local.path whichi is a hidden file by default.

Don't convert the name when ud.proto == "file" will fix the problem.

PS:
- This is only for git, other fetchers also have the similar problem, will send the patch for others if this is fine.

- Another solution might be: use the md5sum(path) as part of the filename, I'm not sure whether it is worth.

[YOCTO #5389]

---
 bitbake/lib/bb/fetch2/git.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
bitbake/lib/bb/fetch2/git.py +4 -1
index 6175e4c..53fd2f5 100644
@@ -127,7 +127,10 @@ class Git(FetchMethod):
                     ud.branches[name] = ud.revisions[name]
                 ud.revisions[name] = self.latest_revision(ud.url, ud, d, name)
 
-        gitsrcname = '%s%s' % (ud.host.replace(':','.'), ud.path.replace('/', '.').replace('*', '.'))
+        if ud.proto == "file":
+            gitsrcname = '%s%s' % ("file...", os.path.basename(ud.path))
+        else:
+            gitsrcname = '%s%s' % (ud.host.replace(':','.'), ud.path.replace('/', '.').replace('*', '.'))
         # for rebaseable git repo, it is necessary to keep mirror tar ball
         # per revision, so that even the revision disappears from the
         # upstream repo in the future, the mirror will remain intact and still
Signature · 1 line
1.8.3.1