Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing compilation warnings in building glusterfs #4452

Draft
wants to merge 1 commit into
base: devel
Choose a base branch
from

Conversation

pranithk
Copy link
Member

client_t.c: In function 'gf_client_dump_fdtables':
client_t.c:601:17: warning: the comparison will always evaluate as 'true' for the address of 'client_uid' will never be NULL [-Waddress]
  601 |             if (client->client_uid) {
      |                 ^~~~~~
In file included from ./glusterfs/stack.h:31,
                 from ./glusterfs/xlator.h:53,
                 from ./glusterfs/fd.h:79,
                 from ./glusterfs/inode.h:33,
                 from glusterfs/statedump.h:15,
                 from client_t.c:12:
./glusterfs/client_t.h:59:10: note: 'client_uid' declared here
   59 |     char client_uid[];
      |          ^~~~~~~~~~
....
glusterd-svc-mgmt.c: In function 'glusterd_svc_build_volfile_path':
glusterd-svc-mgmt.c:298:38: warning: '-server.vol' directive output may be truncated writing 11 bytes into a region of size between 0 and 4095 [-Wformat-truncation=]
  298 |         snprintf(volfile, len, "%s/%s-server.vol", dir, server);
      |                                      ^~~~~~~~~~~
glusterd-svc-mgmt.c:298:9: note: 'snprintf' output 13 or more bytes (assuming 4108) into a destination of size 4096
  298 |         snprintf(volfile, len, "%s/%s-server.vol", dir, server);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
glusterd-svc-mgmt.c:296:38: warning: '.vol' directive output may be truncated writing 4 bytes into a region of size between 0 and 4095 [-Wformat-truncation=]
  296 |         snprintf(volfile, len, "%s/%s.vol", dir, server);
      |                                      ^~~~
glusterd-svc-mgmt.c:296:9: note: 'snprintf' output 6 or more bytes (assuming 4101) into a destination of size 4096
  296 |         snprintf(volfile, len, "%s/%s.vol", dir, server);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
glusterd-svc-mgmt.c: In function 'glusterd_svc_build_pidfile_path':
glusterd-svc-mgmt.c:279:31: warning: '.pid' directive output may be truncated writing 4 bytes into a region of size between 0 and 4095 [-Wformat-truncation=]
  279 |     snprintf(path, len, "%s/%s.pid", dir, server);
      |                               ^~~~
glusterd-svc-mgmt.c:279:5: note: 'snprintf' output 6 or more bytes (assuming 4101) into a destination of size 4096
  279 |     snprintf(path, len, "%s/%s.pid", dir, server);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
glusterd-utils.c: In function 'glusterd_is_path_in_use':
glusterd-utils.c:7676:40: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 2031 [-Wformat-truncation=]
 7676 |                      "parent directory %s is "
      |                                        ^~
glusterd-utils.c:7675:13: note: 'snprintf' output between 46 and 4141 bytes into a destination of size 2048
 7675 |             snprintf(msg, sizeof(msg),
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
 7676 |                      "parent directory %s is "
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~
 7677 |                      "already part of a volume",
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 7678 |                      curdir);
      |                      ~~~~~~~
glusterd-mgmt.c: In function 'gd_mgmt_v3_collate_errors':
glusterd-mgmt.c:82:77: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 4072 [-Wformat-truncation=]
   82 |                 snprintf(op_err, sizeof(op_err), "Post commit failed on %s. %s",
      |                                                                             ^~
glusterd-mgmt.c:82:17: note: 'snprintf' output 25 or more bytes (assuming 4120) into a destination of size 4096
   82 |                 snprintf(op_err, sizeof(op_err), "Post commit failed on %s. %s",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   83 |                          peer_str, err_string);
      |                          ~~~~~~~~~~~~~~~~~~~~~
glusterd-mgmt.c:93:75: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 4074 [-Wformat-truncation=]
   93 |                 snprintf(op_err, sizeof(op_err), "Unlocking failed on %s. %s",
      |                                                                           ^~
glusterd-mgmt.c:93:17: note: 'snprintf' output 23 or more bytes (assuming 4118) into a destination of size 4096
   93 |                 snprintf(op_err, sizeof(op_err), "Unlocking failed on %s. %s",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   94 |                          peer_str, err_string);
      |                          ~~~~~~~~~~~~~~~~~~~~~
glusterd-mgmt.c:88:57: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 4068 [-Wformat-truncation=]
   88 |                          "Post Validation failed on %s. %s", peer_str,
      |                                                         ^~
glusterd-mgmt.c:87:17: note: 'snprintf' output 29 or more bytes (assuming 4124) into a destination of size 4096
   87 |                 snprintf(op_err, sizeof(op_err),
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   88 |                          "Post Validation failed on %s. %s", peer_str,
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   89 |                          err_string);
      |                          ~~~~~~~~~~~
glusterd-mgmt.c:77:72: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 4077 [-Wformat-truncation=]
   77 |                 snprintf(op_err, sizeof(op_err), "Commit failed on %s. %s",
      |                                                                        ^~
glusterd-mgmt.c:77:17: note: 'snprintf' output 20 or more bytes (assuming 4115) into a destination of size 4096
   77 |                 snprintf(op_err, sizeof(op_err), "Commit failed on %s. %s",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   78 |                          peer_str, err_string);
      |                          ~~~~~~~~~~~~~~~~~~~~~
glusterd-mgmt.c:72:75: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 4074 [-Wformat-truncation=]
   72 |                 snprintf(op_err, sizeof(op_err), "Brick ops failed on %s. %s",
      |                                                                           ^~
glusterd-mgmt.c:72:17: note: 'snprintf' output 23 or more bytes (assuming 4118) into a destination of size 4096
   72 |                 snprintf(op_err, sizeof(op_err), "Brick ops failed on %s. %s",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   73 |                          peer_str, err_string);
      |                          ~~~~~~~~~~~~~~~~~~~~~
glusterd-mgmt.c:67:56: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 4069 [-Wformat-truncation=]
   67 |                          "Pre Validation failed on %s. %s", peer_str,
      |                                                        ^~
glusterd-mgmt.c:66:17: note: 'snprintf' output 28 or more bytes (assuming 4123) into a destination of size 4096
   66 |                 snprintf(op_err, sizeof(op_err),
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   67 |                          "Pre Validation failed on %s. %s", peer_str,
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   68 |                          err_string);
      |                          ~~~~~~~~~~~
glusterd-mgmt.c:61:73: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 4076 [-Wformat-truncation=]
   61 |                 snprintf(op_err, sizeof(op_err), "Locking failed on %s. %s",
      |                                                                         ^~
glusterd-mgmt.c:61:17: note: 'snprintf' output 21 or more bytes (assuming 4116) into a destination of size 4096
   61 |                 snprintf(op_err, sizeof(op_err), "Locking failed on %s. %s",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   62 |                          peer_str, err_string);
      |                          ~~~~~~~~~~~~~~~~~~~~~
glusterd-mgmt.c:98:73: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 4076 [-Wformat-truncation=]
   98 |                 snprintf(op_err, sizeof(op_err), "Unknown error! on %s. %s",
      |                                                                         ^~
glusterd-mgmt.c:98:17: note: 'snprintf' output 21 or more bytes (assuming 4116) into a destination of size 4096
   98 |                 snprintf(op_err, sizeof(op_err), "Unknown error! on %s. %s",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   99 |                          peer_str, err_string);
      |                          ~~~~~~~~~~~~~~~~~~~~~

Change-Id: I327fb1826eda66ae283547d9319435b2aac3ada4

@gluster-ant
Copy link
Collaborator

CLANG-FORMAT FAILURE:
Before merging the patch, this diff needs to be considered for passing clang-format

index 4f7b93e2c..829e52b9e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
@@ -105,7 +105,7 @@ gd_mgmt_v3_collate_errors(struct syncargs *args, int op_ret, int op_errno,
         }
 
         gf_msg(THIS->name, GF_LOG_ERROR, 0, GD_MSG_MGMTV3_OP_FAIL, "%s",
-                op_err);
+               op_err);
         if (len >= sizeof(op_err)) {
             strcpy(op_err, "Truncated error message, check logfile");
         }

```
client_t.c: In function 'gf_client_dump_fdtables':
client_t.c:601:17: warning: the comparison will always evaluate as 'true' for the address of 'client_uid' will never be NULL [-Waddress]
  601 |             if (client->client_uid) {
      |                 ^~~~~~
In file included from ./glusterfs/stack.h:31,
                 from ./glusterfs/xlator.h:53,
                 from ./glusterfs/fd.h:79,
                 from ./glusterfs/inode.h:33,
                 from glusterfs/statedump.h:15,
                 from client_t.c:12:
./glusterfs/client_t.h:59:10: note: 'client_uid' declared here
   59 |     char client_uid[];
      |          ^~~~~~~~~~
....
glusterd-svc-mgmt.c: In function 'glusterd_svc_build_volfile_path':
glusterd-svc-mgmt.c:298:38: warning: '-server.vol' directive output may be truncated writing 11 bytes into a region of size between 0 and 4095 [-Wformat-truncation=]
  298 |         snprintf(volfile, len, "%s/%s-server.vol", dir, server);
      |                                      ^~~~~~~~~~~
glusterd-svc-mgmt.c:298:9: note: 'snprintf' output 13 or more bytes (assuming 4108) into a destination of size 4096
  298 |         snprintf(volfile, len, "%s/%s-server.vol", dir, server);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
glusterd-svc-mgmt.c:296:38: warning: '.vol' directive output may be truncated writing 4 bytes into a region of size between 0 and 4095 [-Wformat-truncation=]
  296 |         snprintf(volfile, len, "%s/%s.vol", dir, server);
      |                                      ^~~~
glusterd-svc-mgmt.c:296:9: note: 'snprintf' output 6 or more bytes (assuming 4101) into a destination of size 4096
  296 |         snprintf(volfile, len, "%s/%s.vol", dir, server);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
glusterd-svc-mgmt.c: In function 'glusterd_svc_build_pidfile_path':
glusterd-svc-mgmt.c:279:31: warning: '.pid' directive output may be truncated writing 4 bytes into a region of size between 0 and 4095 [-Wformat-truncation=]
  279 |     snprintf(path, len, "%s/%s.pid", dir, server);
      |                               ^~~~
glusterd-svc-mgmt.c:279:5: note: 'snprintf' output 6 or more bytes (assuming 4101) into a destination of size 4096
  279 |     snprintf(path, len, "%s/%s.pid", dir, server);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
glusterd-utils.c: In function 'glusterd_is_path_in_use':
glusterd-utils.c:7676:40: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 2031 [-Wformat-truncation=]
 7676 |                      "parent directory %s is "
      |                                        ^~
glusterd-utils.c:7675:13: note: 'snprintf' output between 46 and 4141 bytes into a destination of size 2048
 7675 |             snprintf(msg, sizeof(msg),
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
 7676 |                      "parent directory %s is "
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~
 7677 |                      "already part of a volume",
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 7678 |                      curdir);
      |                      ~~~~~~~
glusterd-mgmt.c: In function 'gd_mgmt_v3_collate_errors':
glusterd-mgmt.c:82:77: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 4072 [-Wformat-truncation=]
   82 |                 snprintf(op_err, sizeof(op_err), "Post commit failed on %s. %s",
      |                                                                             ^~
glusterd-mgmt.c:82:17: note: 'snprintf' output 25 or more bytes (assuming 4120) into a destination of size 4096
   82 |                 snprintf(op_err, sizeof(op_err), "Post commit failed on %s. %s",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   83 |                          peer_str, err_string);
      |                          ~~~~~~~~~~~~~~~~~~~~~
glusterd-mgmt.c:93:75: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 4074 [-Wformat-truncation=]
   93 |                 snprintf(op_err, sizeof(op_err), "Unlocking failed on %s. %s",
      |                                                                           ^~
glusterd-mgmt.c:93:17: note: 'snprintf' output 23 or more bytes (assuming 4118) into a destination of size 4096
   93 |                 snprintf(op_err, sizeof(op_err), "Unlocking failed on %s. %s",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   94 |                          peer_str, err_string);
      |                          ~~~~~~~~~~~~~~~~~~~~~
glusterd-mgmt.c:88:57: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 4068 [-Wformat-truncation=]
   88 |                          "Post Validation failed on %s. %s", peer_str,
      |                                                         ^~
glusterd-mgmt.c:87:17: note: 'snprintf' output 29 or more bytes (assuming 4124) into a destination of size 4096
   87 |                 snprintf(op_err, sizeof(op_err),
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   88 |                          "Post Validation failed on %s. %s", peer_str,
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   89 |                          err_string);
      |                          ~~~~~~~~~~~
glusterd-mgmt.c:77:72: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 4077 [-Wformat-truncation=]
   77 |                 snprintf(op_err, sizeof(op_err), "Commit failed on %s. %s",
      |                                                                        ^~
glusterd-mgmt.c:77:17: note: 'snprintf' output 20 or more bytes (assuming 4115) into a destination of size 4096
   77 |                 snprintf(op_err, sizeof(op_err), "Commit failed on %s. %s",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   78 |                          peer_str, err_string);
      |                          ~~~~~~~~~~~~~~~~~~~~~
glusterd-mgmt.c:72:75: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 4074 [-Wformat-truncation=]
   72 |                 snprintf(op_err, sizeof(op_err), "Brick ops failed on %s. %s",
      |                                                                           ^~
glusterd-mgmt.c:72:17: note: 'snprintf' output 23 or more bytes (assuming 4118) into a destination of size 4096
   72 |                 snprintf(op_err, sizeof(op_err), "Brick ops failed on %s. %s",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   73 |                          peer_str, err_string);
      |                          ~~~~~~~~~~~~~~~~~~~~~
glusterd-mgmt.c:67:56: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 4069 [-Wformat-truncation=]
   67 |                          "Pre Validation failed on %s. %s", peer_str,
      |                                                        ^~
glusterd-mgmt.c:66:17: note: 'snprintf' output 28 or more bytes (assuming 4123) into a destination of size 4096
   66 |                 snprintf(op_err, sizeof(op_err),
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   67 |                          "Pre Validation failed on %s. %s", peer_str,
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   68 |                          err_string);
      |                          ~~~~~~~~~~~
glusterd-mgmt.c:61:73: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 4076 [-Wformat-truncation=]
   61 |                 snprintf(op_err, sizeof(op_err), "Locking failed on %s. %s",
      |                                                                         ^~
glusterd-mgmt.c:61:17: note: 'snprintf' output 21 or more bytes (assuming 4116) into a destination of size 4096
   61 |                 snprintf(op_err, sizeof(op_err), "Locking failed on %s. %s",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   62 |                          peer_str, err_string);
      |                          ~~~~~~~~~~~~~~~~~~~~~
glusterd-mgmt.c:98:73: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 4076 [-Wformat-truncation=]
   98 |                 snprintf(op_err, sizeof(op_err), "Unknown error! on %s. %s",
      |                                                                         ^~
glusterd-mgmt.c:98:17: note: 'snprintf' output 21 or more bytes (assuming 4116) into a destination of size 4096
   98 |                 snprintf(op_err, sizeof(op_err), "Unknown error! on %s. %s",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   99 |                          peer_str, err_string);
      |                          ~~~~~~~~~~~~~~~~~~~~~
```
Change-Id: I327fb1826eda66ae283547d9319435b2aac3ada4
Signed-off-by: Pranith Kumar Karampuri <[email protected]>

Signed-off-by: Pranith Kumar Karampuri <[email protected]>
@pranithk pranithk force-pushed the fix-compilation-warnings-1 branch from 77a43f9 to c726f84 Compare January 17, 2025 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants