diff mbox series

[v3] obex: Add messages_get_message() implementation for MAP plugin

Message ID 20250303150409.3850394-1-quic_amisjain@quicinc.com (mailing list archive)
State Superseded
Headers show
Series [v3] obex: Add messages_get_message() implementation for MAP plugin | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake fail BluezMake FAIL: tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12893:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12893 | int main(int argc, char *argv[]) | ^~~~ unit/test-avdtp.c: In function ‘main’: unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 766 | int main(int argc, char *argv[]) | ^~~~ unit/test-avrcp.c: In function ‘main’: unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 989 | int main(int argc, char *argv[]) | ^~~~ obexd/plugins/messages-dummy.c: In function ‘messages_get_message’: obexd/plugins/messages-dummy.c:534:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 534 | int fd = fileno(fp); | ^~~ obexd/plugins/messages-dummy.c:542:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 542 | int file_size = file_info.st_size; | ^~~ obexd/plugins/messages-dummy.c:545:6: error: pointer targets in assignment from ‘char *’ to ‘unsigned char *’ differ in signedness [-Werror=pointer-sign] 545 | msg = (char *) mmap(0, file_size, PROT_READ, MAP_PRIVATE, fd, 0); | ^ obexd/plugins/messages-dummy.c:553:15: error: pointer targets in passing argument 2 of ‘strcpy’ differ in signedness [-Werror=pointer-sign] 553 | strcpy(buff, msg); | ^~~ | | | unsigned char * In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/sys/types.h:25, from obexd/plugins/messages-dummy.c:15: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:88:1: note: expected ‘const char * restrict’ but argument is of type ‘unsigned char *’ 88 | __NTH (strcpy (char *__restrict __dest, const char *__restrict __src)) | ^~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:9695: obexd/plugins/obexd-messages-dummy.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4682: all] Error 2
tedd_an/MakeCheck fail BlueZ Make Check FAIL:
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind fail Check Valgrind FAIL: tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12893:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12893 | int main(int argc, char *argv[]) | ^~~~ obexd/plugins/messages-dummy.c: In function ‘messages_get_message’: obexd/plugins/messages-dummy.c:534:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 534 | int fd = fileno(fp); | ^~~ obexd/plugins/messages-dummy.c:542:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 542 | int file_size = file_info.st_size; | ^~~ obexd/plugins/messages-dummy.c:545:6: error: pointer targets in assignment from ‘char *’ to ‘unsigned char *’ differ in signedness [-Werror=pointer-sign] 545 | msg = (char *) mmap(0, file_size, PROT_READ, MAP_PRIVATE, fd, 0); | ^ obexd/plugins/messages-dummy.c:553:15: error: pointer targets in passing argument 2 of ‘strcpy’ differ in signedness [-Werror=pointer-sign] 553 | strcpy(buff, msg); | ^~~ | | | unsigned char * In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/sys/types.h:25, from obexd/plugins/messages-dummy.c:15: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:88:1: note: expected ‘const char * restrict’ but argument is of type ‘unsigned char *’ 88 | __NTH (strcpy (char *__restrict __dest, const char *__restrict __src)) | ^~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:9695: obexd/plugins/obexd-messages-dummy.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:12320: check] Error 2
tedd_an/CheckSmatch fail CheckSparse: FAIL: src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:278:25: warning: Variable length array is used. src/shared/gatt-server.c:618:25: warning: Variable length array is used. src/shared/gatt-server.c:716:25: warning: Variable length array is used. src/shared/bap.c:305:25: warning: array of flexible structures src/shared/bap.c: note: in included file: ./src/shared/ascs.h:88:25: warning: array of flexible structures src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:278:25: warning: Variable length array is used. src/shared/gatt-server.c:618:25: warning: Variable length array is used. src/shared/gatt-server.c:716:25: warning: Variable length array is used. src/shared/bap.c:305:25: warning: array of flexible structures src/shared/bap.c: note: in included file: ./src/shared/ascs.h:88:25: warning: array of flexible structures src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' tools/mesh-cfgtest.c:1453:17: warning: unknown escape sequence: '\%' tools/sco-tester.c: note: in included file: ./lib/bluetooth.h:232:15: warning: array of flexible structures ./lib/bluetooth.h:237:31: warning: array of flexible structures tools/bneptest.c:634:39: warning: unknown escape sequence: '\%' tools/seq2bseq.c:57:26: warning: Variable length array is used. tools/obex-client-tool.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' android/avctp.c:505:34: warning: Variable length array is used. android/avctp.c:556:34: warning: Variable length array is used. unit/test-avrcp.c:373:26: warning: Variable length array is used. unit/test-avrcp.c:398:26: warning: Variable length array is used. unit/test-avrcp.c:414:24: warning: Variable length array is used. android/avrcp-lib.c:1085:34: warning: Variable length array is used. android/avrcp-lib.c:1583:34: warning: Variable length array is used. android/avrcp-lib.c:1612:34: warning: Variable length array is used. android/avrcp-lib.c:1638:34: warning: Variable length array is used. mesh/mesh-io-mgmt.c:523:67: warning: Variable length array is used. client/display.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:278:25: warning: Variable length array is used. src/shared/gatt-server.c:618:25: warning: Variable length array is used. src/shared/gatt-server.c:716:25: warning: Variable length array is used. src/shared/bap.c:305:25: warning: array of flexible structures src/shared/bap.c: note: in included file: ./src/shared/ascs.h:88:25: warning: array of flexible structures src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' monitor/packet.c: note: in included file: monitor/display.h:82:26: warning: Variable length array is used. monitor/packet.c:1876:26: warning: Variable length array is used. monitor/l2cap.c: note: in included file: monitor/display.h:82:26: warning: Variable length array is used. monitor/packet.c: note: in included file: monitor/bt.h:3606:52: warning: array of flexible structures monitor/bt.h:3594:40: warning: array of flexible structures monitor/msft.c: note: in included file: monitor/msft.h:88:44: warning: array of flexible structures monitor/att.c: note: in included file: monitor/display.h:82:26: warning: Variable length array is used. tools/rctest.c:627:33: warning: non-ANSI function declaration of function 'automated_send_recv' tools/hex2hcd.c:136:26: warning: Variable length array is used. tools/meshctl.c:324:33: warning: non-ANSI function declaration of function 'forget_mesh_devices' tools/mesh-gatt/node.c:456:39: warning: non-ANSI function declaration of function 'node_get_local_node' tools/mesh-gatt/net.c:1239:30: warning: non-ANSI function declaration of function 'get_next_seq' tools/mesh-gatt/net.c:2193:29: warning: non-ANSI function declaration of function 'net_get_default_ttl' tools/mesh-gatt/net.c:2207:26: warning: non-ANSI function declaration of function 'net_get_seq_num' tools/mesh-gatt/prov.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' tools/mesh-gatt/onoff-model.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' ell/log.c:431:65: warning: non-ANSI function declaration of function 'register_debug_section' ell/log.c:439:68: warning: non-ANSI function declaration of function 'free_debug_sections' ell/random.c:60:42: warning: non-ANSI function declaration of function 'l_getrandom_is_supported' ell/cipher.c:660:28: warning: non-ANSI function declaration of function 'init_supported' ell/checksum.c:374:28: warning: non-ANSI function declaration of function 'init_supported' ell/checksum.c:436:47: warning: non-ANSI function declaration of function 'l_checksum_cmac_aes_supported' ell/cipher.c:519:24: warning: Variable length array is used. ell/cert-crypto.c:36:33: warning: Variable length array is used. ell/cert-crypto.c:132:36: warning: Variable length array is used. ell/cert-crypto.c:188:36: warning: Variable length array is used. ell/cert-crypto.c:241:31: warning: Variable length array is used. ell/key.c:538:25: warning: Variable length array is used. ell/dbus-service.c:548:49: warning: non-ANSI function declaration of function '_dbus_object_tree_new' ell/dbus-filter.c:232:46: warning: Variable length array is used. ell/tls.c:45:25: warning: Variable length array is used. ell/tls.c:86:22: warning: Variable length array is used. ell/tls.c:86:46: warning: Variable length array is used. ell/tls-suites.c:1078:25: warning: Variable length array is used. ell/tls-suites.c:1080:34: warning: Variable length array is used. ell/tls-suites.c:1083:41: warning: Variable length array is used. ell/tls-suites.c:1132:41: warning: Variable length array is used. ell/tls.c:1819:26: warning: Variable length array is used. emulator/btdev.c:450:29: warning: Variable length array is used. emulator/bthost.c:613:28: warning: Variable length array is used. emulator/bthost.c:787:28: warning: Variable length array is used. attrib/gatttool.c:235:23: warning: Variable length array is used. attrib/interactive.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' attrib/interactive.c:174:27: warning: non-ANSI function declaration of function 'disconnect_io' attrib/interactive.c:299:23: warning: Variable length array is used. profiles/sap/server.c: note: in included file: profiles/sap/sap.h:77:35: warning: array of flexible structures obexd/plugins/messages-dummy.c:534:9: warning: mixing declarations and code obexd/plugins/messages-dummy.c:542:9: warning: mixing declarations and code obexd/plugins/messages-dummy.c:543:28: warning: Variable length array is used. obexd/plugins/messages-dummy.c: In function ‘messages_get_message’: obexd/plugins/messages-dummy.c:534:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 534 | int fd = fileno(fp); | ^~~ obexd/plugins/messages-dummy.c:542:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 542 | int file_size = file_info.st_size; | ^~~ obexd/plugins/messages-dummy.c:545:6: error: pointer targets in assignment from ‘char *’ to ‘unsigned char *’ differ in signedness [-Werror=pointer-sign] 545 | msg = (char *) mmap(0, file_size, PROT_READ, MAP_PRIVATE, fd, 0); | ^ obexd/plugins/messages-dummy.c:553:15: error: pointer targets in passing argument 2 of ‘strcpy’ differ in signedness [-Werror=pointer-sign] 553 | strcpy(buff, msg); | ^~~ | | | unsigned char * In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/sys/types.h:25, from obexd/plugins/messages-dummy.c:15: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:88:1: note: expected ‘const char * restrict’ but argument is of type ‘unsigned char *’ 88 | __NTH (strcpy (char *__restrict __dest, const char *__restrict __src)) | ^~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:9695: obexd/plugins/obexd-messages-dummy.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4682: all] Error 2
tedd_an/bluezmakeextell fail Make External ELL FAIL: obexd/plugins/messages-dummy.c: In function ‘messages_get_message’: obexd/plugins/messages-dummy.c:534:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 534 | int fd = fileno(fp); | ^~~ obexd/plugins/messages-dummy.c:542:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 542 | int file_size = file_info.st_size; | ^~~ obexd/plugins/messages-dummy.c:545:6: error: pointer targets in assignment from ‘char *’ to ‘unsigned char *’ differ in signedness [-Werror=pointer-sign] 545 | msg = (char *) mmap(0, file_size, PROT_READ, MAP_PRIVATE, fd, 0); | ^ obexd/plugins/messages-dummy.c:553:15: error: pointer targets in passing argument 2 of ‘strcpy’ differ in signedness [-Werror=pointer-sign] 553 | strcpy(buff, msg); | ^~~ | | | unsigned char * In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/sys/types.h:25, from obexd/plugins/messages-dummy.c:15: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:88:1: note: expected ‘const char * restrict’ but argument is of type ‘unsigned char *’ 88 | __NTH (strcpy (char *__restrict __dest, const char *__restrict __src)) | ^~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:9695: obexd/plugins/obexd-messages-dummy.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4682: all] Error 2
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Amisha Jain March 3, 2025, 3:04 p.m. UTC
GET Message() operation should be supported for passing below PTS
testcases -

