rpm5 lua

Elan Ruusamäe glen at pld-linux.org
Wed Oct 8 19:13:05 CEST 2014


rpm 4.5, all cool:
$ rpm -q rpm; rpm -E '%{lua:print(os.getenv("TMPDIR") or "/tmp")}'
rpm-4.5-70.i686
/home/glen/tmp


rpm 5:
d# rpm -q rpm; rpm -E '%{lua:print(os.getenv("TMPDIR") or "/tmp")}'
rpm-5.4.13-7.i686
*** Error in `rpm': malloc(): memory corruption: 0x082b3fc8 ***
...<does not return>

strace tail of the above command:

writev(3, [{"*** Error in `", 14}, {"rpm", 3}, {"': ", 3}, {"malloc(): 
memory corruption", 27}, {": 0x", 4}, {"08d06000", 8}, {" ***\n", 5}], 
7*** Error in `rpm': malloc(): memory corruption: 0x08d06000 ***
) = 64
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 
0) = 0xb76ff000
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=12682, ...}) = 0
mmap2(NULL, 12682, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb6986000
close(4)                                = 0
open("/lib/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\220 
\0\0004\0\0\0"..., 512) = 512
futex(0xb73d9420, FUTEX_WAIT_PRIVATE, 2, NULL <does not return>


... seems to be related to the "or str" statement, and the length of the 
inline string, <3 is ok, >=4 is epic fail:

# rpm -E '%{lua:print(os.getenv("TMPDIR") or "4231")}'
*** Error in `rpm': malloc(): memory corruption: 0x0997afb8 ***
^C
# rpm -E '%{lua:print(os.getenv("TMPDIR") or "423")}'
423
# rpm -E '%{lua:print(os.getenv("TMPDIR") or "asdf")}'
*** Error in `rpm': malloc(): memory corruption: 0x083bfe28 ***
^C
# rpm -E '%{lua:print(os.getenv("TMPDIR") or "bla")}'
bla
#

-- 
glen



More information about the pld-devel-en mailing list