openSUSE / libalternatives

A configurable alternative for update-alternatives
Apache License 2.0
7 stars 7 forks source link

Stuck with more groups in config #15

Closed mimi1vx closed 2 years ago

mimi1vx commented 2 years ago

see https://bugzilla.opensuse.org/show_bug.cgi?id=1192657

if you specify more groups libalternatives got stuck.

> cat /usr/share/libalternatives/vim/30.conf
binary=/usr/bin/gvim
group=vi,vim,ex,gex,edit,view,rview,eview,vimdiff,gvimdiff
options=KeepArgv0

strace:

~> strace vim
execve("/usr/bin/vim", ["vim"], 0x7ffdd644cd50 /* 61 vars */) = 0
brk(NULL)                               = 0x5637f3e8a000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffdcf296c10) = -1 EINVAL (Nepřípustný argument)
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (Adresář nebo soubor neexistuje)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=60607, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 60607, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f1956fe0000
close(3)                                = 0
openat(AT_FDCWD, "/lib64/libalternatives.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\"\0\0\0\0\0\0"..., 832) = 832
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=27104, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1957025000
mmap(NULL, 29040, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f1956fd8000
mmap(0x7f1956fda000, 12288, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f1956fda000
mmap(0x7f1956fdd000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x5000) = 0x7f1956fdd000
mmap(0x7f1956fde000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x5000) = 0x7f1956fde000
close(3)                                = 0
openat(AT_FDCWD, "/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\327\2\0\0\0\0\0"..., 832) = 832
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
pread64(3, "\4\0\0\0@\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0"..., 80, 848) = 80
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\313\32:\261.\307\233\220\242#\3705\243\24NL"..., 68, 928) = 68
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=2398048, ...}, AT_EMPTY_PATH) = 0
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
mmap(NULL, 2136816, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f1956dc8000
mprotect(0x7f1956df4000, 1880064, PROT_NONE) = 0
mmap(0x7f1956df4000, 1531904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2c000) = 0x7f1956df4000
mmap(0x7f1956f6a000, 344064, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1a2000) = 0x7f1956f6a000
mmap(0x7f1956fbf000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1f6000) = 0x7f1956fbf000
mmap(0x7f1956fc5000, 51952, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f1956fc5000
close(3)                                = 0
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1956fd5000
arch_prctl(ARCH_SET_FS, 0x7f1956fd5740) = 0
set_tid_address(0x7f1956fd5a10)         = 499
set_robust_list(0x7f1956fd5a20, 24)     = 0
mprotect(0x7f1956fbf000, 12288, PROT_READ) = 0
mprotect(0x7f1956fde000, 4096, PROT_READ) = 0
mprotect(0x5637f1fcb000, 4096, PROT_READ) = 0
mprotect(0x7f1957020000, 8192, PROT_READ) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
munmap(0x7f1956fe0000, 60607)           = 0
getrandom("\xa1\xbb\x83\x28\x68\x95\x5d\xc1", 8, GRND_NONBLOCK) = 8
brk(NULL)                               = 0x5637f3e8a000
brk(0x5637f3eab000)                     = 0x5637f3eab000
openat(AT_FDCWD, "/home/deti/.config/libalternatives.conf", O_RDONLY|O_NOFOLLOW) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=0, ...}, AT_EMPTY_PATH) = 0
openat(AT_FDCWD, "/etc/libalternatives.conf", O_RDONLY|O_NOFOLLOW) = -1 ENOENT (Adresář nebo soubor neexistuje)
openat(AT_FDCWD, "/usr/share/libalternatives", O_RDONLY|O_DIRECTORY) = 4
openat(4, "vim", O_RDONLY|O_DIRECTORY)  = 5
close(4)                                = 0
dup(5)                                  = 4
newfstatat(4, "", {st_mode=S_IFDIR|0755, st_size=28, ...}, AT_EMPTY_PATH) = 0
fcntl(4, F_GETFL)                       = 0x18000 (flags O_RDONLY|O_LARGEFILE|O_DIRECTORY)
fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
getdents64(4, 0x5637f3e8a380 /* 4 entries */, 32768) = 112
getdents64(4, 0x5637f3e8a380 /* 0 entries */, 32768) = 0
close(4)                                = 0
openat(5, "30.conf", O_RDONLY)          = 4
close(5)                                = 0
newfstatat(4, "", {st_mode=S_IFREG|0644, st_size=98, ...}, AT_EMPTY_PATH) = 0
read(4, "binary=/usr/bin/gvim\ngroup=vi,vi"..., 1024) = 98
AdamMajer commented 2 years ago

Thank you for the report. This is fixed now and I'll submit to TW shortly.