[Rpm-maint] [rpm-software-management/rpm] crash in %filetrigger in scriptlet (Issue #3029)

Zbigniew Jędrzejewski-Szmek notifications at github.com
Wed Apr 10 07:57:23 UTC 2024


I'm trying to add a scriptlet to filesystem.rpm, and rpm fails like this:

```console
$ sudo rpm --root=/var/tmp/inst3 --reinstall x86_64/filesystem-3.18-8.fc41.x86_64.rpm
...
filetriggerin
table: 0x55b04c8b4590
will return
PANIC: unprotected error in call to Lua API (attempt to index a number value)
[1]    887545 IOT instruction  sudo rpm --root=/var/tmp/inst3 --reinstall 
```

The scriptlet:
```
%filetriggerin -p <lua> -- /usr/bin
print('filetriggerin')
 
st = posix.stat("/sbin")
 
print(st)
 
if st.type == "link" then
  print('will return')
  return 0
end

print('filetriggerin-YES')
```

<details>

With gdb:
```console
$ sudo gdb --args rpm --root=/var/tmp/inst3 --reinstall x86_64/filesystem-3.18-8.fc41.x86_64.rpm
...
(gdb) r
Starting program: /usr/bin/rpm --root=/var/tmp/inst3 --reinstall x86_64/filesystem-3.18-8.fc41.x86_64.rpm
...
filetriggerin
table: 0x5555556a8510
will return
PANIC: unprotected error in call to Lua API (attempt to index a number value)

Program received signal SIGABRT, Aborted.
0x00007ffff7d82144 in __pthread_kill_implementation () from /lib64/libc.so.6
Missing separate debuginfos, use: dnf debuginfo-install bzip2-libs-1.0.8-18.fc40.x86_64 glibc-2.39-6.fc40.x86_64 libacl-2.3.2-1.fc40.x86_64 libattr-2.5.2-3.fc40.x86_64 libgcc-14.0.1-0.13.fc40.x86_64 libselinux-3.6-4.fc40.x86_64 libzstd-1.5.6-1.fc40.x86_64 lua-libs-5.4.6-5.fc40.x86_64 openssl-libs-3.2.1-2.fc40.x86_64 popt-1.19-6.fc40.x86_64 rpm-sequoia-1.6.0-2.fc40.x86_64 sqlite-libs-3.45.1-2.fc40.x86_64 xz-libs-5.4.6-3.fc40.x86_64 zlib-ng-compat-2.1.6-2.fc40.x86_64
(gdb) bt
#0  0x00007ffff7d82144 in __pthread_kill_implementation () from /lib64/libc.so.6
#1  0x00007ffff7d2a65e in raise () from /lib64/libc.so.6
#2  0x00007ffff7d12902 in abort () from /lib64/libc.so.6
#3  0x00007ffff7b34b7a in luaD_throw.cold () from /lib64/liblua-5.4.so
#4  0x00007ffff7b3d833 in luaG_errormsg () from /lib64/liblua-5.4.so
#5  0x00007ffff7b3cb3d in luaG_runerror () from /lib64/liblua-5.4.so
#6  0x00007ffff7b3d7d5 in luaG_typeerror () from /lib64/liblua-5.4.so
#7  0x00007ffff7b5e9ff in luaV_finishset () from /lib64/liblua-5.4.so
#8  0x00007ffff7b34dff in auxsetstr () from /lib64/liblua-5.4.so
#9  0x00007ffff7f6277f in runLuaScript (plugins=0x555555625170, lvl=<optimized out>, scriptFd=<optimized out>, prefixes=0x0, 
    sname=<optimized out>, argvp=0x7fffffffd8e0, script=0x55555562e750 "NY6", arg1=<optimized out>, arg2=-1, nextFileFunc=<optimized out>)
    at /usr/src/debug/rpm-4.19.1.1-2.fc41.x86_64/lib/rpmscript.c:206
#10 rpmScriptRun (script=<optimized out>, arg1=<optimized out>, arg2=-1, scriptFd=<optimized out>, prefixes=0x0, plugins=0x555555625170)
    at /usr/src/debug/rpm-4.19.1.1-2.fc41.x86_64/lib/rpmscript.c:488
#11 runScript (ts=0x55555559da60, te=0x555555908350, h=<optimized out>, prefixes=0x0, script=<optimized out>, arg1=<optimized out>, arg2=-1)
    at /usr/src/debug/rpm-4.19.1.1-2.fc41.x86_64/lib/transaction.c:1717
#12 0x00007ffff7f7036e in runHandleTriggersInPkg (ts=ts at entry=0x55555559da60, te=te at entry=0x5555555fc390, h=h at entry=0x5555555d3770, 
    sense=sense at entry=65536, tm=<optimized out>, searchMode=<optimized out>, ti=0)
    at /usr/src/debug/rpm-4.19.1.1-2.fc41.x86_64/lib/rpmtriggers.c:436
#13 0x00007ffff7f7083e in runFileTriggers (ts=0x55555559da60, te=0x5555555fc390, sense=65536, tm=2, priorityClass=1)
    at /usr/src/debug/rpm-4.19.1.1-2.fc41.x86_64/lib/rpmtriggers.c:571
#14 0x00007ffff7f504e6 in rpmPackageInstall (ts=<optimized out>, psm=0x5555557f2f60) at /usr/src/debug/rpm-4.19.1.1-2.fc41.x86_64/lib/psm.c:886
#15 runGoal (psm=0x5555557f2f60, goal=<optimized out>) at /usr/src/debug/rpm-4.19.1.1-2.fc41.x86_64/lib/psm.c:1068
#16 rpmpsmRun (ts=0x55555559da60, te=0x5555555fc390, goal=<optimized out>) at /usr/src/debug/rpm-4.19.1.1-2.fc41.x86_64/lib/psm.c:1114
#17 0x00007ffff7f5fc9d in rpmpsmRun (ts=0x55555559da60, te=0x5555555fc390, goal=PKG_INSTALL)
    at /usr/src/debug/rpm-4.19.1.1-2.fc41.x86_64/lib/rpmte.c:594
#18 rpmteProcess (te=te at entry=0x5555555fc390, goal=PKG_INSTALL, num=num at entry=0) at /usr/src/debug/rpm-4.19.1.1-2.fc41.x86_64/lib/rpmte.c:820
#19 0x00007ffff7f6558b in rpmtsProcess (ts=0x55555559da60) at /usr/src/debug/rpm-4.19.1.1-2.fc41.x86_64/lib/transaction.c:1637
#20 rpmtsRun (ts=<optimized out>, okProbs=<optimized out>, ignoreSet=<optimized out>)
    at /usr/src/debug/rpm-4.19.1.1-2.fc41.x86_64/lib/transaction.c:1859
#21 0x00007ffff7f58e94 in rpmcliTransaction (ts=ts at entry=0x55555559da60, ia=ia at entry=0x555555559200 <rpmIArgs>)
    at /usr/src/debug/rpm-4.19.1.1-2.fc41.x86_64/lib/rpminstall.c:300
#22 0x00007ffff7f5a630 in rpmInstall (ts=ts at entry=0x55555559da60, ia=0x555555559200 <rpmIArgs>, fileArgv=<optimized out>)
    at /usr/src/debug/rpm-4.19.1.1-2.fc41.x86_64/lib/rpminstall.c:653
#23 0x0000555555556b87 in main (argc=4, argv=<optimized out>) at /usr/src/debug/rpm-4.19.1.1-2.fc41.x86_64/tools/rpm.c:268
```
</details>

rpm-4.19.1.1-2.fc41.x86_64

For a reproducer, see https://src.fedoraproject.org/fork/zbyszek/rpms/filesystem/tree/crash.
Or https://copr.fedorainfracloud.org/coprs/zbyszek/merged-sbin/builds/, all the failed builds have the failure.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/3029
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/issues/3029 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20240410/c427e9d2/attachment-0001.html>


More information about the Rpm-maint mailing list