Unnecessary assert in sr_unix/gtm_permissions.c:67

Here's a stack from GDB inside of a docker container, where database files mounted from the host don't run inside the container because of an assert. The release mode code handles this scenario properly.

#0  0x00007fdb81da9dfc in __pthread_kill_implementation () from /lib64/libc.so.6
#1  0x00007fdb810901e0 in gtm_dump_core () at /Distrib/YottaDB/V989_R203/sr_unix/gtm_dump_core.c:74
#2  0x00007fdb81091e17 in gtm_fork_n_core () at /Distrib/YottaDB/V989_R203/sr_unix/gtm_fork_n_core.c:163
#3  0x00007fdb8106c0cc in ch_cond_core () at /Distrib/YottaDB/V989_R203/sr_unix/ch_cond_core.c:80
#4  0x00007fdb8116d578 in rts_error_va (csa=0x0, argcnt=7, var=0x7ffd37e96900) at /Distrib/YottaDB/V989_R203/sr_unix/rts_error.c:199
#5  0x00007fdb8116cad9 in rts_error_csa (csa=0x0, argcnt=7) at /Distrib/YottaDB/V989_R203/sr_unix/rts_error.c:100
#6  0x00007fdb8116c80a in assertfail (testlen=16, teststr=0x7fdb81ab41e1 "NULL != gid_list", flen=52, fstr=0x7fdb81ab4160 "/Distrib/YottaDB/V989_R203/sr_unix/gtm_permissions.c", line=67)
    at /Distrib/YottaDB/V989_R203/sr_port/mdef.h:828
#7  0x00007fdb81550de1 in gtm_gid_in_gid_list (gid=0) at /Distrib/YottaDB/V989_R203/sr_unix/gtm_permissions.c:67
#8  0x00007fdb815511db in gtm_member_group_id (uid=5002, gid=0, pdd=0x7ffd37e979b0) at /Distrib/YottaDB/V989_R203/sr_unix/gtm_permissions.c:129
#9  0x00007fdb815513c8 in gtm_permissions (stat_buff=0x7ffd37e97870, user_id=0x7ffd37e96c48, group_id=0x7ffd37e96c4c, perm=0x7ffd37e96c50, target_type=PERM_IPC, pdd=0x7ffd37e979b0)
    at /Distrib/YottaDB/V989_R203/sr_unix/gtm_permissions.c:184
#10 0x00007fdb8157c686 in db_init (reg=0x85f3170, ok_to_bypass=1) at /Distrib/YottaDB/V989_R203/sr_unix/gvcst_init_sysops.c:831
#11 0x00007fdb812afc1e in gvcst_init (reg=0x85f3170) at /Distrib/YottaDB/V989_R203/sr_port/gvcst_init.c:998
#12 0x00007fdb812a176a in gv_init_reg (reg=0x85f3170) at /Distrib/YottaDB/V989_R203/sr_port/gv_init_reg.c:53
#13 0x00007fdb812a0ad4 in gv_bind_name (addr=0x85f3050, gvname=0x7ffd37e9c400) at /Distrib/YottaDB/V989_R203/sr_port/gv_bind_name.c:76
#14 0x00007fdb813d8d52 in op_gvname_common (count=2, hash_code=221616068, val_arg=0x869c3f0, var=0x7ffd37e9e890) at /Distrib/YottaDB/V989_R203/sr_port/op_gvname.c:181
#15 0x00007fdb813d85ec in op_gvname_fast (count_arg=4, hash_code=221616068, val_arg=0x869c3f0) at /Distrib/YottaDB/V989_R203/sr_port/op_gvname.c:84
#16 0x00007fdb80e263cb in _PEEKBYNAME () from /ydb/libyottadbutil.so
#17 0x000000000863d210 in ?? ()
#18 0x000000000000000a in ?? ()
#19 0x000000000000000b in ?? ()
#20 0x000000000000000c in ?? ()
#21 0x000000000000000d in ?? ()
#22 0x000000000000000e in ?? ()
#23 0x000000000000000f in ?? ()
#24 0x0000000000000010 in ?? ()
#25 0x0000000000000011 in ?? ()
#26 0x00007ffd37e9efa0 in ?? ()
#27 0x00007ffd37e9eba8 in ?? ()
#28 0x0000000000000000 in ?? ()

Here's how to reproduce this bug:

Host:
$ mumps -r GDE exit
$ mupip create
$ docker run --rm -it -v ${PWD}:/data yottadb/yottadb-debug-base bash

Container:
# export ydb_dist="/opt/yottadb/current/"
# export PATH=$PATH:$ydb_dist
# export ydb_gbldir=./mumps.gld
# mumps -r %GD <<< '*'

Global Directory

Global ^
%YDB-F-ASSERT, Assert failed in /tmp/yottadb-src/sr_unix/gtm_permissions.c line 67 for expression (NULL != gid_list)
YDB-MUMPS[17]: %YDB-I-JOBEXAMDONE, YottaDB process 17 successfully executed $ZJOBEXAM() into /data/YDB_FATAL_ERROR.ZSHOW_DMP_17_1.txt -- generated from 0x0000000000000000.

My reading of the code is that that assert is unnecessary, as the group list in a docker container won't match what's on the machine, and yet the file is still readable since in docker we are running as root.

I verified that release mode (yottadb/yottadb-base) runs normally.