1.MAP/MSE/MMB/BV-12-C
  Verify that the MSE can return an email message to the MCE.
2.MAP/MSE/MMB/BV-13-C
  Verify that the MSE can return a a*n* SMS message in native format
  to the MCE.
3.MAP/MSE/MMB/BV-14-C
  Verify that the MSE can return a SMS message with text trans-coded
  to UTF-8 to the MCE.

Currently get message operation is not implemented, hence above
testcases are failing.
Added code to send the complete bmessage in response to the get() request
for the requested message handle.

As per suggested in previous patch, mmap() is being used
for reading file.

---
 obexd/plugins/mas.c            |  5 ++--
 obexd/plugins/messages-dummy.c | 47 +++++++++++++++++++++++++++++++++-
 2 files changed, 49 insertions(+), 3 deletions(-)

Comments

bluez.test.bot@gmail.com March 3, 2025, 4:13 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=939656

---Test result---

Test Summary:
CheckPatch                    PENDING   0.33 seconds
GitLint                       PENDING   0.27 seconds
BuildEll                      PASS      20.56 seconds
BluezMake                     FAIL      1622.60 seconds
MakeCheck                     FAIL      23.03 seconds
MakeDistcheck                 PASS      161.15 seconds
CheckValgrind                 FAIL      162.10 seconds
CheckSmatch                   FAIL      280.33 seconds
bluezmakeextell               FAIL      93.32 seconds
IncrementalBuild              PENDING   0.37 seconds
ScanBuild                     PASS      890.15 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: BluezMake - FAIL
Desc: Build BlueZ
Output:

tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12893:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12893 | int main(int argc, char *argv[])
      |     ^~~~
unit/test-avdtp.c: In function ‘main’:
unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
  766 | int main(int argc, char *argv[])
      |     ^~~~
unit/test-avrcp.c: In function ‘main’:
unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
  989 | int main(int argc, char *argv[])
      |     ^~~~
obexd/plugins/messages-dummy.c: In function ‘messages_get_message’:
obexd/plugins/messages-dummy.c:534:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
  534 |  int fd = fileno(fp);
      |  ^~~
obexd/plugins/messages-dummy.c:542:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
  542 |  int file_size = file_info.st_size;
      |  ^~~
obexd/plugins/messages-dummy.c:545:6: error: pointer targets in assignment from ‘char *’ to ‘unsigned char *’ differ in signedness [-Werror=pointer-sign]
  545 |  msg = (char *) mmap(0, file_size, PROT_READ, MAP_PRIVATE, fd, 0);
      |      ^
obexd/plugins/messages-dummy.c:553:15: error: pointer targets in passing argument 2 of ‘strcpy’ differ in signedness [-Werror=pointer-sign]
  553 |  strcpy(buff, msg);
      |               ^~~
      |               |
      |               unsigned char *
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/sys/types.h:25,
                 from obexd/plugins/messages-dummy.c:15:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:88:1: note: expected ‘const char * restrict’ but argument is of type ‘unsigned char *’
   88 | __NTH (strcpy (char *__restrict __dest, const char *__restrict __src))
      | ^~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:9695: obexd/plugins/obexd-messages-dummy.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4682: all] Error 2
##############################
Test: MakeCheck - FAIL
Desc: Run Bluez Make Check
Output:

obexd/plugins/messages-dummy.c: In function ‘messages_get_message’:
obexd/plugins/messages-dummy.c:534:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
  534 |  int fd = fileno(fp);
      |  ^~~
obexd/plugins/messages-dummy.c:542:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
  542 |  int file_size = file_info.st_size;
      |  ^~~
obexd/plugins/messages-dummy.c:545:6: error: pointer targets in assignment from ‘char *’ to ‘unsigned char *’ differ in signedness [-Werror=pointer-sign]
  545 |  msg = (char *) mmap(0, file_size, PROT_READ, MAP_PRIVATE, fd, 0);
      |      ^
obexd/plugins/messages-dummy.c:553:15: error: pointer targets in passing argument 2 of ‘strcpy’ differ in signedness [-Werror=pointer-sign]
  553 |  strcpy(buff, msg);
      |               ^~~
      |               |
      |               unsigned char *
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/sys/types.h:25,
                 from obexd/plugins/messages-dummy.c:15:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:88:1: note: expected ‘const char * restrict’ but argument is of type ‘unsigned char *’
   88 | __NTH (strcpy (char *__restrict __dest, const char *__restrict __src))
      | ^~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:9695: obexd/plugins/obexd-messages-dummy.o] Error 1
