File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,23 @@ setup(void)
143143 if (dlerror ())
144144 return ; // Program not linked with readline(3)
145145
146+ /*
147+ * GNU awk 5.2.1 under Debian bookworm and maybe also other
148+ * versions is distributed with a persistent memory allocator (PMA)
149+ * library, which requires initialization with pma_init
150+ * before using it. If the allocator is not initialized calls
151+ * to malloc will (such as those * made by rl_add_defun() in this
152+ * function) will fail with a fatal error, such as the following.
153+ * (null): fatal: node.c:1075:more_blocks: freep: cannot allocate
154+ * 11200 bytes of memory: [unrelated error message]
155+ * To avoid this problem, exit if called from awk.
156+ * In the future more programs may need to get deny-listed here.
157+ */
158+ const char * program_name = acl_short_program_name ();
159+ if (strcmp (program_name , "awk" ) == 0
160+ || strcmp (program_name , "gawk" ) == 0 )
161+ return ;
162+
146163 // Obtain remaining variable symbols
147164 rl_end_ptr = dlsym (RTLD_DEFAULT , "rl_end" );
148165 rl_point_ptr = dlsym (RTLD_DEFAULT , "rl_point" );
You can’t perform that action at this time.
0 commit comments