rebase#94
Conversation
…orms (#88) * Update rrdDynamic.c * Update rrdDynamic.c * Update rrdEventProcess.c * Update rrdInterface.c
|
Saranya seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
RDKECMF-219 Remove redundant variable
…102) * Update rrdMain.c * Update rrdMain.c * Update rrdMain.c * Update rrdMain.c * Update rrdMain.c * Update rrdMain.c * Update rrdMain.c * Update rrdMain.c * Update rrdMain.c * Update rrdMain.c * Update rrdMain.c * Update rrdMain.c * Update rrdMain.c * Update rrdMain.c * Update rrdMain.c * Update rrdCommandSanity.c * Update rrdJsonParser.c * Update rrdMain.c * Update rrdMain.c * Update rrdMain.c * Update rrdEventProcess.c * Update rrdInterface.c * Update rrdEventProcess.c
* RDK-55702: Update the MW clients to use Power Manager Plugin Reason for change: Update the MW clients to use Power Manager Plugin with retry Test Procedure: Refer RDK-55702 Risks: Low Signed-off-by:gsanto722 grandhi_santoshkumar@comcast.com * RDK-55702: Update the MW clients to use Power Manager Plugin Reason for change: Update the MW clients to use Power Manager Plugin Test Procedure: Refer RDK-55702 Risks: Low Signed-off-by:gsanto722 grandhi_santoshkumar@comcast.com * RDK-55702: Update the MW clients to use Power Manager Plugin Reason for change: Update the MW clients to use Power Manager Plugin Test Procedure: Refer RDK-55702 Risks: Low Signed-off-by:gsanto722 grandhi_santoshkumar@comcast.com * RDK-55702: Update the MW clients to use Power Manager Plugin Reason for change: Update the MW clients to use Power Manager Plugin Test Procedure: Refer RDK-55702 Risks: Low Signed-off-by:gsanto722 grandhi_santoshkumar@comcast.com * RDK-55702: Update the MW clients to use Power Manager Plugin Reason for change: Update the MW clients to use Power Manager Plugin Test Procedure: Refer RDK-55702 Risks: Low Signed-off-by:gsanto722 grandhi_santoshkumar@comcast.com * RDK-55702: Update the MW clients to use Power Manager Plugin Reason for change: Update the MW clients to use Power Manager Plugin Test Procedure: Refer RDK-55702 Risks: Low Signed-off-by:gsanto722 grandhi_santoshkumar@comcast.com --------- Co-authored-by: nhanasi <navihansi@gmail.com>
Merge changes related to L1, L2 workflow and Iarmbus plugin changes
…ntral/remote_debugger into feature/RDK-56115-coverity
It should not be needed with registry being opensourced
RDKECMF-219 Enable component build workflow on Pull Request and remove unnecessary token
This pull request addresses Coverity defects in the RDK Remote Debugger Device Management code, focusing on fixing memory leaks, buffer overflows, and resource handling issues. Changes: Added NULL checks for memory allocations (malloc, strdup, fread) with proper error handling and resource cleanup Fixed buffer overflow vulnerabilities by using correct size parameters in strncpy/strncat operations Corrected file pointer closure to only occur when pointers are valid (v_secure_pclose moved inside if blocks) Fixed memory management issues with rfcbuf allocations and ownership Co-authored-by: mtirum011 <madhubabu_tirumala@comcast.com>
Remote Debugger 1.3.2 release
| issue =rbusValue_GetString(value, NULL); | ||
| char *dot_position = strchr(issue, '.'); // Find the first occurrence of '.' | ||
| if (dot_position != NULL) | ||
| { | ||
| *dot_position = '\0'; // Replace '.' with null terminator | ||
| } |
There was a problem hiding this comment.
issue is a const char* returned by rbusValue_GetString(), but the code modifies it in-place by replacing '.' with '\0'. This risks corrupting RBUS-managed memory and can crash/produce incorrect values. Copy the string into a writable buffer (e.g., strdup/snprintf into a local array), modify the copy, and keep the RBUS value immutable.
* RDKEMW-16897: Add Agentic Support for the RRD * Updated the instructions --------- Co-authored-by: Hanasi <nhanas001c@cable.comcast.com>
…ile Data (#183) * Update rrdInterface.h Update rrdInterface.h Update rrdInterface.c Update rrdInterface.h Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Add helper functions for profile data processing Added helper functions for profile data processing. Update rrdInterface.c Update rrdInterface.h Update Client_Mock.h Add mock implementations for RBusApiWrapper methods Remove mock profile handler functions for GTEST Removed mock implementations for profile handler functions when GTEST_ENABLE is defined. Update Client_Mock.cpp Update Client_Mock.h Update rrdInterface.h Update Makefile.am Update src/rrdInterface.c Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Create profileTestValid.json Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Create profileTestInvalid.json Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update rrdInterface.c Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> fix: add NULL guard to has_direct_commands to prevent crash on NULL input Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/c84bc9e8-e1d2-4412-81d4-54eb9c67be5f Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Create test.py Convert run_l2.sh to Python with RDK tests Refactor run_l2.sh to Python and implement RDK Remote Debugger tests. L2 Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update rrdInterface.c fix: correct set_rbus_response to use real rbus API signatures rbusValue_Init() returns rbusValue_t (not rbusError_t) and rbusValue_SetString() returns void in the real rbus library, so capturing their return values as rbusError_t caused a build error. - Remove incorrect return-value capture from rbusValue_Init and rbusValue_SetString; check rbusValue != NULL after init instead - Add NULL guard for prop parameter - Update RRDProfileHandlerTest SetUp() mock so rbusValue_Init actually sets *value to a non-null pointer, keeping SetRbusResponse_ValidInput test passing Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/e887c84a-2e12-4903-9d59-2bd6f90e2527 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Update rrdInterface.c Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> fix: resolve Coverity dead code and add NULL guard to get_all_categories_json - read_profile_json_file: split combined NULL check into two separate checks (file_size first, then filename) so *file_size is safely zeroed before the filename check; eliminates the ternary 'filename ? filename : "(null)"' and the Coverity dead-code report - get_all_categories_json: add early NULL guard for json parameter that returns an empty JSON object string to prevent crash when callers (including unit tests) pass NULL Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/c686520e-0adf-4e7e-9915-9b9e4e8a74fd Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update rrdUnitTestRunner.cpp Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update rrdInterface.c Update rrdInterface.c Update rrdUnitTestRunner.cpp Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update rrdUnitTestRunner.cpp Update src/rrdInterface.c Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update rrdInterface.c Clean up comments in save_profile_category function Removed comments explaining file opening flags. RDKEMW-16897: Add Agentic Support for the RRD (#182) * RDKEMW-16897: Add Agentic Support for the RRD * Updated the instructions --------- Co-authored-by: Hanasi <nhanas001c@cable.comcast.com> Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Rename test.py to test_rrd_profile_data.py rrd Update src/rrdInterface.c Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update src/rrdInterface.c Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update rrdUnitTestRunner.cpp * Update rrdInterface.c * Update rrdUnitTestRunner.cpp
| def reset_issuetype_rfc(): | ||
| command = 'rbuscli set Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.RDKRemoteDebugger.IssueType string ""' | ||
| result = subprocess.run(command, shell=True, capture_output=True, text=True) | ||
| assert result.returncode == 0 |
There was a problem hiding this comment.
subprocess is used but not imported in this test module, so the test will fail at runtime (NameError). Add import subprocess at the top (matching the other test files using subprocess).
| file_path = "/etc/rrd/remote_debugger.json" | ||
|
|
||
| # Read the existing JSON data | ||
| with open(file_path, "r") as json_file: | ||
| data = json.load(json_file) |
There was a problem hiding this comment.
This test module mutates /etc/rrd/remote_debugger.json at import time (during pytest collection), which is a high-risk side effect and can break other tests or the test environment. Move this logic into a test/fixture (e.g., setup step) and restore the original file in teardown, or write to an isolated temp path and point the component under test to that path.
| } | ||
|
|
||
| # Update the JSON data with the new entry | ||
| data.update(new_entry) |
There was a problem hiding this comment.
This test module mutates /etc/rrd/remote_debugger.json at import time (during pytest collection), which is a high-risk side effect and can break other tests or the test environment. Move this logic into a test/fixture (e.g., setup step) and restore the original file in teardown, or write to an isolated temp path and point the component under test to that path.
| with open(file_path, "w") as json_file: | ||
| json.dump(data, json_file, indent=4) |
There was a problem hiding this comment.
This test module mutates /etc/rrd/remote_debugger.json at import time (during pytest collection), which is a high-risk side effect and can break other tests or the test environment. Move this logic into a test/fixture (e.g., setup step) and restore the original file in teardown, or write to an isolated temp path and point the component under test to that path.
| #!/bin/bash | ||
|
|
||
| # Step 1: Create a JSON file | ||
| json_file="/media/apps/RDK-RRD-Test/etc/rrd/remote_debugger.json" | ||
| echo '{ |
There was a problem hiding this comment.
The script writes to /media/apps/RDK-RRD-Test/etc/rrd/remote_debugger.json without ensuring the parent directory exists. If /media/apps/RDK-RRD-Test/etc/rrd is missing, the redirect will fail and downstream tests will fail when looking for the dynamic JSON. Create the directory (mkdir -p) before the echo > $json_file. Also, if this script is ever executed directly (not via bash script.sh), the shebang should be the first line of the file (currently preceded by the license header).
|
|
||
| # Define the compiler flags | ||
| COMMON_CXXFLAGS = -frtti -fprofile-arcs -ftest-coverage | ||
| COMMON_CXXFLAGS = -frtti -fprofile-arcs -ftest-coverage -fpermissive |
There was a problem hiding this comment.
Adding -fpermissive can mask real compile-time errors by downgrading them to warnings, which reduces the signal of the unit-test build and can allow UB-prone code to slip in. Prefer fixing the underlying compile issues and keeping the test build strict (or scope -fpermissive to only the specific translation unit that strictly requires it as a last resort).
| COMMON_CXXFLAGS = -frtti -fprofile-arcs -ftest-coverage -fpermissive | |
| COMMON_CXXFLAGS = -frtti -fprofile-arcs -ftest-coverage |
| AC_ARG_ENABLE([L2support], | ||
| AS_HELP_STRING([--enable-L2support],[enable L2support (default is no)]), | ||
| [ | ||
| case "${enableval}" in | ||
| yes) L2_SUPPORT_ENABLE=true | ||
| L2_SUPPORT_FLAG="-DUSE_L2_SUPPORT" | ||
| m4_if(m4_sysval,[0],[SUBDIRS_L2_SUPPORT="src"]) ;; | ||
| no) L2_SUPPORT_ENABLE=false AC_MSG_ERROR([L2_SUPPORT is disabled]) ;; | ||
| *) AC_MSG_ERROR([bad value ${enableval} for --enable-L2support]) ;; | ||
| esac | ||
| ], | ||
| [echo "L2support is disabled"]) |
There was a problem hiding this comment.
Passing --enable-L2support=no currently hard-fails configure via AC_MSG_ERROR([L2_SUPPORT is disabled]). Typically no should simply disable the option and continue configuration. Consider removing the error for no and just setting the flag/conditionals accordingly.
| mkdir -p /media/apps/RDK-RRD-Test/etc/rrd | ||
|
|
||
| touch /media/apps/RDK-RRD-Test/etc/rrd/remote_debugger.json | ||
| echo "AA:BB:CC:DD:EE:FF" >> /tmp/.estb_mac |
There was a problem hiding this comment.
Appending (>>) the MAC to /tmp/.estb_mac can accumulate multiple lines across runs and produce ambiguous MAC reads. Use overwrite (>) or explicitly truncate the file before writing to keep the test environment deterministic.
| echo "AA:BB:CC:DD:EE:FF" >> /tmp/.estb_mac | |
| echo "AA:BB:CC:DD:EE:FF" > /tmp/.estb_mac |
| When the remotedebugger read the json file form the dynamic path | ||
| Then remotedebugger json read and parse should be success | ||
| And remotedebugger should read the Issuetype from dynamic profile | ||
|
|
||
| Scenario: Check for harmfull commands and abort | ||
| Given remote debugger parse the Dynamic json profile successfully | ||
| When the issue node and subnode are present in the profile | ||
| Then the remote debugger should read the Sanity Check list from profile | ||
| And the remotedebugger should perform sanity check on issue commands | ||
| Given the remote debugger profile has the harmfull commands | ||
| When the issue command and the sanity commands are matched | ||
| Then the remote debugger should exit the processing of commands | ||
| And Abort the commmand execution and skip report upload |
There was a problem hiding this comment.
Correct spelling in feature text to improve readability/searchability (e.g., “harmfull” → “harmful”, “commmand” → “command”).
| When the remotedebugger read the json file form the dynamic path | |
| Then remotedebugger json read and parse should be success | |
| And remotedebugger should read the Issuetype from dynamic profile | |
| Scenario: Check for harmfull commands and abort | |
| Given remote debugger parse the Dynamic json profile successfully | |
| When the issue node and subnode are present in the profile | |
| Then the remote debugger should read the Sanity Check list from profile | |
| And the remotedebugger should perform sanity check on issue commands | |
| Given the remote debugger profile has the harmfull commands | |
| When the issue command and the sanity commands are matched | |
| Then the remote debugger should exit the processing of commands | |
| And Abort the commmand execution and skip report upload | |
| When the remotedebugger read the json file from the dynamic path | |
| Then remotedebugger json read and parse should be success | |
| And remotedebugger should read the Issuetype from dynamic profile | |
| Scenario: Check for harmful commands and abort | |
| Given remote debugger parse the Dynamic json profile successfully | |
| When the issue node and subnode are present in the profile | |
| Then the remote debugger should read the Sanity Check list from profile | |
| And the remotedebugger should perform sanity check on issue commands | |
| Given the remote debugger profile has the harmful commands | |
| When the issue command and the sanity commands are matched | |
| Then the remote debugger should exit the processing of commands | |
| And Abort the command execution and skip report upload |
| Scenario: Check for harmfull commands and abort | ||
| Given remote debugger parse the Dynamic json profile successfully | ||
| When the issue node and subnode are present in the profile | ||
| Then the remote debugger should read the Sanity Check list from profile | ||
| And the remotedebugger should perform sanity check on issue commands | ||
| Given the remote debugger profile has the harmfull commands | ||
| When the issue command and the sanity commands are matched | ||
| Then the remote debugger should exit the processing of commands | ||
| And Abort the commmand execution and skip report upload |
There was a problem hiding this comment.
Correct spelling in feature text to improve readability/searchability (e.g., “harmfull” → “harmful”, “commmand” → “command”).
| Scenario: Check for harmfull commands and abort | |
| Given remote debugger parse the Dynamic json profile successfully | |
| When the issue node and subnode are present in the profile | |
| Then the remote debugger should read the Sanity Check list from profile | |
| And the remotedebugger should perform sanity check on issue commands | |
| Given the remote debugger profile has the harmfull commands | |
| When the issue command and the sanity commands are matched | |
| Then the remote debugger should exit the processing of commands | |
| And Abort the commmand execution and skip report upload | |
| Scenario: Check for harmful commands and abort | |
| Given remote debugger parse the Dynamic json profile successfully | |
| When the issue node and subnode are present in the profile | |
| Then the remote debugger should read the Sanity Check list from profile | |
| And the remotedebugger should perform sanity check on issue commands | |
| Given the remote debugger profile has the harmful commands | |
| When the issue command and the sanity commands are matched | |
| Then the remote debugger should exit the processing of commands | |
| And Abort the command execution and skip report upload |
RRD release for static profile DML
Update rrdEventProcess.c Update rrdExecuteScript.c Refactor rrdEventProcess.h to rrdExecuteScript.h Update rrdExecuteScript.h Update rrdExecuteScript.h Update rrdEventProcess.h Update rrdExecuteScript.h Update rrdJsonParser.c Update rrdJsonParser.h Update rrdInterface.c Update rrdCommon.h Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Fix indentation for appendMode assignment Update rrdCommon.h Fix appendMode assignment in rrdEventProcess.c Update rrdEventProcess.c Update rrdJsonParser.c Update rrdEventProcess.c Update rrdExecuteScript.h Update rrdExecuteScript.c Update rrdExecuteScript.c Update rrdExecuteScript.c Remove redundant logging from rrdJsonParser Update rrdJsonParser.c Update rrdEventProcess.c Update rrdJsonParser.c Update rrdEventProcess.c Update rrdJsonParser.c Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update rrdEventProcess.c Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update rrdJsonParser.c Fix heap overflow in issueTypeSplitter and memory leaks in suffix handling Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/fbc52780-966b-4912-825f-3030aa43c3e9 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Update rrdUnitTestRunner.cpp Delete .gitignore Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdUnitTestRunner.cpp Update rrdEventProcess.c Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Add gtest test cases for split_issue_type Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/9996d741-248e-4e58-8689-b4ba873cfaf2 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Remove build artifacts, add .gitignore Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/9996d741-248e-4e58-8689-b4ba873cfaf2 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Add explicit truncated content assertion in SuffixTruncatedWhenTooSmall test Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/9996d741-248e-4e58-8689-b4ba873cfaf2 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Update rrdJsonParser.c Update rrdJsonParser.c Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Update rrdUnitTestRunner.cpp Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Delete .gitignore Delete src/unittest/UTJson/device.properties Update rrdEventProcess.c Add gtest tests for split_issue_type, suffix field, and processIssueTypeEvent Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/76cad72a-f67f-4c05-8fb5-bfadf0c173b3 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Delete .gitignore Validate suffix prefix: only _Search- and _LogSearch- are allowed Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/125526c2-7b70-48f5-8bec-fd725eea8a04 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Base never contains underscore: split at first _ and discard invalid suffix Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/904bf10d-546b-4038-a60c-9bc76094a225 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Update rrdEventProcess.c Update rrdUnitTestRunner.cpp Update rrdEventProcess.c Update rrdEventProcess.c Fix segfault in GTEST_ENABLE mode when rbuf->jsonPath is NULL Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/efdc0d6b-89e6-4423-b202-a900f5683839 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Remove accidentally committed dummy directory and update .gitignore Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/efdc0d6b-89e6-4423-b202-a900f5683839 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Fix IssueTypeSplitterTest to match new issueTypeSplitter behavior (no built-in special-char removal) Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/00abcaba-8a41-4b88-ae12-07b5ff780ff9 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Fix empty/whitespace IssueType bypassing processIssueTypeEvent guards Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/4de31e24-70d8-496c-ac6a-a5376771d936 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> fix: preserve hyphens in archive filename so portal can parse it correctly rrd_logproc_convert_issue_type() was converting '-' to '_', turning the suffix '_Search-67768-67' into '_SEARCH_67768_67'. This added extra '_' separators into the archive filename that broke the analytics portal's filename parser — it could no longer identify the timestamp field, so download requests used an incorrect S3 key. Fix: keep '-' as '-' in the sanitized output. The archive filename now uses '_' to separate structural fields (MAC, issueType, timestamp) and '-' within the UUID suffix, giving the portal a reliable delimiter. Also increase issue_type_sanitized buffer in uploadRRDLogs.c from 64 to 256 bytes so a full UUID suffix never causes a silent truncation failure. Before: 04B86A12F9F8_DEVICE_DEVICEIP_SEARCH_67768_67_<timestamp>_RRD_DEBUG_LOGS.tgz After: 04B86A12F9F8_DEVICE_DEVICEIP_SEARCH-67768-67_<timestamp>_RRD_DEBUG_LOGS.tgz All 331 tests pass. Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/981b6bc1-c9d2-4150-9e9d-851004942ffc Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> fix: replace _Search-/_LogSearch- prefix check with suffix length <= 9 rule split_issue_type() now discards any suffix whose total length (including the leading '_') exceeds 9 characters. The old _Search-/_LogSearch- prefix validation is removed entirely. Rule: strlen(underscore) <= 9 → suffix accepted strlen(underscore) > 9 → suffix discarded This means: - Short session tokens (e.g. "_ab12345", 8 chars) are carried through - Long UUID-based suffixes like "_Search-b6877385-...) are discarded, preventing extra '_' delimiters from breaking the portal filename parser Affected tests updated: - UnderscoreSplitsBaseAndSuffix : uses a short accepted suffix - MultipleUnderscoresSplitsAtFirst: "_def_ghi" (8 chars) now kept - BaseTruncatedWhenTooSmall / ExactFitBase: "_suffix" (7 chars) now kept - SuffixTruncatedWhenTooSmall: uses 9-char suffix with 5-byte buffer - OnlyUnderscoreInput: "_" (1 char) now kept - LogSearchSuffixIsValid → NineCharSuffixIsAccepted (boundary test) - SearchSuffixIsValid → LongSuffixIsDiscarded - InvalidSuffixPrefixDiscarded / SearchWithoutHyphenIsInvalid / LogSearchWithoutHyphenIsInvalid: updated comments (same outcomes) - ProcessIssueTypeEvntTest comments updated to reflect new rule All 331 tests pass. Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/c6d6fc29-da2a-46af-a417-c2de67a18448 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> refactor: improve RRD_MAX_SUFFIX_LEN comment and rename length-based tests - Expand the RRD_MAX_SUFFIX_LEN comment to explain why 9 chars is the limit - Rename misleading test names that referenced old prefix-based validation: InvalidSuffixPrefixDiscarded → SuffixExceedingMaxLengthDiscarded SearchWithoutHyphenIsInvalid → SuffixSeventeenCharsDiscarded LogSearchWithoutHyphenIsInvalid → SuffixTwentyCharsDiscarded - LongSuffixIsDiscarded: switch to a neutral _1234567890 example so the test does not imply any Search-specific behavior All 331 tests pass. Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/c6d6fc29-da2a-46af-a417-c2de67a18448 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Update rrdJsonParser.c Update uploadRRDLogs.c Update uploadRRDLogs.c Update rrdJsonParser.c Delete .gitignore Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Update rrdEventProcess.c Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Update rrdJsonParser.c Update rrdEventProcess.c sanitize split_issue_type suffix to [A-Za-z0-9_-] to prevent injection Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/72e164ed-ae53-4076-8fb1-5ff1e21375e9 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Update rrdEventProcess.c Delete .gitignore Update rrdRunCmdThread.c Update rrdRunCmdThread.h Delete src/unittest/UTJson/device.properties Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Update rrdRunCmdThread.c Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
RDK-60236 : Remote Debugger Supports UUID Information in Debug Report File
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 93 out of 94 changed files in this pull request and generated 12 comments.
Comments suppressed due to low confidence (2)
src/rrdCommandSanity.c:154
checkcmdis allocated bycJSON_Printbut is never freed in the loop. Also, doingcheckcmd++loses the original pointer, making correct deallocation impossible and leaking memory every iteration (and risking invalid free if reintroduced later). Keep the original pointer (e.g.,char* raw = checkcmd) and alwayscJSON_free(raw)after use, or copy/strip quotes into a separate stack buffer without pointer arithmetic.
test/functional-tests/features/test_rrd_dynamic_profile_harmful_report.feature:55- Spelling: "commmand" should be "command".
| RDK_LOG(RDK_LOG_INFO,LOG_REMDEBUG,"[%s:%d]: Executing following commands using systemd-run:\n \"%s\"\n",__FUNCTION__,__LINE__,cmdData->command); | ||
|
|
||
| strncpy(remoteDebuggerServiceStr, remoteDebuggerPrefix, strlen(remoteDebuggerPrefix) + 1); | ||
| strncat(remoteDebuggerServiceStr, cmdData->rfcvalue, strlen(cmdData->rfcvalue)); | ||
|
|
||
| time_t epochTime = time(NULL); | ||
| snprintf(remoteDebuggerServiceStr, sizeof(remoteDebuggerServiceStr),"%s%s%ld", remoteDebuggerPrefix, cmdData->rfcvalue, (long)epochTime); | ||
| removeQuotes(cmdData->command); | ||
|
|
||
| FILE *systemdfp = v_secure_popen("r", "systemd-run -r --unit=%s --service-type=oneshot /bin/sh -c %s", remoteDebuggerServiceStr, cmdData->command); | ||
| FILE *systemdfp = v_secure_popen("r", "systemd-run -r --unit=%s --service-type=oneshot -p RemainAfterExit=yes /bin/sh -c %s", remoteDebuggerServiceStr, cmdData->command); | ||
| if(systemdfp == NULL) | ||
| { | ||
| RDK_LOG(RDK_LOG_ERROR,LOG_REMDEBUG,"[%s:%d]: Starting remote_debugger_%s service failed!!!\n",__FUNCTION__,__LINE__,cmdData->rfcvalue); | ||
| RDK_LOG(RDK_LOG_ERROR,LOG_REMDEBUG,"[%s:%d]: Starting %s service failed!!!\n",__FUNCTION__,__LINE__,remoteDebuggerServiceStr); | ||
| } | ||
| else | ||
| { | ||
| RDK_LOG(RDK_LOG_INFO,LOG_REMDEBUG,"[%s:%d]: Starting remote_debugger_%s service success...\n",__FUNCTION__,__LINE__,cmdData->rfcvalue); | ||
| RDK_LOG(RDK_LOG_INFO,LOG_REMDEBUG,"[%s:%d]: Starting %s service success...\n",__FUNCTION__,__LINE__,remoteDebuggerServiceStr); |
| /*Stop or Reset runtime service for issue*/ | ||
| RDK_LOG(RDK_LOG_INFO,LOG_REMDEBUG,"[%s:%d]: Stopping remote_debugger_%s service...\n",__FUNCTION__,__LINE__,cmdData->rfcvalue); | ||
| RDK_LOG(RDK_LOG_INFO,LOG_REMDEBUG,"[%s:%d]: Stopping %s service...\n",__FUNCTION__,__LINE__,remoteDebuggerServiceStr); | ||
| #if !defined(GTEST_ENABLE) | ||
| v_secure_system("systemctl stop %s", remoteDebuggerServiceStr); | ||
| v_secure_system("systemctl reset-failed %s", remoteDebuggerServiceStr); | ||
| free(cmdData->rfcvalue); // free rfcvalue received from RRDEventThreadFunc | ||
| free(cmdData->command); // free updated command info received from RRDEventThreadFunc | ||
| free(cmdData); | ||
| #endif |
| size_t j = 0; | ||
| for (size_t i = 0; input[i] && j < size-1; ++i) { | ||
| char c = input[i]; | ||
| if (isalnum((unsigned char)c)) output[j++] = toupper((unsigned char)c); | ||
| else if (c == '_' || c == '.') output[j++] = '_'; | ||
| else if (c == '-') output[j++] = '-'; // preserve hyphens so suffix UUID tokens remain distinct | ||
| // skip other chars | ||
| } |
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "%s: Removing source directory: %s\n", __FUNCTION__, dir_path); | ||
|
|
||
| char cmd[1024]; | ||
| snprintf(cmd, sizeof(cmd), "rm -rf %s", dir_path); | ||
|
|
||
| int ret = system(cmd); | ||
| if (ret == 0) { |
| print("Test Case 1: Setting profile data to 'all'") | ||
| stdout, stderr, rc = run_rbuscli_cmd(f'rbuscli set "all" {set_param}') | ||
| print(f"Set command result: stdout='{stdout}', stderr='{stderr}', rc={rc}") | ||
| assert rc == 0, f"rbuscli set 'all' failed: {stderr}" |
| # Define the libraries to link against | ||
| COMMON_LDADD = -lgtest -lgtest_main -lgmock_main -lgmock -lcjson -lmsgpackc -lgcov | ||
| COMMON_LDADD = -lgtest -lgtest_main -lgmock_main -lgmock -lcjson -lmsgpackc -lgcov -lz | ||
|
|
||
| # Define the compiler flags | ||
| COMMON_CXXFLAGS = -frtti -fprofile-arcs -ftest-coverage | ||
| COMMON_CXXFLAGS = -frtti -fprofile-arcs -ftest-coverage -fpermissive | ||
|
|
| mkdir -p /media/apps/RDK-RRD-Test/etc/rrd | ||
|
|
||
| touch /media/apps/RDK-RRD-Test/etc/rrd/remote_debugger.json | ||
| echo "AA:BB:CC:DD:EE:FF" >> /tmp/.estb_mac | ||
|
|
| testrun1_string = "Test.TestRun1" | ||
| SERVICE_START = f"Starting remote_debugger_{testrun1_string} service success" | ||
| assert SERVICE_START in grep_rrdlogs(SERVICE_START) | ||
|
|
||
| JOURNAL_START = f"journalctl remote_debugger_{testrun1_string} service success" | ||
| assert JOURNAL_START in grep_rrdlogs(JOURNAL_START) | ||
|
|
||
| SLEEP_TIME = "Sleeping with timeout" | ||
| assert SLEEP_TIME in grep_rrdlogs(SLEEP_TIME) | ||
| sleep(20) | ||
|
|
||
| SERVICE_STOP = f"Stopping remote_debugger_{testrun1_string} service" | ||
| assert SERVICE_STOP in grep_rrdlogs(SERVICE_STOP) |
| def test_remotedebugger_upload_report(): | ||
| UPLOAD_SUCCESS = "RRD Upload Script Execution Success" | ||
| UPLOAD_FAILURE = "RRD Upload Script Execution Failure" | ||
| if UPLOAD_SUCCESS in grep_rrdlogs(UPLOAD_SUCCESS): | ||
| print("Upload success") | ||
| elif UPLOAD_FAILURE in grep_rrdlogs(UPLOAD_FAILURE): | ||
| print("Upload failed") | ||
| else: | ||
| print("Upload status not found in logs") | ||
|
|
||
| SCRIPT_SUCCESS = "Debug Information Report upload Failed" | ||
| SCRIPT_FAILURE = "Debug Information Report upload Success" | ||
| if SCRIPT_SUCCESS in grep_rrdlogs(SCRIPT_SUCCESS): | ||
| print("Script execution success") | ||
| elif SCRIPT_FAILURE in grep_rrdlogs(SCRIPT_FAILURE): | ||
| print("Script execution failed") |
| Scenario: Check for harmfull commands and abort | ||
| Given remote debugger parse the Dynamic json profile successfully | ||
| When the issue node and subnode are present in the profile | ||
| Then the remote debugger should read the Sanity Check list from profile | ||
| And the remotedebugger should perform sanity check on issue commands | ||
| Given the remote debugger profile has the harmfull commands | ||
| When the issue command and the sanity commands are matched |
RRD release 1.3.4 for UUID fix
Create test_rrd_static_profile_report_with_suffix_negative_case.py Potential fix for pull request finding RRD 1.3.4 release changelog updates Fix dynamic subcategory service log assertions for timestamped names Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/f0806557-f409-45cc-8993-700be01b59f2 Remove accidental pycache artifact from test changes Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/f0806557-f409-45cc-8993-700be01b59f2 Update test_rrd_background_cmd_static_profile_report.py Update test_rrd_c_api_upload.py Update test_rrd_debug_report_upload.py Update test_rrd_deepsleep_static_report.py Update test_rrd_dynamic_profile_report.py Update test_rrd_static_profile_category_report.py Update test_rrd_static_profile_report.py Update test_rrd_static_profile_report_with_suffix.py Update test_rrd_static_profile_report_with_suffix_negative_case.py Update test_rrd_background_cmd_static_profile_report.py Update test_rrd_dynamic_profile_missing_report.py Strengthen service-start assertions for timestamped runtime names Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/ec85a8af-7e00-4410-8ca2-4e20cd06cfd4 Add helper docstring for service-start success assertion Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/ec85a8af-7e00-4410-8ca2-4e20cd06cfd4 Improve helper docstring with Args and Raises Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/ec85a8af-7e00-4410-8ca2-4e20cd06cfd4 Refine service-start helper naming and assertion messages Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/ec85a8af-7e00-4410-8ca2-4e20cd06cfd4 Update test_rrd_background_cmd_static_profile_report.py Update test_rrd_dynamic_profile_missing_report.py Add feature files for static suffix report scenarios Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/59dfaf33-25ef-48a2-9549-dd1f571a3b55 L2 Potential fix for pull request finding Update test_rrd_static_profile_report_with_suffix.py Update test_rrd_static_profile_report_with_suffix_negative_case.py Update test_rrd_static_profile_report_with_suffix_negative_case.py Fix service check in negative test case Update test_rrd_static_profile_report_with_suffix_negative_case.py Update test_rrd_dynamic_profile_missing_report.py Update test_rrd_dynamic_profile_missing_report.py Update test_rrd_dynamic_profile_missing_report.py Update test_rrd_dynamic_profile_missing_report.py Update test_rrd_dynamic_profile_missing_report.py Stabilize remotedebugger startup in missing-profile test Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/eafe5a9f-2bbc-448a-966f-61c3067b7239 Remove accidental pycache artifact from PR Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/eafe5a9f-2bbc-448a-966f-61c3067b7239 Replace startup retry magic numbers with constants Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/eafe5a9f-2bbc-448a-966f-61c3067b7239 Remove accidental pycache artifact again Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/eafe5a9f-2bbc-448a-966f-61c3067b7239 Refine remotedebugger PID retry logic in missing-profile test Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/eafe5a9f-2bbc-448a-966f-61c3067b7239 Simplify startup PID retry loop for missing-profile test Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/eafe5a9f-2bbc-448a-966f-61c3067b7239
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 97 out of 98 changed files in this pull request and generated 12 comments.
Comments suppressed due to low confidence (1)
src/rrdDynamic.c:227
strncpy(msgDataString, paramString, msgDataStringSize - strlen(RDM_PKG_SUFFIX))may leavemsgDataStringwithout a NUL terminator (when the copy length equals/exceeds the destination buffer), but the string is later used withstrdup/logging. Ensure the destination is always NUL-terminated (e.g.,snprintf,strlcpy, or explicitly settingmsgDataString[copy_len] = '\0').
| checkcmd = cJSON_Print(subcmd); // Print each command from the sanity command array in Json | ||
| int len = strlen(checkcmd); | ||
| if (len >= 2 && checkcmd[0] == '"' && checkcmd[len - 1] == '"') | ||
| { | ||
| checkcmd[len - 1] = '\0'; // Remove closing quote | ||
| checkcmd++; // Move pointer forward to skip opening quote | ||
| len -= 2; // Adjust length after removing quotes | ||
| } | ||
| // Trim trailing spaces | ||
| int j = len - 1; | ||
| while (j >= 0 && isspace(checkcmd[j])) { | ||
| checkcmd[j] = '\0'; | ||
| j--; | ||
| } | ||
| RDK_LOG(RDK_LOG_DEBUG,LOG_REMDEBUG,"[%s:%d]: Checking for \"%s\" string in Issue commands... \n",__FUNCTION__,__LINE__,checkcmd); | ||
| sanitystr = strstr(issuecmd,checkcmd); | ||
| cJSON_free(checkcmd); // free each command from the sanity command array | ||
| if (sanitystr) |
| RDK_LOG(RDK_LOG_INFO,LOG_REMDEBUG,"[%s:%d]: Stopping %s service...\n",__FUNCTION__,__LINE__,remoteDebuggerServiceStr); | ||
| #if !defined(GTEST_ENABLE) | ||
| v_secure_system("systemctl stop %s", remoteDebuggerServiceStr); | ||
| v_secure_system("systemctl reset-failed %s", remoteDebuggerServiceStr); | ||
| free(cmdData->rfcvalue); // free rfcvalue received from RRDEventThreadFunc | ||
| free(cmdData->command); // free updated command info received from RRDEventThreadFunc | ||
| free(cmdData); | ||
| #endif |
| int rrd_upload_execute(const char *log_server, const char *protocol, const char *http_link, const char *working_dir, const char *archive_filename, const char *source_dir) { | ||
| // Validate required parameters | ||
| if (!log_server || strlen(log_server) == 0) { | ||
| RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "%s: Invalid or empty log_server\n", __FUNCTION__); | ||
| return -1; | ||
| } |
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "%s: Removing source directory: %s\n", __FUNCTION__, dir_path); | ||
|
|
||
| char cmd[1024]; | ||
| snprintf(cmd, sizeof(cmd), "rm -rf %s", dir_path); | ||
|
|
||
| int ret = system(cmd); | ||
| if (ret == 0) { |
| def run_rbuscli_cmd(cmd): | ||
| """Execute rbuscli command and return result.""" | ||
| result = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=30) | ||
| return result.stdout.strip(), result.stderr.strip(), result.returncode | ||
|
|
||
| # Test Case 1: Set profile data to "all" and get all categories | ||
| print("Test Case 1: Setting profile data to 'all'") | ||
| stdout, stderr, rc = run_rbuscli_cmd(f'rbuscli set "all" {set_param}') | ||
| print(f"Set command result: stdout='{stdout}', stderr='{stderr}', rc={rc}") | ||
| assert rc == 0, f"rbuscli set 'all' failed: {stderr}" |
| SCRIPT_SUCCESS = "Debug Information Report upload Failed" | ||
| SCRIPT_FAILURE = "Debug Information Report upload Success" | ||
| if SCRIPT_SUCCESS in grep_rrdlogs(SCRIPT_SUCCESS): | ||
| print("Script execution success") | ||
| elif SCRIPT_FAILURE in grep_rrdlogs(SCRIPT_FAILURE): | ||
| print("Script execution failed") |
| SCRIPT_SUCCESS = "Debug Information Report upload Failed" | ||
| SCRIPT_FAILURE = "Debug Information Report upload Success" | ||
| if SCRIPT_SUCCESS in grep_rrdlogs(SCRIPT_SUCCESS): | ||
| print("Script execution success") | ||
| elif SCRIPT_FAILURE in grep_rrdlogs(SCRIPT_FAILURE): | ||
| print("Script execution failed") |
| SCRIPT_SUCCESS = "Debug Information Report upload Failed" | ||
| SCRIPT_FAILURE = "Debug Information Report upload Success" | ||
| if SCRIPT_SUCCESS in grep_rrdlogs(SCRIPT_SUCCESS): | ||
| print("Script execution success") | ||
| elif SCRIPT_FAILURE in grep_rrdlogs(SCRIPT_FAILURE): | ||
| print("Script execution failed") |
| "DeepSleep": { | ||
| "Audio" : { | ||
| "AudioStatus" : { | ||
| "Commands": "cat /sys/class/avsync_session0/session_stat;cat /sys/class/vdec/vdec_status;hal_dump", | ||
| "Timeout" : 10 | ||
| } | ||
| }, | ||
| "Video" : { |
| pthread_create(&RRDTR69ThreadID, NULL, RRDEventThreadFunc, NULL); | ||
| // Give the thread a moment to start (optional but helpful) | ||
| sleep(1); | ||
| PowerController_PowerState_t state1 = POWER_STATE_STANDBY_DEEP_SLEEP; | ||
| PowerController_PowerState_t state2 = POWER_STATE_STANDBY_DEEP_SLEEP; | ||
| void* userdata = NULL; | ||
| _pwrManagerEventHandler(state1, state2, userdata); | ||
| state2 = POWER_STATE_ON; | ||
| _pwrManagerEventHandler(state1, state2, userdata); | ||
| sleep(2); | ||
| _rdmManagerEventHandler(owner, eventId, &eventData, len); | ||
| // Now wait for the thread to finish (if it ever does) | ||
| pthread_join(RRDTR69ThreadID, NULL); | ||
| RDK_LOG(RDK_LOG_DEBUG,LOG_REMDEBUG,"[%s:%d]:Stopping RDK Remote Debugger Daemon \n",__FUNCTION__,__LINE__); |
… File (#199) * Create rrd_uuid_support_implementation.HLD * Rename rrd_uuid_support_implementation.HLD to rrd_uuid_support_implementation_HLD.md * Update rrd_uuid_support_implementation_HLD.md * Move docs from .github directory --------- Co-authored-by: Abhinav P V <Abhinav_Valappil@comcast.com> Co-authored-by: nhanasi <navihansi@gmail.com>
| RDK_LOG(RDK_LOG_INFO,LOG_REMDEBUG,"[%s:%d]: Stopping %s service...\n",__FUNCTION__,__LINE__,remoteDebuggerServiceStr); | ||
| #if !defined(GTEST_ENABLE) | ||
| v_secure_system("systemctl stop %s", remoteDebuggerServiceStr); | ||
| v_secure_system("systemctl reset-failed %s", remoteDebuggerServiceStr); | ||
| free(cmdData->rfcvalue); // free rfcvalue received from RRDEventThreadFunc | ||
| free(cmdData->command); // free updated command info received from RRDEventThreadFunc | ||
| free(cmdData); | ||
| #endif |
| @@ -31,10 +27,10 @@ static void normalizeIssueName(char *str); | |||
|
|
|||
| /* | |||
| * @function uploadDebugoutput | |||
| * @brief Executes a script to perform tar and upload operations for the collected issue logs. | |||
| * @brief Calls the upload API to perform tar and upload operations for the collected issue logs. | |||
| * @param char *outdir - Output directory string. | |||
| * @param char *issuename - Issue type from RFC. | |||
| * @return int - Returns 0 for success and 1 for failure. | |||
| * @return int - Returns 0 for success and non-zero for failure. | |||
| */ | |||
| int uploadDebugoutput(char *outdir, char *issuename) | |||
| { | |||
| @@ -43,11 +39,25 @@ int uploadDebugoutput(char *outdir, char *issuename) | |||
| if(outdir != NULL && issuename != NULL) | |||
| { | |||
| normalizeIssueName(issuename); | |||
| RDK_LOG(RDK_LOG_INFO,LOG_REMDEBUG,"[%s:%d]: Starting Upload Debug output Script: %s... \n",__FUNCTION__,__LINE__,RRD_SCRIPT); | |||
| if(v_secure_system("%s %s %s",RRD_SCRIPT,outdir,issuename) != 0) | |||
| #ifdef IARMBUS_SUPPORT | |||
| RDK_LOG(RDK_LOG_INFO,LOG_REMDEBUG,"[%s:%d]: Starting Upload Debug output via API... \n",__FUNCTION__,__LINE__); | |||
|
|
|||
| ret = rrd_upload_orchestrate(outdir, issuename); | |||
| if(ret != 0) | |||
| { | |||
| ret = 1; | |||
| RDK_LOG(RDK_LOG_ERROR,LOG_REMDEBUG,"[%s:%d]: Upload orchestration failed with code: %d\n",__FUNCTION__,__LINE__, ret); | |||
| } | |||
| else | |||
| { | |||
| RDK_LOG(RDK_LOG_INFO,LOG_REMDEBUG,"[%s:%d]: Upload orchestration completed successfully\n",__FUNCTION__,__LINE__); | |||
| } | |||
| #else | |||
| RDK_LOG(RDK_LOG_INFO,LOG_REMDEBUG,"[%s:%d]: Starting Upload Debug output Script: %s... \n",__FUNCTION__,__LINE__,RRD_SCRIPT); | |||
| if(v_secure_system("%s %s %s",RRD_SCRIPT,outdir,issuename) != 0) | |||
| { | |||
| ret = 1; | |||
| int rrd_upload_cleanup_source_dir(const char *dir_path) { | ||
| if (!dir_path) return -1; | ||
|
|
||
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "%s: Removing source directory: %s\n", __FUNCTION__, dir_path); | ||
|
|
||
| char cmd[1024]; | ||
| snprintf(cmd, sizeof(cmd), "rm -rf %s", dir_path); | ||
|
|
||
| int ret = system(cmd); | ||
| if (ret == 0) { | ||
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "%s: Successfully removed source directory: %s\n", | ||
| __FUNCTION__, dir_path); | ||
| return 0; | ||
| } else { | ||
| RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "%s: Failed to remove source directory: %s (ret: %d)\n", | ||
| __FUNCTION__, dir_path, ret); | ||
| return -1; |
| SCRIPT_SUCCESS = "Debug Information Report upload Failed" | ||
| SCRIPT_FAILURE = "Debug Information Report upload Success" | ||
| if SCRIPT_SUCCESS in grep_rrdlogs(SCRIPT_SUCCESS): | ||
| print("Script execution success") | ||
| elif SCRIPT_FAILURE in grep_rrdlogs(SCRIPT_FAILURE): | ||
| print("Script execution failed") | ||
| else: |
No description provided.