make: *** [Makefile:12320: check] Error 2
##############################
Test: CheckValgrind - FAIL
Desc: Run Bluez Make Check with Valgrind
Output:

tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12893:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12893 | int main(int argc, char *argv[])
      |     ^~~~
obexd/plugins/messages-dummy.c: In function ‘messages_get_message’:
obexd/plugins/messages-dummy.c:534:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
  534 |  int fd = fileno(fp);
      |  ^~~
obexd/plugins/messages-dummy.c:542:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
  542 |  int file_size = file_info.st_size;
      |  ^~~
obexd/plugins/messages-dummy.c:545:6: error: pointer targets in assignment from ‘char *’ to ‘unsigned char *’ differ in signedness [-Werror=pointer-sign]
  545 |  msg = (char *) mmap(0, file_size, PROT_READ, MAP_PRIVATE, fd, 0);
      |      ^
obexd/plugins/messages-dummy.c:553:15: error: pointer targets in passing argument 2 of ‘strcpy’ differ in signedness [-Werror=pointer-sign]
  553 |  strcpy(buff, msg);
      |               ^~~
      |               |
      |               unsigned char *
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/sys/types.h:25,
                 from obexd/plugins/messages-dummy.c:15:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:88:1: note: expected ‘const char * restrict’ but argument is of type ‘unsigned char *’
   88 | __NTH (strcpy (char *__restrict __dest, const char *__restrict __src))
      | ^~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:9695: obexd/plugins/obexd-messages-dummy.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:12320: check] Error 2
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

