[bitbake-devel] [PATCH 1/1 RFC] fetch2/git.py: fix the filename too long error

Robert Yang liezhi.yang at windriver.com
Fri Nov 8 16:31:51 UTC 2013


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]

Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
---
 bitbake/lib/bb/fetch2/git.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 6175e4c..53fd2f5 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -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
-- 
1.8.3.1




More information about the bitbake-devel mailing list