AA-2844 : Fix platform dependencies and compile time issues

Review Request #867 — Created May 15, 2025 and submitted

pmurugaiyan
AMP
amp_4_0
AA-2844
apoorva.sn, mmiriam, ngurunathan, prajesh

Fix platform dependencies and compile time issues
1. Fixed a couple of compile time issues
2. Thanks Madhuri for the assistance.

Note: Not all the compilation errors are resolved. Commiting the changes that I did so far.

The changes are tested locally.

Description From Last Updated

keep this memeset for tmp1 and tmp2

mmiriammmiriam

keep this

mmiriammmiriam

buf is allocated with size MAX_LINE_SIZE + 1 and max_buff = 4096 may cause buffer overflow. So calloc buf with …

mmiriammmiriam

size should be 2 only. pos is a. pointer takes 4 or 8bytes.

prajeshprajesh
mmiriam
  1. 
      
  2. branches/amp_4_0/src/backend/sys_cmd.c (Diff revision 1)
     
     

    keep this memeset for tmp1 and tmp2

  3. branches/amp_4_0/src/backend/sys_cmd.c (Diff revision 1)
     
     

    keep this

  4. branches/amp_4_0/src/backend/sys_tool.c (Diff revision 1)
     
     

    buf is allocated with size MAX_LINE_SIZE + 1 and max_buff = 4096 may cause buffer overflow. So calloc buf with 4096.

    Same for other places also

  5. 
      
pmurugaiyan
prajesh
  1. 
      
  2. branches/amp_4_0/src/backend/backend.c (Diff revision 2)
     
     

    size should be 2 only. pos is a. pointer takes 4 or 8bytes.

    1. Yes Praveen, it was working with CentOS, but with the Rocky Linux facing the following issue, I updated to address this error.

      backend.c: In function 'read_cmd':
      backend.c:466:17: error: 'strncpy' output truncated before terminating nul copying 2 bytes from a string of the same length [-Werror=stringop-truncation]
      466 | strncpy(pos, " \n", 2);
      | ^~~~~~~~
      cc1: all warnings being treated as errors
      make[3]: *** [Makefile:51: backend.o] Error 1
      make[3]: Leaving directory '/home/admin/AMP/amp_4_0/build/array/BUILD/amp-4.0.0/src/backend'

    2. You can try snprintf instead of strlpcy. snprintf(pos, 2, "\n");

    3. Yes, worked.

  3. 
      
pmurugaiyan
prajesh
  1. Ship It!
  2. 
      
mmiriam
  1. Ship It!
  2. 
      
pmurugaiyan
Review request changed

Status: Closed (submitted)

Loading...