src/shared/crypto.c:271:21: warning: Variable length array is used.
src/shared/crypto.c:272:23: warning: Variable length array is used.
src/shared/gatt-helpers.c:768:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:830:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used.
src/shared/gatt-server.c:278:25: warning: Variable length array is used.
src/shared/gatt-server.c:618:25: warning: Variable length array is used.
src/shared/gatt-server.c:716:25: warning: Variable length array is used.
src/shared/bap.c:305:25: warning: array of flexible structures
src/shared/bap.c: note: in included file:
./src/shared/ascs.h:88:25: warning: array of flexible structures
src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):
/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function'
/usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction'
/usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction'
/usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction'
src/shared/crypto.c:271:21: warning: Variable length array is used.
src/shared/crypto.c:272:23: warning: Variable length array is used.
src/shared/gatt-helpers.c:768:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:830:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used.
src/shared/gatt-server.c:278:25: warning: Variable length array is used.
src/shared/gatt-server.c:618:25: warning: Variable length array is used.
src/shared/gatt-server.c:716:25: warning: Variable length array is used.
src/shared/bap.c:305:25: warning: array of flexible structures
src/shared/bap.c: note: in included file:
./src/shared/ascs.h:88:25: warning: array of flexible structures
src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):
/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function'
/usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction'
/usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction'
/usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction'
tools/mesh-cfgtest.c:1453:17: warning: unknown escape sequence: '\%'
tools/sco-tester.c: note: in included file:
./lib/bluetooth.h:232:15: warning: array of flexible structures
./lib/bluetooth.h:237:31: warning: array of flexible structures
tools/bneptest.c:634:39: warning: unknown escape sequence: '\%'
tools/seq2bseq.c:57:26: warning: Variable length array is used.
tools/obex-client-tool.c: note: in included file (through /usr/include/readline/readline.h):
/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function'
/usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction'
/usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction'
/usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction'
android/avctp.c:505:34: warning: Variable length array is used.
android/avctp.c:556:34: warning: Variable length array is used.
unit/test-avrcp.c:373:26: warning: Variable length array is used.
unit/test-avrcp.c:398:26: warning: Variable length array is used.
unit/test-avrcp.c:414:24: warning: Variable length array is used.
android/avrcp-lib.c:1085:34: warning: Variable length array is used.
android/avrcp-lib.c:1583:34: warning: Variable length array is used.
android/avrcp-lib.c:1612:34: warning: Variable length array is used.
android/avrcp-lib.c:1638:34: warning: Variable length array is used.
mesh/mesh-io-mgmt.c:523:67: warning: Variable length array is used.
client/display.c: note: in included file (through /usr/include/readline/readline.h):
/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function'
/usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction'
/usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction'
/usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction'
src/shared/crypto.c:271:21: warning: Variable length array is used.
src/shared/crypto.c:272:23: warning: Variable length array is used.
src/shared/gatt-helpers.c:768:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:830:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used.
src/shared/gatt-server.c:278:25: warning: Variable length array is used.
src/shared/gatt-server.c:618:25: warning: Variable length array is used.
src/shared/gatt-server.c:716:25: warning: Variable length array is used.
src/shared/bap.c:305:25: warning: array of flexible structures
src/shared/bap.c: note: in included file:
./src/shared/ascs.h:88:25: warning: array of flexible structures
src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):
/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function'
/usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction'
/usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction'
/usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction'
monitor/packet.c: note: in included file:
monitor/display.h:82:26: warning: Variable length array is used.
monitor/packet.c:1876:26: warning: Variable length array is used.
monitor/l2cap.c: note: in included file:
monitor/display.h:82:26: warning: Variable length array is used.
monitor/packet.c: note: in included file:
monitor/bt.h:3606:52: warning: array of flexible structures
monitor/bt.h:3594:40: warning: array of flexible structures
monitor/msft.c: note: in included file:
monitor/msft.h:88:44: warning: array of flexible structures
monitor/att.c: note: in included file:
monitor/display.h:82:26: warning: Variable length array is used.
tools/rctest.c:627:33: warning: non-ANSI function declaration of function 'automated_send_recv'
tools/hex2hcd.c:136:26: warning: Variable length array is used.
tools/meshctl.c:324:33: warning: non-ANSI function declaration of function 'forget_mesh_devices'
tools/mesh-gatt/node.c:456:39: warning: non-ANSI function declaration of function 'node_get_local_node'
tools/mesh-gatt/net.c:1239:30: warning: non-ANSI function declaration of function 'get_next_seq'
tools/mesh-gatt/net.c:2193:29: warning: non-ANSI function declaration of function 'net_get_default_ttl'
tools/mesh-gatt/net.c:2207:26: warning: non-ANSI function declaration of function 'net_get_seq_num'
tools/mesh-gatt/prov.c: note: in included file (through /usr/include/readline/readline.h):
/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function'
/usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction'
/usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction'
/usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction'
tools/mesh-gatt/onoff-model.c: note: in included file (through /usr/include/readline/readline.h):
/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function'
/usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction'
/usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction'
/usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction'
ell/log.c:431:65: warning: non-ANSI function declaration of function 'register_debug_section'
ell/log.c:439:68: warning: non-ANSI function declaration of function 'free_debug_sections'
ell/random.c:60:42: warning: non-ANSI function declaration of function 'l_getrandom_is_supported'
ell/cipher.c:660:28: warning: non-ANSI function declaration of function 'init_supported'
ell/checksum.c:374:28: warning: non-ANSI function declaration of function 'init_supported'
ell/checksum.c:436:47: warning: non-ANSI function declaration of function 'l_checksum_cmac_aes_supported'
ell/cipher.c:519:24: warning: Variable length array is used.
ell/cert-crypto.c:36:33: warning: Variable length array is used.
ell/cert-crypto.c:132:36: warning: Variable length array is used.
ell/cert-crypto.c:188:36: warning: Variable length array is used.
ell/cert-crypto.c:241:31: warning: Variable length array is used.
ell/key.c:538:25: warning: Variable length array is used.
ell/dbus-service.c:548:49: warning: non-ANSI function declaration of function '_dbus_object_tree_new'
ell/dbus-filter.c:232:46: warning: Variable length array is used.
ell/tls.c:45:25: warning: Variable length array is used.
ell/tls.c:86:22: warning: Variable length array is used.
ell/tls.c:86:46: warning: Variable length array is used.
ell/tls-suites.c:1078:25: warning: Variable length array is used.
ell/tls-suites.c:1080:34: warning: Variable length array is used.
ell/tls-suites.c:1083:41: warning: Variable length array is used.
ell/tls-suites.c:1132:41: warning: Variable length array is used.
ell/tls.c:1819:26: warning: Variable length array is used.
emulator/btdev.c:450:29: warning: Variable length array is used.
emulator/bthost.c:613:28: warning: Variable length array is used.
emulator/bthost.c:787:28: warning: Variable length array is used.
attrib/gatttool.c:235:23: warning: Variable length array is used.
attrib/interactive.c: note: in included file (through /usr/include/readline/readline.h):
/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function'
/usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction'
/usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction'
/usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction'
attrib/interactive.c:174:27: warning: non-ANSI function declaration of function 'disconnect_io'
attrib/interactive.c:299:23: warning: Variable length array is used.
profiles/sap/server.c: note: in included file:
profiles/sap/sap.h:77:35: warning: array of flexible structures
obexd/plugins/messages-dummy.c:534:9: warning: mixing declarations and code
obexd/plugins/messages-dummy.c:542:9: warning: mixing declarations and code
obexd/plugins/messages-dummy.c:543:28: warning: Variable length array is used.
obexd/plugins/messages-dummy.c: In function ‘messages_get_message’:
obexd/plugins/messages-dummy.c:534:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
  534 |  int fd = fileno(fp);
      |  ^~~
