Bug 1841851

Summary: error: lua script failed: [string "%prein(crypto-policies-20200527-3.gitb234a47.fc33.noarch)"]:19: attempt to call a nil value
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: crypto-policiesAssignee: Red Hat Crypto Team <crypto-team>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: crypto-team, igor.raits, lef, nmavrogi, tmraz
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: crypto-policies-20200527-4.gitb234a47.fc33 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-29 17:14:56 UTC 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 Miro Hrončok 2020-05-29 16:14:39 UTC
Description of problem:
No packages can be built. buildSRPMFromSCM job fails with:

DEBUG util.py:602:  error: lua script failed: [string "%prein(crypto-policies-20200527-3.gitb234a47.fc33.noarch)"]:19: attempt to call a nil value
DEBUG util.py:600:  Error in PREIN scriptlet in rpm package crypto-policies
DEBUG util.py:602:  error: crypto-policies-20200527-3.gitb234a47.fc33.noarch: install failed

Version-Release number of selected component (if applicable):
crypto-policies-20200527-3.gitb234a47.fc33

How reproducible: build anything in koji

Actual results: everything is on fire


Expected results: packages build fine

Comment 1 Igor Raits 2020-05-29 16:24:20 UTC
crypto-policies-20200527-3.gitb234a47.fc33

has been untagged.

Comment 2 Miro Hrončok 2020-05-29 16:43:21 UTC
$ ilua
Jupyter console 6.1.0

ILua 0.2.1
In [1]: policy = "DEFAULT"                                                                                                                                                                                                       

In [2]: posix.files("%{_datarootdir}/crypto-policies/"..policy)                                                                                                                                                                  
Out[2]: nil	"%{_datarootdir}/crypto-policies/DEFAULT: No such file or directory"	2.0



The %{_datarootdir} macro is not expanded. Nor defined BTW:

In [3]: posix.files(rpm.expand("%{_datarootdir}/crypto-policies/"..policy))                                                                                                                                                      
Out[3]: nil	"%{_datarootdir}/crypto-policies/DEFAULT: No such file or directory"	2.0

In [4]: rpm.expand("%{_datarootdir}")                                                                                                                                                                                            
Out[4]: "%{_datarootdir}"

Comment 3 Miro Hrončok 2020-05-29 16:44:19 UTC
Scratch that, the macro is expanded during build.

Comment 4 Miro Hrončok 2020-05-29 16:47:19 UTC
I think the problem simply is that /usr/share/crypto-policies/ is part of crypto-policies package and when the package is installed for the first time, the files are missing.
The %pre script should only run on update and/or should do nothing if the files are not present yet.

Comment 5 Tomas Mraz 2020-05-29 17:00:55 UTC
No, the script actually should just be moved to %post.

Comment 6 Tomas Mraz 2020-05-29 17:01:37 UTC
Just a stupid mistake.

Comment 7 Tomas Mraz 2020-05-29 17:14:56 UTC
There were a few more changes needed but now I tested installing it in mock chroot without crypto-policies already installed, so hopefully no more buildroot breakage.