Skip to contentSkip to conversation

fetch2: fix unpack of symbolic links

PATCH In review Stefan Christ 3 participants 4 messages Jun 22, 2016 – Jun 23, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fetch2: fix unpack of symbolic links

Files in the download directory can be symbolic links to the real file. The fetcher must copy the real file instead of copying the symbolic link. Otherwise other tasks will fail, like patching, or the recipe will modify files in the download directory.

This patch fixes commit 865d2fef ("bitbake: fetch2: fixes copying of file://dir; subdir=foo, bug 6128 and bug 6129").

---
 bitbake/lib/bb/fetch2/__init__.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
bitbake/lib/bb/fetch2/__init__.py +3 -1
index e8fbe89..a1819e7 100644
@@ -1423,7 +1423,9 @@ class FetchMethod(object):
                     if urlpath.find("/") != -1:
                         destdir = urlpath.rsplit("/", 1)[0] + '/'
                         bb.utils.mkdirhier("%s/%s" % (unpackdir, destdir))
-                cmd = 'cp -fpPR %s %s' % (file, destdir)
+                # Use -L to always resolve symbolic links. Files in download
+                # directory can be links to the real file.
+                cmd = 'cp -fpLR %s %s' % (file, destdir)
 
         if not cmd:
             return
Signature · 1 line
1.9.1
#1 lore raw

Does the "Krogoth+" mean "master" too?

- armin

Quoted 29 lines · Stefan Christ

Files in the download directory can be symbolic links to the real file. The fetcher must copy the real file instead of copying the symbolic link. Otherwise other tasks will fail, like patching, or the recipe will modify files in the download directory.

This patch fixes commit 865d2fef ("bitbake: fetch2: fixes copying of file://dir; subdir=foo, bug 6128 and bug 6129").

---
 bitbake/lib/bb/fetch2/__init__.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
bitbake/lib/bb/fetch2/__init__.py +3 -1
index e8fbe89..a1819e7 100644
@@ -1423,7 +1423,9 @@ class FetchMethod(object):
                     if urlpath.find("/") != -1:
                         destdir = urlpath.rsplit("/", 1)[0] + '/'
                         bb.utils.mkdirhier("%s/%s" % (unpackdir, destdir))
-                cmd = 'cp -fpPR %s %s' % (file, destdir)
+                # Use -L to always resolve symbolic links. Files in download
+                # directory can be links to the real file.
+                cmd = 'cp -fpLR %s %s' % (file, destdir)
 
         if not cmd:
             return
#2 lore raw

Hi Armin,

Quoted 4 lines · akuster

Does the "Krogoth+" mean "master" too?

- armin

Yes. The patch applies on master and krogoth.

Mit freundlichen Grüßen / Kind regards,
Stefan Christ

Quoted 30 lines · Stefan Christ
Quoted 29 lines

Files in the download directory can be symbolic links to the real file. The fetcher must copy the real file instead of copying the symbolic link. Otherwise other tasks will fail, like patching, or the recipe will modify files in the download directory.

This patch fixes commit 865d2fef ("bitbake: fetch2: fixes copying of file://dir; subdir=foo, bug 6128 and bug 6129").

---
 bitbake/lib/bb/fetch2/__init__.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
bitbake/lib/bb/fetch2/__init__.py +3 -1
index e8fbe89..a1819e7 100644
@@ -1423,7 +1423,9 @@ class FetchMethod(object):
                     if urlpath.find("/") != -1:
                         destdir = urlpath.rsplit("/", 1)[0] + '/'
                         bb.utils.mkdirhier("%s/%s" % (unpackdir, destdir))
-                cmd = 'cp -fpPR %s %s' % (file, destdir)
+                # Use -L to always resolve symbolic links. Files in download
+                # directory can be links to the real file.
+                cmd = 'cp -fpLR %s %s' % (file, destdir)
 
         if not cmd:
             return
#3 lore raw

I believe there is no agreement but in general, sending n patches (perhaps all identical) just changing the branch target would be the way to do this. Doing some patchwork patch fetching and parsing, this is what I found related to the format between [XXX]

* fraction only, i.e. [0/10]
* version only, i.e. [v2]
* fraction + branch, i.e. [0/10, fido]
* branch + fraction, i.e. [fido, 0/10]
* fraction + branch + version, i.e. [0/10, fido, v2]
* patch string, i.e. [PATCH]
* patch string + version, i.e. [PATCHv2]
* etc..

So this indicates that we need a better guideline to submit patches, at least on this area.

Quoted 42 lines · Stefan Christ

Hi Armin,

Quoted 4 lines · akuster

Does the "Krogoth+" mean "master" too?

- armin

Yes. The patch applies on master and krogoth.

Mit freundlichen Grüßen / Kind regards,
Stefan Christ

Quoted 30 lines · Stefan Christ
Quoted 29 lines

Files in the download directory can be symbolic links to the real file. The fetcher must copy the real file instead of copying the symbolic link. Otherwise other tasks will fail, like patching, or the recipe will modify files in the download directory.

This patch fixes commit 865d2fef ("bitbake: fetch2: fixes copying of file://dir; subdir=foo, bug 6128 and bug 6129").

---
  bitbake/lib/bb/fetch2/__init__.py | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
bitbake/lib/bb/fetch2/__init__.py +3 -1
index e8fbe89..a1819e7 100644
@@ -1423,7 +1423,9 @@ class FetchMethod(object):
                      if urlpath.find("/") != -1:
                          destdir = urlpath.rsplit("/", 1)[0] + '/'
                          bb.utils.mkdirhier("%s/%s" % (unpackdir, destdir))
-                cmd = 'cp -fpPR %s %s' % (file, destdir)
+                # Use -L to always resolve symbolic links. Files in download
+                # directory can be links to the real file.
+                cmd = 'cp -fpLR %s %s' % (file, destdir)
 
          if not cmd:
              return