obexd/plugins/messages-dummy.c:542:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
  542 |  int file_size = file_info.st_size;
      |  ^~~
obexd/plugins/messages-dummy.c:545:6: error: pointer targets in assignment from ‘char *’ to ‘unsigned char *’ differ in signedness [-Werror=pointer-sign]
  545 |  msg = (char *) mmap(0, file_size, PROT_READ, MAP_PRIVATE, fd, 0);
      |      ^
obexd/plugins/messages-dummy.c:553:15: error: pointer targets in passing argument 2 of ‘strcpy’ differ in signedness [-Werror=pointer-sign]
  553 |  strcpy(buff, msg);
      |               ^~~
      |               |
      |               unsigned char *
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/sys/types.h:25,
                 from obexd/plugins/messages-dummy.c:15:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:88:1: note: expected ‘const char * restrict’ but argument is of type ‘unsigned char *’
   88 | __NTH (strcpy (char *__restrict __dest, const char *__restrict __src))
      | ^~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:9695: obexd/plugins/obexd-messages-dummy.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4682: all] Error 2
##############################
Test: bluezmakeextell - FAIL
Desc: Build Bluez with External ELL
Output:

obexd/plugins/messages-dummy.c: In function ‘messages_get_message’:
obexd/plugins/messages-dummy.c:534:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
  534 |  int fd = fileno(fp);
      |  ^~~
