Skip to content

Rebase#140

Open
Abhinavpv28 wants to merge 51 commits into
feature/tr69_testfrom
develop
Open

Rebase#140
Abhinavpv28 wants to merge 51 commits into
feature/tr69_testfrom
develop

Conversation

@Abhinavpv28
Copy link
Copy Markdown
Contributor

No description provided.

Abhinavpv28 and others added 14 commits May 5, 2025 15:49
…ic Updates (#117)

* Update rrdInterface.c

* Update rrdInterface.c

* Update rrdInterface.c

* Update cov_build.sh

* Update configure.ac

* Update rrdInterface.c

* Update rrdInterface.h

* Update cov_build.sh

* Update rrdInterface.c

* Update rrdInterface.h

* Update rrdInterface.c

---------

Co-authored-by: nhanasi <navihansi@gmail.com>
…method (#123)

* Update rrdIarmEvents.c

* Update rrdIarmEvents.c

* Update rrdIarmEvents.c

* Update rrdIarmEvents.c

* Update rrdIarmEvents.c

* Update rrdCommon.h

* Update rrdIarmEvents.c

* Update rrdInterface.h

* Update rrdCommon.h

* Update rrdRunCmdThread.c

* Update rrdRunCmdThread.c

* Update rrdRunCmdThread.c

* Update rrdDynamic.c

* Update rrdJsonParser.c

* Update rrdCommon.h

* Update rrdIarmEvents.c

* Update rrdInterface.h

* Update rrdInterface.h

* Update rrdIarmEvents.c

* Update rrdIarmEvents.c

* Update rrdIarmEvents.c

* Update rrdRunCmdThread.c

* Update rrdRunCmdThread.c

* Update rrdRunCmdThread.c

* Update rrdIarmEvents.c

* Update rrdIarmEvents.c

* Update rrdIarmEvents.c

* Update rrdJsonParser.c

* Update rrdEventProcess.c

* Update rrdJsonParser.c

* Update rrdJsonParser.c

* Update rrdJsonParser.c

* Update rrdEventProcess.c

* Update rrdCommon.h

* Update rrdIarmEvents.c

* Update rrdIarmEvents.c

* Update rrdIarmEvents.c
…method (#125)

* Update rrdIarmEvents.c

* Update rrdInterface.c

* Update rrdInterface.c

* Update cov_build.sh

* Update rrdIarmEvents.c

---------

Co-authored-by: nhanasi <navihansi@gmail.com>
…d message type (SCXI11BEI) (#121)

* Update rrdJsonParser.c

* Update rrdJsonParser.c

* Update rrdEventProcess.c

* Update rrdInterface.c

* Update rrdInterface.c

* Update rrdInterface.c

* Update rrdJsonParser.c

* Update rrdInterface.c

* Update rrdJsonParser.c

* Update rrdEventProcess.c

* Update rrdJsonParser.c

* Update rrdEventProcess.c

* Update rrdEventProcess.c

* Update rrdInterface.c

* Update rrdInterface.c

---------

Co-authored-by: nhanasi <navihansi@gmail.com>
Added release to fix remotedebugger bug fixes
… process exited with error code." (#134)

* Update rrdRunCmdThread.c

* Update rrdRunCmdThread.c

* Update rrdRunCmdThread.c

* Update rrdRunCmdThread.c

* Update rrdRunCmdThread.c
…rogress (#136)

* Update rrdInterface.c

* Update rrdInterface.c

* Update rrdInterface.c
Release 1.2.8 tag for RRD
@Abhinavpv28 Abhinavpv28 requested a review from a team as a code owner July 1, 2025 05:28
@Abhinavpv28 Abhinavpv28 requested a review from a team July 1, 2025 05:28
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jul 1, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
5 out of 6 committers have signed the CLA.

✅ AravindanNC
✅ nhanasi
✅ Abhinavpv28
✅ Alan-Ryan
✅ venkat0557
❌ naveenkumarhanasi
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-advanced-security
Copy link
Copy Markdown

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

Abhinavpv28 and others added 12 commits July 30, 2025 13:18
* Update Client_Mock.cpp

* Update Client_Mock.h

* Update rrdUnitTestRunner.cpp

* Update rrdUnitTestRunner.cpp

* Update rrdUnitTestRunner.cpp

* Update rrdInterface.c

* Update rrdInterface.h

* Update rrdRunCmdThread.c

* Update rrdIarmEvents.c

* Update rrdInterface.h

* Update rrdDynamic.c

* Update code-coverage.yml
Create deepsleep_main.c

Update Makefile

Create power_controller.h

Update run_l2.sh

Update cov_build.sh

Create pwrMgr.h

Update cov_build.sh

Update cov_build.sh

Update Makefile

Rename deepsleep_main.c to main.c

Update Makefile

update Makefile

Delete test/functional-tests/tests/rrdIarmEvents.c

Update run_l2.sh

Update remote_debugger.json

Update remote_debugger.json

Create test_deepsleep_static.py

Update run_l2.sh

Update run_l2.sh

Create test_deepsleep_dynamic.py

Update run_l2.sh

Update rrdInterface.c

Update create_json.sh

Create test_append.py

Create test_category.py

Update test_rrd_dynamic_profile_missing_report.py

Create test_rrd_dynamic_with_download_harmful.py

Create test_rrd_negative.py

Update configure.ac

Update cov_build.sh

Update run_l2.sh

Update main.c

Rename main.c to deepsleep_main.c

Update Makefile

Create rrd_append_report.feature

Create rrd_deepsleep_static.feature

Create rrd_deepsleep_dynamic.feature

Create rrd_dynamic_with_download_harmful_report.feature

Update rrd_dynamic_profile_missing_report.feature

Update test_rrd_dynamic_profile_missing_report.py

Update cov_build.sh

Update test_rrd_single_instance.py

Update test_category.py

Update run_l2.sh

Update test_rrd_dynamic_profile_missing_report.py

Update rrdInterface.c

Update rrdInterface.c

Update rrdInterface.c

Update rrdIarmEvents.c

Update rrdIarmEvents.c

Delete test/functional-tests/tests/test_deepsleep_dynamic.py

Delete test/functional-tests/tests/test_rrd_negative.py

Update run_l2.sh

Update test_category.py

Update cov_build.sh

Update configure.ac

Update configure.ac

Delete test/functional-tests/features/rrd_deepsleep_dynamic.feature

Update rrd_dynamic_profile_missing_report.feature

Update rrd_dynamic_profile_missing_report.feature

Delete test/functional-tests/tests/test_rrd_dynamic_with_download_harmful.py

Delete test/functional-tests/tests/deepsleep_main.c

Delete test/functional-tests/tests/Makefile

Update run_l2.sh

Update run_l2.sh

Delete test/functional-tests/features/rrd_dynamic_with_download_harmful_report.feature

Create rrd_dynamic_profile_subcategory_report.feature

Update run_l2.sh

Rename test_append.py to test_rrd_append_report.py

Rename test_category.py to test_rrd_dynamic_subcategory_report.py

Rename test_deepsleep_static.py to test_rrd_deepsleep_static_report.py

Rename rrd_deepsleep_static.feature to rrd_deepsleep_static_report.feature

Update rrd_dynamic_profile_missing_report.feature

Update rrd_dynamic_profile_missing_report.feature

Update rrd_dynamic_profile_missing_report.feature
RDK-56291 - [RDKE] Increase L2 Test Coverage For Remote Debugger : Target 80% [ Phase 2 ]
Deploy fossid_integration_stateless_diffscan_target_repo action
…rget 80% [ Phase 2 ] (#157)

* Update rrdInterface.c

* Update rrdIarmEvents.c

* Update configure.ac

* Update cov_build.sh

* Update remote_debugger.json

* Update create_json.sh

* Create Makefile

* Create deepsleep_main.c

---------

Co-authored-by: nhanasi <navihansi@gmail.com>
Copilot AI review requested due to automatic review settings March 20, 2026 19:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 63 out of 63 changed files in this pull request and generated 8 comments.

Comment thread src/rrdRunCmdThread.c
Comment on lines +421 to +426
#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
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cmdData cleanup (free(cmdData->rfcvalue), free(cmdData->command), free(cmdData)) is inside #if !defined(GTEST_ENABLE). When GTEST_ENABLE is set, this function returns true without freeing those heap allocations, leaking memory in unit tests. Keep the systemctl stop guarded, but free cmdData regardless of GTEST_ENABLE.

Copilot uses AI. Check for mistakes.
Comment thread src/rrd_upload.c
Comment on lines +191 to +196
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);
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rrd_upload_cleanup_source_dir builds a shell command (rm -rf %s) from dir_path and executes it via system(). Since dir_path can ultimately be derived from RFC/issue-type content, this is a command-injection risk and can also break on spaces/shell metacharacters. Please replace this with a non-shell recursive delete (e.g., nftw() / unlinkat() traversal) and validate that dir_path is within the expected /tmp/rrd/ subtree before deleting.

Copilot uses AI. Check for mistakes.
Comment thread src/rrd_upload.c
Comment on lines +111 to +113
// Try to acquire a non-blocking lock on the same file uploadstblogs uses
int fd = open("/tmp/.log-upload.lock", O_RDONLY | O_CREAT, 0644);
if (fd == -1) {
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lock handling here differs from the existing scripts/uploadRRDLogs.sh (which checks /tmp/.log-upload.pid) and also creates /tmp/.log-upload.lock unconditionally via O_CREAT. Creating the lock file may change behavior for components that rely on file non-existence. Consider aligning with the existing lock convention (or checking both .pid and .lock for backward compatibility) and avoid O_CREAT so a missing lock file is treated as unlocked without side effects.

Copilot uses AI. Check for mistakes.
Comment thread configure.ac
Comment on lines +65 to +76
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"])
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--enable-L2support currently sets L2_SUPPORT_FLAG/L2_SUPPORT_ENABLE but neither is used later (no AC_SUBST, no AM_CONDITIONAL, and src/Makefile.am doesn’t reference the flag). As-is, the option has no effect on the build. Please either wire L2_SUPPORT_FLAG into the relevant CFLAGS via AC_SUBST/Makefile.am (and/or add an AM_CONDITIONAL), or remove the option to avoid a misleading configure interface.

Suggested change
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"])
# Note: legacy --enable-L2support option removed because it had no effect on the build.

Copilot uses AI. Check for mistakes.
Comment on lines +5 to +26
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)

# New entry to add
new_entry = {
"Test": {
"TestRun4": {
"Commands": "cat /version.txt;cat /tmp/.deviceDetails.cache",
"Timeout": 10
}
}
}

# Update the JSON data with the new entry
data.update(new_entry)

# Write the updated data back to the JSON file
with open(file_path, "w") as json_file:
json.dump(data, json_file, indent=4)
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test mutates /etc/rrd/remote_debugger.json at import time (module top-level). That runs before pytest collection/fixtures, makes the test order-dependent, and can fail in environments where /etc is read-only. Please move this JSON update into a test/fixture (e.g., setup/teardown that backs up and restores the original file), or write to a temporary config path and point the component/test to that path.

Copilot uses AI. Check for mistakes.
Comment on lines +84 to +90
try:
result = subprocess.run(['bash', script_path], check=True, text=True, capture_output=True)
print("Script output:")
print(result.stdout)
except subprocess.CalledProcessError as e:
print("Error while executing the script:")
print(e.stderr)
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The create_json.sh invocation swallows failures: on CalledProcessError it only prints stderr and the test still passes. This can hide setup failures and make the test results misleading. Please fail the test on error (e.g., re-raise or assert with stderr) and/or assert on expected file output from the script.

Copilot uses AI. Check for mistakes.
Comment on lines +149 to +154
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")
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SCRIPT_SUCCESS/SCRIPT_FAILURE constants are swapped: SCRIPT_SUCCESS is set to the "...upload Failed" log string and then prints "Script execution success" when that failure string is found (and vice versa). This makes the test output misleading. Please rename or swap the constants/branches so success maps to the success log message.

Copilot uses AI. Check for mistakes.
Comment thread src/rrdEventProcess.c
Comment on lines 299 to 304
processIssueTypeInStaticProfile(rbuf, pIssueNode);
}
//CID-336989: Resource leak
free(pIssueNode);
}
else
{
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pIssueNode (and its Node/subNode fields allocated by getIssueInfo()) is no longer freed after processing. This introduces a per-event memory leak. Please restore cleanup (free pIssueNode->Node, pIssueNode->subNode, then pIssueNode) once processing is complete.

Copilot uses AI. Check for mistakes.
nhanasi and others added 2 commits April 10, 2026 14:32
* 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
Copilot AI review requested due to automatic review settings April 23, 2026 14:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 81 out of 81 changed files in this pull request and generated 11 comments.

Comment thread src/rrdRunCmdThread.c
Comment on lines +421 to 427
#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
return true;
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under GTEST_ENABLE, this path returns without freeing cmdData / cmdData->rfcvalue / cmdData->command, which will leak in unit tests (and can hide real leaks). Only the systemctl calls should be conditional; the frees should run unconditionally.

Copilot uses AI. Check for mistakes.
Comment on lines +112 to 113
UPLOAD_LOGS = "Starting Upload Debug output via API"
assert UPLOAD_LOGS in grep_rrdlogs(UPLOAD_LOGS)
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The daemon log emitted by uploadDebugoutput is "Starting Upload Debug output via API..." (with ellipsis). This assertion uses "Starting Upload Debug output via API" and will never match, causing false failures. Update the expected string to match the actual log message (or loosen the match to a stable substring).

Copilot uses AI. Check for mistakes.
Comment on lines +136 to 137
UPLOAD_LOGS = "Starting Upload Debug output via API"
assert UPLOAD_LOGS in grep_rrdlogs(UPLOAD_LOGS)
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The daemon log emitted by uploadDebugoutput is "Starting Upload Debug output via API..." (with ellipsis). This assertion uses "Starting Upload Debug output via API" and will not match. Update the expected string (or match a stable substring) to avoid failing the test due to punctuation differences.

Copilot uses AI. Check for mistakes.
Comment on lines +127 to 128
UPLOAD_LOGS = "Starting Upload Debug output via API"
assert UPLOAD_LOGS in grep_rrdlogs(UPLOAD_LOGS)
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The daemon log emitted by uploadDebugoutput is "Starting Upload Debug output via API..." (with ellipsis). This assertion expects the string without the ellipsis and will not match. Update the expected log string (or search for a stable substring) to prevent false failures.

Copilot uses AI. Check for mistakes.
Comment on lines +45 to +52
pid1 = run_shell_command(command_to_get_pid).strip().split()

pid2 = run_shell_command(command_to_get_pid)
assert pid1 == pid2, "A second instance of remotedebugger was started."
pid2 = run_shell_command(command_to_get_pid).strip().split()

# Assert only one PID exists (no second instance)
assert len(pid2) == 1, f"A second instance of remotedebugger was started: {pid2}"
# ensure it's the same PID as before
assert pid1[0] == pid2[0], f"PID changed unexpectedly: before={pid1}, after={pid2}"
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If remotedebugger fails to start, pid1 can be an empty list and pid1[0] will raise IndexError, obscuring the real failure. Add an explicit assertion that pid1 is non-empty after starting (with a helpful message) before indexing it.

Copilot uses AI. Check for mistakes.
Comment thread src/rrd_upload.c
Comment on lines +191 to +197
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) {
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rrd_upload_cleanup_source_dir builds an rm -rf command and executes it via system(). Even if dir_path is expected to be internal, this is still command-injection prone and risky for production code. Prefer a direct recursive delete implementation (e.g., nftw()/unlinkat() traversal) and/or strict validation that dir_path is under the expected /tmp/rrd/ prefix before deletion.

Copilot uses AI. Check for mistakes.
Comment on lines +183 to 184
UPLOAD_LOGS = "Starting Upload Debug output via API"
assert UPLOAD_LOGS in grep_rrdlogs(UPLOAD_LOGS)
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The daemon log emitted by uploadDebugoutput is "Starting Upload Debug output via API..." (with ellipsis). This assertion uses "Starting Upload Debug output via API" and will not match, making the test flaky/always-failing depending on implementation. Align the expected string with the actual log output.

Copilot uses AI. Check for mistakes.
Comment on lines +49 to +51
And Command output shopuld be added to the output file
And the issuetype systemd service should start successfully
And the journalctl service should start successfully
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling: "shopuld" should be "should" in the scenario step text.

Copilot uses AI. Check for mistakes.
Comment on lines +38 to +40
And Sanity check to validate the commands should be executed
And Command output shopuld be added to the output file
And the issuetype systemd service should start successfully
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling: "shopuld" should be "should" in the scenario step text.

Copilot uses AI. Check for mistakes.
Comment thread src/unittest/Makefile.am

# Define the compiler flags
COMMON_CXXFLAGS = -frtti -fprofile-arcs -ftest-coverage
COMMON_CXXFLAGS = -frtti -fprofile-arcs -ftest-coverage -fpermissive
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding -fpermissive to unit-test builds will downgrade many C++ compile errors to warnings and can hide real type/safety issues. It would be better to fix the underlying compilation problems so tests compile cleanly without -fpermissive.

Copilot uses AI. Check for mistakes.
naveenkumarhanasi and others added 5 commits April 23, 2026 17:47
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
Copilot AI review requested due to automatic review settings May 14, 2026 01:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 83 out of 84 changed files in this pull request and generated 15 comments.

Comments suppressed due to low confidence (1)

src/rrdEventProcess.c:345

  • The previous fix that freed pIssueNode here has been removed, leaving only the dangling comment //CID-336989: Resource leak. pIssueNode is malloced at line 188 and there is no other code path in this function that frees it, so every call to processIssueType() now leaks one issueNodeData allocation (plus any internal buffers populated by getIssueInfo). If the removal was needed because a callee (e.g., processIssueTypeInStaticProfile, processIssueTypeInDynamicProfile, checkIssueNodeInfo) takes ownership of the node, that needs to be done consistently across all branches; otherwise restore the free here.

Comment on lines +79 to +85
if '.' in ISSUE_STRING:
ISSUE_NODE, ISSUE_SUBNODE = ISSUE_STRING.split('.')
else:
node = ISSUE_STRING
subnode = None

ISSUE_FOUND = f"Issue Data Node: {ISSUE_NODE} and Sub-Node: {ISSUE_SUBNODE} found in Static JSON File /etc/rrd/remote_debugger.json"
Comment thread src/rrd_upload.c
Comment on lines +188 to +205
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;
}
Comment thread src/rrd_upload.c
Comment on lines +118 to +140
// Try to acquire a non-blocking shared lock (LOCK_SH | LOCK_NB)
// If uploadstblogs has an exclusive lock (LOCK_EX), this will fail with EWOULDBLOCK
int lock_ret = flock(fd, LOCK_SH | LOCK_NB);
if (lock_ret == 0) {
// Successfully acquired shared lock - no exclusive lock held
*is_locked = false;
flock(fd, LOCK_UN); // Release our shared lock
close(fd);
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "%s: Lock status: free\n", __FUNCTION__);
} else if (errno == EWOULDBLOCK || errno == EAGAIN) {
// Exclusive lock is held by another process
*is_locked = true;
close(fd);
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "%s: Lock status: locked\n", __FUNCTION__);
} else {
// Some other error
close(fd);
RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "%s: flock failed (errno: %d)\n", __FUNCTION__, errno);
return -1;
}

return 0;
}
Comment thread src/rrdEventProcess.c
Comment on lines +306 to +328
else
{
strcat(appendcommandstr, dynamicprofiledata->command);
staticprofiledata->command = appendcommandstr;
RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "[%s:%d]: Updated command after append from dynamic and static profile: %s \n", __FUNCTION__, __LINE__, staticprofiledata->command);
RDK_LOG(RDK_LOG_DEBUG,LOG_REMDEBUG,"[%s:%d]: Executing Commands in Runtime Service... \n",__FUNCTION__,__LINE__);
checkIssueNodeInfo(pIssueNode, NULL, rbuf, false, staticprofiledata);
// NOTE: staticprofiledata is freed by executeCommands() via checkIssueNodeInfo()
// Do NOT free staticprofiledata here to avoid double-free
}
// Free dynamicprofiledata after use
if (dynamicprofiledata != NULL)
{
if (dynamicprofiledata->rfcvalue != NULL)
{
free(dynamicprofiledata->rfcvalue);
}
if (dynamicprofiledata->command != NULL)
{
free(dynamicprofiledata->command);
}
free(dynamicprofiledata);
}
And the issue data node and sub-node should be found in the JSON file
And the directory should be created to store the executed output
And Sanity check to validate the commands should be executed
And Command output shopuld be added to the output file
Comment thread src/rrdRunCmdThread.c
Comment on lines +417 to +423
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
Comment thread src/rrdRunCmdThread.c

/* Open debug_output.txt file*/
filePointer = fopen(finalOutFile, "a+");
filePointer = fopen(finalOutFile, "w+");
Comment thread src/rrdInterface.h
Comment on lines 29 to +90
@@ -45,22 +46,32 @@ extern "C"
#define RRD_PROCESS_NAME "remotedebugger"
#define RRD_RBUS_TIMEOUT 60

#ifdef IARMBUS_SUPPORT
// RDK Remote Debugger profile data parameter definitions
#define RRD_SET_PROFILE_EVENT "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.RDKRemoteDebugger.setProfileData"
#define RRD_GET_PROFILE_EVENT "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.RDKRemoteDebugger.getProfileData"
#define RRD_PROFILE_CATEGORY_FILE "/tmp/rrd_profile_category"

/*Enum for IARM Events*/
typedef enum _RemoteDebugger_EventId_t {
IARM_BUS_RDK_REMOTE_DEBUGGER_ISSUETYPE = 0,
IARM_BUS_RDK_REMOTE_DEBUGGER_WEBCFGDATA,
IARM_BUS_RDK_REMOTE_DEBUGGER_MAX_EVENT
} IARM_Bus_RemoteDebugger_EventId_t;
#endif

/*Event Handler Function*/
#if !defined(GTEST_ENABLE)
void _remoteDebuggerEventHandler(rbusHandle_t handle, rbusEvent_t const* event, rbusEventSubscription_t* subscription);
void _remoteDebuggerWebCfgDataEventHandler(rbusHandle_t handle, rbusEvent_t const* event, rbusEventSubscription_t* subscription);
void _rdmDownloadEventHandler(rbusHandle_t handle, rbusEvent_t const* event, rbusEventSubscription_t* subscription);

// Helper functions for profile data processing
bool has_direct_commands(cJSON *category);
char* read_profile_json_file(const char* filename, long* file_size);
char* get_all_categories_json(cJSON* json);
char* get_specific_category_json(cJSON* json, const char* category_name);
rbusError_t set_rbus_response(rbusProperty_t prop, const char* json_str);
#endif
#ifdef IARMBUS_SUPPORT
#if defined(IARMBUS_SUPPORT) || defined(GTEST_ENABLE)
int RRD_IARM_subscribe(void);
int RRD_IARM_unsubscribe(void);
void _rdmManagerEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);
@@ -75,6 +86,8 @@ void RRD_data_buff_deAlloc(data_buf *sbuf);
void RRDMsgDeliver(int msgqid, data_buf *sbuf);
int RRD_subscribe(void);
int RRD_unsubscribe(void);
rbusError_t rrd_SetHandler(rbusHandle_t handle, rbusProperty_t property, rbusSetHandlerOptions_t* opts);
rbusError_t rrd_GetHandler(rbusHandle_t handle, rbusProperty_t prop, rbusGetHandlerOptions_t* opts);
Comment on lines 33 to +53
def test_second_remotedebugger_instance_is_not_started():
kill_rrd()
sleep(2)
command_to_get_pid = "pidof remotedebugger"
pid1 = run_shell_command(command_to_get_pid)
pid1 = run_shell_command(command_to_get_pid).strip().split()

if is_remotedebugger_running():
print("remotedebugger process is already running")
print(f"remotedebugger process is already running with PID(s): {pid1}")
else:
command_to_start = "nohup /usr/local/bin/remotedebugger > /dev/null 2>&1 &"
run_shell_silent(command_to_start)
sleep(2)
pid1 = run_shell_command(command_to_get_pid).strip().split()

pid2 = run_shell_command(command_to_get_pid)
assert pid1 == pid2, "A second instance of remotedebugger was started."
pid2 = run_shell_command(command_to_get_pid).strip().split()

# Assert only one PID exists (no second instance)
assert len(pid2) == 1, f"A second instance of remotedebugger was started: {pid2}"
# ensure it's the same PID as before
assert pid1[0] == pid2[0], f"PID changed unexpectedly: before={pid1}, after={pid2}"

Comment thread CHANGELOG.md
Comment on lines +7 to +11
#### [1.3.3](https://github.com/rdkcentral/remote_debugger/compare/1.3.2...1.3.3)

- RDK-59833 : Remote Debugger datamodel support to retrieve Static Profile Data [`#183`](https://github.com/rdkcentral/remote_debugger/pull/183)
- RDKEMW-16897: Add Agentic Support for the RRD [`#182`](https://github.com/rdkcentral/remote_debugger/pull/182)
- Merge tag '1.3.2' into develop [`8f793e6`](https://github.com/rdkcentral/remote_debugger/commit/8f793e69b6b2b91a27c6a8148014207788503efa)
naveenkumarhanasi and others added 4 commits May 14, 2026 14:25
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
Copilot AI review requested due to automatic review settings May 19, 2026 14:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 88 out of 89 changed files in this pull request and generated 10 comments.

Comment on lines +56 to +100
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}"

time.sleep(2) # Allow processing time

print("Getting profile data after setting to 'all'")
stdout, stderr, rc = run_rbuscli_cmd(f'rbuscli get {get_param}')
print(f"Get command result: stdout='{stdout}', stderr='{stderr}', rc={rc}")
assert rc == 0, f"rbuscli get failed: {stderr}"

if stdout:
try:
data = json.loads(stdout)
print(f"Parsed JSON data: {data}")
assert isinstance(data, (list, dict)), "Expected JSON array or object"
except json.JSONDecodeError:
print(f"Warning: Could not parse JSON response: {stdout}")

# Test Case 2: Set profile data to specific category
print("\nTest Case 2: Setting profile data to 'Device'")
stdout, stderr, rc = run_rbuscli_cmd(f'rbuscli set "Device" {set_param}')
print(f"Set command result: stdout='{stdout}', stderr='{stderr}', rc={rc}")
assert rc == 0, f"rbuscli set 'Device' failed: {stderr}"

time.sleep(2) # Allow processing time

print("Getting profile data after setting to 'Device'")
stdout, stderr, rc = run_rbuscli_cmd(f'rbuscli get {get_param}')
print(f"Get command result: stdout='{stdout}', stderr='{stderr}', rc={rc}")
assert rc == 0, f"rbuscli get failed: {stderr}"

if stdout:
try:
data = json.loads(stdout)
print(f"Parsed JSON data for Device: {data}")
assert isinstance(data, (list, dict)), "Expected JSON array or object"
except json.JSONDecodeError:
print(f"Warning: Could not parse JSON response: {stdout}")

# Test Case 3: Set profile data to another category
print("\nTest Case 3: Setting profile data to 'Process'")
stdout, stderr, rc = run_rbuscli_cmd(f'rbuscli set "Process" {set_param}')
print(f"Set command result: stdout='{stdout}', stderr='{stderr}', rc={rc}")
assert rc == 0, f"rbuscli set 'Process' failed: {stderr}"
Comment on lines +79 to +86
if '.' in ISSUE_STRING:
ISSUE_NODE, ISSUE_SUBNODE = ISSUE_STRING.split('.')
else:
node = ISSUE_STRING
subnode = None

ISSUE_FOUND = f"Issue Data Node: {ISSUE_NODE} and Sub-Node: {ISSUE_SUBNODE} found in Static JSON File /etc/rrd/remote_debugger.json"

Comment on lines +100 to +101
issue_string = "DEEPSLEEP"
check_service_start_success("Audio.Audio")
Comment thread src/rrd_upload.c
Comment on lines +188 to +205
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;
}
Comment on lines +34 to +52
kill_rrd()
sleep(2)
command_to_get_pid = "pidof remotedebugger"
pid1 = run_shell_command(command_to_get_pid)
pid1 = run_shell_command(command_to_get_pid).strip().split()

if is_remotedebugger_running():
print("remotedebugger process is already running")
print(f"remotedebugger process is already running with PID(s): {pid1}")
else:
command_to_start = "nohup /usr/local/bin/remotedebugger > /dev/null 2>&1 &"
run_shell_silent(command_to_start)
sleep(2)
pid1 = run_shell_command(command_to_get_pid).strip().split()

pid2 = run_shell_command(command_to_get_pid)
assert pid1 == pid2, "A second instance of remotedebugger was started."
pid2 = run_shell_command(command_to_get_pid).strip().split()

# Assert only one PID exists (no second instance)
assert len(pid2) == 1, f"A second instance of remotedebugger was started: {pid2}"
# ensure it's the same PID as before
assert pid1[0] == pid2[0], f"PID changed unexpectedly: before={pid1}, after={pid2}"
Comment thread src/rrdRunCmdThread.c
Comment on lines +418 to +423
#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
Comment thread src/rrdJsonParser.c
Comment on lines 807 to +809
}
free(rfcbuf); // free rfc value
// Note: rfcbuf is owned by the caller; this function must not free it.
// The caller is responsible for freeing rfcbuf after this function returns.
Comment thread src/rrdJsonParser.c
Comment on lines +696 to 705
if ((tar_name_len < 0) || ((size_t)tar_name_len >= sizeof(tarName)))
{
RDK_LOG(RDK_LOG_ERROR,LOG_REMDEBUG,"[%s:%d]: Failed to build upload file name for %s. snprintf result:%d, buffer size:%zu\n", __FUNCTION__,__LINE__,buff->mdata,tar_name_len,sizeof(tarName));
status = -1;
}
else
{
status = uploadDebugoutput(outdir, tarName);
}
if(status != 0)
Comment thread src/rrdRunCmdThread.c

