| Message ID | 20260822012007.189830-1-sh0127.shin@lge.com |
|---|---|
| State | New |
| Headers | show |
| Series | fetch2: add 'fixperms' option for tar archives with restrictive permissions | expand |
On Sat, 22 Aug 2026 at 03:20, sh0127shin via lists.openembedded.org <sh0127.shin=lge.com@lists.openembedded.org> wrote: > Some tar archives contain directories with restrictive > permissions (e.g. drw-r--r--) that can prevent extraction > or subsequent processing from completing successfully. Hello, I think this can be solved by adding unpack=0 to SRC_URI, and then adding a custom task that runs between unpack and patch that extracts the tarball with a special procedure. Tarballs can contains all kinds of esoteric problems like this one, I don't think bitbake should try to accommodate them. Alex
diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py index 9cb268be5..1c3bab6d7 100644 --- a/lib/bb/fetch2/__init__.py +++ b/lib/bb/fetch2/__init__.py @@ -1564,6 +1564,8 @@ class FetchMethod(object): if unpack: tar_cmd = ['tar', '--extract', '--no-same-owner'] + if 'fixperms' in urldata.parm and urldata.parm['fixperms'] == '1': + tar_cmd.append('--delay-directory-restore') if 'striplevel' in urldata.parm: striplevel = urldata.parm['striplevel'] if not striplevel.isdigit(): @@ -1659,6 +1661,9 @@ class FetchMethod(object): bb.note("Unpacking %s to %s/" % (file, unpackdir)) _run(cmd) + if 'fixperms' in urldata.parm and urldata.parm['fixperms'] == '1': + _run(['chmod', '-R', '+X', unpackdir]) + if iterate is True: iterate_urldata = urldata iterate_urldata.localpath = "%s/%s" % (rootdir, iterate_file)