obexd/plugins/messages-dummy.c:542:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
  542 |  int file_size = file_info.st_size;
      |  ^~~
obexd/plugins/messages-dummy.c:545:6: error: pointer targets in assignment from ‘char *’ to ‘unsigned char *’ differ in signedness [-Werror=pointer-sign]
  545 |  msg = (char *) mmap(0, file_size, PROT_READ, MAP_PRIVATE, fd, 0);
      |      ^
obexd/plugins/messages-dummy.c:553:15: error: pointer targets in passing argument 2 of ‘strcpy’ differ in signedness [-Werror=pointer-sign]
  553 |  strcpy(buff, msg);
      |               ^~~
      |               |
      |               unsigned char *
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/sys/types.h:25,
                 from obexd/plugins/messages-dummy.c:15:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:88:1: note: expected ‘const char * restrict’ but argument is of type ‘unsigned char *’
   88 | __NTH (strcpy (char *__restrict __dest, const char *__restrict __src))
      | ^~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:9695: obexd/plugins/obexd-messages-dummy.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4682: all] Error 2
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/obexd/plugins/mas.c b/obexd/plugins/mas.c
index 10b972d65..bf8d689ad 100644
--- a/obexd/plugins/mas.c
+++ b/obexd/plugins/mas.c
@@ -408,6 +408,7 @@  static void get_message_cb(void *session, int err, gboolean fmore,
 	}
 
 	g_string_append(mas->buffer, chunk);
+	mas->finished = TRUE;
 
 proceed:
 	if (err != -EAGAIN)
@@ -612,11 +613,11 @@  static void *message_open(const char *name, int oflag, mode_t mode,
 		return NULL;
 	}
 
+	mas->buffer = g_string_new("");
+
 	*err = messages_get_message(mas->backend_data, name, 0,
 			get_message_cb, mas);
 
-	mas->buffer = g_string_new("");
-
 	if (*err < 0)
 		return NULL;
 	else
diff --git a/obexd/plugins/messages-dummy.c b/obexd/plugins/messages-dummy.c
index e313c6163..68fa578a8 100644
--- a/obexd/plugins/messages-dummy.c
+++ b/obexd/plugins/messages-dummy.c
@@ -18,6 +18,8 @@ 
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
 
 #include "obexd/src/log.h"
 
@@ -516,7 +518,50 @@  int messages_get_message(void *session, const char *handle,
 					messages_get_message_cb callback,
 					void *user_data)
 {
-	return -ENOSYS;
+	struct session *s =  session;
+	FILE *fp;
+	char *path;
+	unsigned char *msg;
+
+	DBG(" ");
+	path = g_build_filename(s->cwd_absolute, handle, NULL);
+	fp = fopen(path, "r");
+	if (fp == NULL) {
+		DBG("fopen() failed");
+		return -EBADR;
+	}
+
+	int fd = fileno(fp);
+	struct stat file_info;
+	if (fstat (fd, &file_info) == -1) {
+		DBG("Error getting file size");
+		fclose(fp);
+		return -EBADR;
+	}
+
+	int file_size = file_info.st_size;
+	char buff[file_size+1];
+
+	msg = (char *) mmap(0, file_size, PROT_READ, MAP_PRIVATE, fd, 0);
+	if (msg == MAP_FAILED) {
+		DBG("Error mapping file");
+		fclose(fp);
+		return -EBADR;
+	}
+
+	fclose(fp);
+	strcpy(buff, msg);
+
+	if (callback)
+		callback(session, 0, 0, (const char*)buff, user_data);
+
+	if (munmap(msg, file_size) == -1) {
+		DBG("Error unmapping");
+		return -EBADR;
+	}
+
+	g_free(path);
+	return 0;
 }
 
 int messages_update_inbox(void *session, messages_status_cb callback,