Bug 2031255

Summary: dkms mktarball ignores -k options beyond the first
Product: [Fedora] Fedora EPEL Reporter: Jan Edler <jan.edler>
Component: dkmsAssignee: Simone Caronni <negativo17>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: epel7CC: negativo17, trix
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jan Edler 2021-12-10 20:59:42 UTC
Description of problem:
When more than one -k option is passed to dkms mktarball, only the first has any effect.
Error messages indicate the problem:

Marking modules for 3.10.0-862.14.4.el7.x86_64 (x86_64) for archiving...
/usr/sbin/dkms: line 1677: local: intree_module_dir: readonly variable
/usr/sbin/dkms: line 1678: local: temp_module_dir: readonly variable

The errors are generated for the 2nd and subsequent iteration of the first "for" loop of the make_tarball() function.


Version-Release number of selected component (if applicable):
3.0.2-1.el7


How reproducible:
Very

Steps to Reproduce:
1. mktarball -m foo -v 1.0 -k 3.10.0-862.14.4.el7.x86_64 -k 3.10.0-957.27.2.el7.x86_64
2. Look in the resulting tarball

Actual results:
Only the first kernel's modules are included in the tarball


Expected results:
Modules for all specified kernels should be included.

Additional info:
It seems to work if the two -r options are removed for the two local variables defined in that first "for" loop of make_tarball().
Shell local variables have function scope, not loop iteration scope.

Comment 1 Jan Edler 2021-12-10 21:40:19 UTC
The same mistake with local -r appears in the last "for" loop of load_tarball(), and causes all but one kernel to be ignored there, with similar error messages from the shell.