[LU-9833] New gcc compiler generates a lot of format-truncation warnings Created: 04/Aug/17  Updated: 26/Feb/18  Resolved: 25/Jan/18

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.11.0, Lustre 2.10.4

Type: Bug Priority: Minor
Reporter: Oleg Drokin Assignee: James A Simmons
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Related
is related to LU-9934 support gcc7 Resolved
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

This mostly looks harmless so I imagine we should just disable the option?

lustre_rsync.c: In function Б─≤lr_rsync_dataБ─≥:
lustre_rsync.c:316:55: warning: Б─≤%sБ─≥ directive output may be truncated writing up to 4096 bytes into a region of size 4085 [-Wformat-truncation=]
                 snprintf(cmd, PATH_MAX, "%s --inplace %s %s", rsync, info->src,
                                                       ^~
lustre_rsync.c:316:17: note: Б─≤snprintfБ─≥ output 13 or more bytes (assuming 8205) into a destination of size 4096
                 snprintf(cmd, PATH_MAX, "%s --inplace %s %s", rsync, info->src
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         info->dest);
                         ~~~~~~~~~~~
lustre_rsync.c: In function Б─≤lr_cascade_moveБ─≥:
lustre_rsync.c:679:47: warning: Б─≤snprintfБ─≥ output may be truncated before the last format character [-Wformat-truncation=]
                         snprintf(d, PATH_MAX, "%s/%s", dest,
                                               ^~~~~~~
lustre_rsync.c:679:25: note: Б─≤snprintfБ─≥ output 2 or more bytes (assuming 4097) into a destination of size 4096
                         snprintf(d, PATH_MAX, "%s/%s", dest,
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                  curr->pc_log.pcl_name);
                                  ~~~~~~~~~~~~~~~~~~~~~~
lustre_rsync.c: In function Б─≤lr_rm_recursiveБ─≥:
lustre_rsync.c:763:47: warning: Б─≤%sБ─≥ directive output may be truncated writing up to 4096 bytes into a region of size 4089 [-Wformat-truncation=]
         snprintf(info->cmd, PATH_MAX, "rm -rf %s", info->dest);
                                               ^~
lustre_rsync.c:763:9: note: Б─≤snprintfБ─≥ output between 8 and 4104 bytes into a destination of size 4096
         snprintf(info->cmd, PATH_MAX, "rm -rf %s", info->dest);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lustre_rsync.c: In function Б─≤lr_createБ─≥:
lustre_rsync.c:822:51: warning: Б─≤%sБ─≥ directive output may be truncated writing up to 255 bytes into a region of size between 0 and 4096 [-Wformat-truncation=]
                 snprintf(info->dest, PATH_MAX, "%s%s", info->path, info->name);
                                                   ^~
lustre_rsync.c:822:17: note: Б─≤snprintfБ─≥ output between 1 and 4352 bytes into a destination of size 4096
                 snprintf(info->dest, PATH_MAX, "%s%s", info->path, info->name);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lustre_rsync.c:824:48: warning: Б─≤/Б─≥ directive output may be truncated writing 1 byte into a region of size between 0 and 4096 [-Wformat-truncation=]
                 snprintf(info->dest, PATH_MAX, "%s/%s", info->path, info->name);
                                                ^~~~~~~
lustre_rsync.c:824:17: note: Б─≤snprintfБ─≥ output between 2 and 4353 bytes into a destination of size 4096
                 snprintf(info->dest, PATH_MAX, "%s/%s", info->path, info->name;
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lustre_rsync.c:837:38: warning: Б─≤%sБ─≥ directive output may be truncated writing up to 4096 bytes into a region of size 4095 [-Wformat-truncation=]
   snprintf(info->dest, PATH_MAX, "%s/%s", status->ls_targets[0],
                                      ^~
lustre_rsync.c:837:3: note: Б─≤snprintfБ─≥ output 2 or more bytes (assuming 4098) into a destination of size 4096
   snprintf(info->dest, PATH_MAX, "%s/%s", status->ls_targets[0],
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    info->path);
    ~~~~~~~~~~~
lustre_rsync.c:847:52: warning: Б─≤%sБ─≥ directive output may be truncated writing up to 4096 bytes into a region of size 4095 [-Wformat-truncation=]
                 snprintf(info->dest, PATH_MAX, "%s/%s",
                                                    ^~
lustre_rsync.c:847:17: note: Б─≤snprintfБ─≥ output 2 or more bytes (assuming 4098) into a destination of size 4096
                 snprintf(info->dest, PATH_MAX, "%s/%s",
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         status->ls_targets[info->target_no], info->savedpath);
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lustre_rsync.c: In function Б─≤lr_removeБ─≥:
lustre_rsync.c:886:52: warning: Б─≤%sБ─≥ directive output may be truncated writing up to 4096 bytes into a region of size 4095 [-Wformat-truncation=]
                 snprintf(info->dest, PATH_MAX, "%s/%s/%s",
                                                    ^~
lustre_rsync.c:886:17: note: Б─≤snprintfБ─≥ output 3 or more bytes (assuming 4354) into a destination of size 4096
                 snprintf(info->dest, PATH_MAX, "%s/%s/%s",
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         status->ls_targets[info->target_no], info->path,
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         info->name);
                         ~~~~~~~~~~~
lustre_rsync.c: In function Б─≤lr_moveБ─≥:
lustre_rsync.c:929:60: warning: Б─≤%sБ─≥ directive output may be truncated writing up to 4096 bytes into a region of size 4095 [-Wformat-truncation=]
                         snprintf(info->dest, PATH_MAX, "%s/%s",
                                                            ^~
lustre_rsync.c:929:25: note: Б─≤snprintfБ─≥ output 2 or more bytes (assuming 4098) into a destination of size 4096
                         snprintf(info->dest, PATH_MAX, "%s/%s",
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                 status->ls_targets[info->target_no],
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     info->path);
     ~~~~~~~~~~~          
lustre_rsync.c:935:68: warning: Б─≤%sБ─≥ directive output may be truncated writing up to 4096 bytes into a region of size 4095 [-Wformat-truncation=]
                                 snprintf(info->dest, PATH_MAX, "%s/%s/%s",
                                                                    ^~
lustre_rsync.c:935:33: note: Б─≤snprintfБ─≥ output 3 or more bytes (assuming 4354) into a destination of size 4096
                                 snprintf(info->dest, PATH_MAX, "%s/%s/%s",
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                         status->ls_targets[info->target_no],
                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      info->path, info->name);
      ~~~~~~~~~~~~~~~~~~~~~~~     
lustre_rsync.c: In function Б─≤lr_linkБ─≥:
lustre_rsync.c:1022:45: warning: Б─≤/Б─≥ directive output may be truncated writing 1 byte into a region of size between 0 and 4096 [-Wformat-truncation=]
    snprintf(info->dest, sizeof(info->dest), "%s/%s/%s",
                                             ^~~~~~~~~~
lustre_rsync.c:1022:4: note: Б─≤snprintfБ─≥ output 3 or more bytes (assuming 4354) into a destination of size 4097
    snprintf(info->dest, sizeof(info->dest), "%s/%s/%s",
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      status->ls_targets[info->target_no],
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      info->path, info->name);
      ~~~~~~~~~~~~~~~~~~~~~~~
lustre_rsync.c:1042:43: warning: Б─≤%sБ─≥ directive output may be truncated writing up to 4096 bytes into a region of size 4095 [-Wformat-truncation=]
    snprintf(srcpath, sizeof(srcpath), "%s/%s",
                                           ^~
lustre_rsync.c:1042:4: note: Б─≤snprintfБ─≥ output 2 or more bytes (assuming 4098) into a destination of size 4096
    snprintf(srcpath, sizeof(srcpath), "%s/%s",
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      status->ls_targets[info->target_no],
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      info->path);
      ~~~~~~~~~~~
lustre_rsync.c: In function Б─≤lr_setattrБ─≥:
lustre_rsync.c:1096:52: warning: Б─≤%sБ─≥ directive output may be truncated writing up to 4096 bytes into a region of size 4095 [-Wformat-truncation=]
                 snprintf(info->dest, PATH_MAX, "%s/%s",
                                                    ^~
lustre_rsync.c:1096:17: note: Б─≤snprintfБ─≥ output 2 or more bytes (assuming 4098) into a destination of size 4096
                 snprintf(info->dest, PATH_MAX, "%s/%s",
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                          status->ls_targets[info->target_no], info->path);
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lustre_rsync.c: In function Б─≤lr_setxattrБ─≥:
lustre_rsync.c:1127:52: warning: Б─≤%sБ─≥ directive output may be truncated writing up to 4096 bytes into a region of size 4095 [-Wformat-truncation=]
                 snprintf(info->dest, PATH_MAX, "%s/%s",
                                                    ^~
lustre_rsync.c:1127:17: note: Б─≤snprintfБ─≥ output 2 or more bytes (assuming 4098) into a destination of size 4096
                 snprintf(info->dest, PATH_MAX, "%s/%s",
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         status->ls_targets[info->target_no], info->path);
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lustre_rsync.c: In function Б─≤lr_replicateБ─≥:
lustre_rsync.c:1509:68: warning: Б─≤%sБ─≥ directive output may be truncated writing 8 bytes into a region of size between 0 and 64 [-Wformat-truncation=]
                 snprintf(status->ls_mdt_device, LR_NAME_MAXLEN, "%s%s",
                                                                    ^~
lustre_rsync.c:1509:17: note: Б─≤snprintfБ─≥ output between 9 and 73 bytes into a destination of size 64
                 snprintf(status->ls_mdt_device, LR_NAME_MAXLEN, "%s%s",
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         status->ls_source_fs, DEFAULT_MDT);
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


 Comments   
Comment by Gerrit Updater [ 04/Aug/17 ]

Oleg Drokin (oleg.drokin@intel.com) uploaded a new patch: https://review.whamcloud.com/28361
Subject: LU-9833 utils: Make format-truncation nonfatal
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: b03ac7087ff3387b87ec361494c200c7c553edf3

Comment by Gerrit Updater [ 05/Dec/17 ]

James Simmons (uja.ornl@yahoo.com) uploaded a new patch: https://review.whamcloud.com/30373
Subject: LU-9833 utils: resolve buffer over runs in lustre_rsync
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: efb753c59b6a6c7142e226b753bd591186df0c75

Comment by Gerrit Updater [ 25/Jan/18 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/30373/
Subject: LU-9833 utils: resolve buffer over runs in lustre_rsync
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: b9bdd849f076302550221ff195e83e31dd7bddfc

Comment by Peter Jones [ 25/Jan/18 ]

Landed for 2.11

Comment by Gerrit Updater [ 25/Jan/18 ]

Minh Diep (minh.diep@intel.com) uploaded a new patch: https://review.whamcloud.com/31014
Subject: LU-9833 utils: resolve buffer over runs in lustre_rsync
Project: fs/lustre-release
Branch: b2_10
Current Patch Set: 1
Commit: ff31cf3a1acb0dd0329ead19c5b74d8cd1929170

Comment by Gerrit Updater [ 26/Feb/18 ]

John L. Hammond (john.hammond@intel.com) merged in patch https://review.whamcloud.com/31014/
Subject: LU-9833 utils: resolve buffer over runs in lustre_rsync
Project: fs/lustre-release
Branch: b2_10
Current Patch Set:
Commit: 1216051bace3b341f59fef0925ccc458abb03b12

Generated at Sat Feb 10 02:29:41 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.