/* Open debug_output.txt file*/
filePointer = fopen(finalOutFile, "a+");
filePointer = fopen(finalOutFile, "w+");
Comment thread CHANGELOG.md
Comment on lines +7 to +11
#### [1.3.4](https://github.com/rdkcentral/remote_debugger/compare/1.3.3...1.3.4)

- RDK-60236 : Remote Debugger Supports UUID Information in Debug Report File [`#194`](https://github.com/rdkcentral/remote_debugger/pull/194)
- Refactor issueTypeSplitter to include suffix handling [`c56fef3`](https://github.com/rdkcentral/remote_debugger/commit/c56fef33df07f47c2ea91c26010548bf0a3baa36)
- Merge tag '1.3.3' into develop [`7151d20`](https://github.com/rdkcentral/remote_debugger/commit/7151d208ced521de7ee7dee66cca6aea951e95b3)
… 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>
Copilot AI review requested due to automatic review settings May 19, 2026 14:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 89 out of 90 changed files in this pull request and generated 18 comments.

Comments suppressed due to low confidence (1)

src/rrdRunCmdThread.c:423

  • Wrapping the free() calls for cmdData->rfcvalue, cmdData->command and cmdData itself in #if !defined(GTEST_ENABLE) means these allocations leak under the gtest build. If the intent was only to prevent double-free interactions with the mocked systemd path in tests, prefer freeing unconditionally and instead make the test harness not allocate ownership-transferring cmdData here, or guard only the systemd v_secure_system call. As written, gtest runs accumulate leaks that valgrind/CI coverage will report.

Comment on lines +56 to +98
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}"

time.sleep(2) # Allow processing time

print("Getting profile data after setting to 'all'")
stdout, stderr, rc = run_rbuscli_cmd(f'rbuscli get {get_param}')
print(f"Get command result: stdout='{stdout}', stderr='{stderr}', rc={rc}")
assert rc == 0, f"rbuscli get failed: {stderr}"

if stdout:
try:
data = json.loads(stdout)
print(f"Parsed JSON data: {data}")
assert isinstance(data, (list, dict)), "Expected JSON array or object"
except json.JSONDecodeError:
print(f"Warning: Could not parse JSON response: {stdout}")

# Test Case 2: Set profile data to specific category
print("\nTest Case 2: Setting profile data to 'Device'")
stdout, stderr, rc = run_rbuscli_cmd(f'rbuscli set "Device" {set_param}')
print(f"Set command result: stdout='{stdout}', stderr='{stderr}', rc={rc}")
assert rc == 0, f"rbuscli set 'Device' failed: {stderr}"

time.sleep(2) # Allow processing time

print("Getting profile data after setting to 'Device'")
stdout, stderr, rc = run_rbuscli_cmd(f'rbuscli get {get_param}')
print(f"Get command result: stdout='{stdout}', stderr='{stderr}', rc={rc}")
assert rc == 0, f"rbuscli get failed: {stderr}"

if stdout:
try:
data = json.loads(stdout)
print(f"Parsed JSON data for Device: {data}")
assert isinstance(data, (list, dict)), "Expected JSON array or object"
except json.JSONDecodeError:
print(f"Warning: Could not parse JSON response: {stdout}")

# Test Case 3: Set profile data to another category
print("\nTest Case 3: Setting profile data to 'Process'")
stdout, stderr, rc = run_rbuscli_cmd(f'rbuscli set "Process" {set_param}')
Comment on lines +80 to +86
if '.' in ISSUE_STRING:
ISSUE_NODE, ISSUE_SUBNODE = ISSUE_STRING.split('.')
else:
node = ISSUE_STRING
subnode = None

ISSUE_FOUND = f"Issue Data Node: {ISSUE_NODE} and Sub-Node: {ISSUE_SUBNODE} found in Static JSON File /etc/rrd/remote_debugger.json"
DEBUG_FILE = "Adding Details of Debug commands to Output File"
assert DEBUG_FILE in grep_rrdlogs(DEBUG_FILE)

issue_string = "DEEPSLEEP"
Comment thread src/rrdRunCmdThread.c
Comment on lines +417 to +423
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
Comment thread src/rrdIarmEvents.c
Comment on lines 154 to 185
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Received state from Power Manager Current :[%d] New[%d] \n", __FUNCTION__, __LINE__, currentState, newState);
#ifdef ENABLE_WEBCFG_FEATURE
rbusError_t rc = RBUS_ERROR_BUS_ERROR;
rbusValue_t value;
rbusValue_Init(&value);
rbusValue_SetString(value,"root");
rc = rbus_set(rrdRbusHandle, RRD_WEBCFG_FORCE_SYNC, value, NULL);
if (rc != RBUS_ERROR_SUCCESS)
#ifndef USE_L2_SUPPORT
if (rc != RBUS_ERROR_SUCCESS)
{
RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "[%s:%d]: rbus_set failed for [%s] with error [%d]\n\n", __FUNCTION__, __LINE__,RRD_WEBCFG_FORCE_SYNC ,rc);
return;
}
RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "[%s:%d]: Invoking WebCfg Force Sync: %s... \n", __FUNCTION__, __LINE__, RRD_WEBCFG_FORCE_SYNC);
#else
#endif
RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "[%s:%d]: Invoking WebCfg Force Sync: %s... \n", __FUNCTION__, __LINE__, RRD_WEBCFG_FORCE_SYNC);
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Copying Message Received to the queue.. \n", __FUNCTION__, __LINE__);
sbuf = (data_buf *)malloc(sizeof(data_buf));
if (!sbuf)
{
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Memory Allocation Failed for EventId %d \n", __FUNCTION__, __LINE__, eventId);
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Memory Allocation Failed for EventId \n", __FUNCTION__, __LINE__);
return;
}

RRD_data_buff_init(sbuf, DEEPSLEEP_EVENT_MSG, RRD_DEEPSLEEP_RDM_DOWNLOAD_PKG_INITIATE);
sbuf->mdata = (char *)malloc(msgLen);
if (!sbuf->mdata)
{
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Memory Allocation Failed for EventId %d \n", __FUNCTION__, __LINE__, eventId);
RDK_LOG(RDK_LOG_DEBUG, LOG_REMDEBUG, "[%s:%d]: Memory Allocation Failed for EventId \n", __FUNCTION__, __LINE__);
RRD_data_buff_deAlloc(sbuf);
return;
}
strncpy((char *)sbuf->mdata, (const char *)DEEP_SLEEP_STR, msgLen);
RRDMsgDeliver(msqid, sbuf);
Comment thread CHANGELOG.md
Comment on lines +7 to +12
#### [1.3.4](https://github.com/rdkcentral/remote_debugger/compare/1.3.3...1.3.4)

- RDK-60236 : Remote Debugger Supports UUID Information in Debug Report File [`#194`](https://github.com/rdkcentral/remote_debugger/pull/194)
- Refactor issueTypeSplitter to include suffix handling [`c56fef3`](https://github.com/rdkcentral/remote_debugger/commit/c56fef33df07f47c2ea91c26010548bf0a3baa36)
- Merge tag '1.3.3' into develop [`7151d20`](https://github.com/rdkcentral/remote_debugger/commit/7151d208ced521de7ee7dee66cca6aea951e95b3)

Comment on lines +79 to +85
if '.' in ISSUE_STRING:
ISSUE_NODE, ISSUE_SUBNODE = ISSUE_STRING.split('.')
else:
node = ISSUE_STRING
subnode = None

ISSUE_FOUND = f"Issue Data Node: {ISSUE_NODE} and Sub-Node: {ISSUE_SUBNODE} found in Static JSON File /etc/rrd/remote_debugger.json"
Comment thread src/Makefile.am
Comment on lines 1 to 3
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
And the issue data node and sub-node should be found in the JSON file
And the directory should be created to store the executed output
And Sanity check to validate the commands should be executed
And Command output shopuld be added to the output file
Comment on lines +147 to +152
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")
Co-authored-by: Hanasi <nhanas001c@cable.comcast.com>
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.