Skip to content

RDKB-64757 : Remotedebugger debug.txt getting appended while repeatedly query same issueype#187

Open
Abhinavpv28 wants to merge 13 commits intodevelopfrom
feature/rrd_append_error
Open

RDKB-64757 : Remotedebugger debug.txt getting appended while repeatedly query same issueype#187
Abhinavpv28 wants to merge 13 commits intodevelopfrom
feature/rrd_append_error

Conversation

@Abhinavpv28
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 2, 2026 07:03
@Abhinavpv28 Abhinavpv28 requested a review from a team as a code owner May 2, 2026 07:03
@Abhinavpv28
Copy link
Copy Markdown
Contributor Author

@copilot
12:15:13 | ../../git/src/rrdRunCmdThread.c: In function 'executeCommands':
12:15:13 | ../../git/src/rrdRunCmdThread.c:380:97: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 240 [-Werror=format-truncation=]
12:15:13 | 380 | snprintf(remoteDebuggerServiceStr, sizeof(remoteDebuggerServiceStr), "%s%s", remoteDebuggerPrefix, dirname);
12:15:13 | | ^~ ~~~~~~~
12:15:13 | ../../git/src/rrdRunCmdThread.c:380:25: note: 'snprintf' output between 17 and 272 bytes into a destination of size 256
12:15:13 | 380 | snprintf(remoteDebuggerServiceStr, sizeof(remoteDebuggerServiceStr), "%s%s", remoteDebuggerPrefix, dirname);
12:15:13 | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12:15:13 | cc1: al

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

Code Coverage Summary

                               Total:|83.5%   5888|97.0%  1531|    -      0

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

This PR updates executeCommands() in the remote debugger runtime flow, apparently to change how per-request output files are opened and to make the transient systemd-run unit name derive from the per-execution directory name rather than just the RFC value. In the broader codebase, this sits in the command-execution path that collects debug output and uploads it for a requested issue.

Changes:

  • Open each request’s debug_outputs.txt with "w+" instead of "a+".
  • Build the systemd-run/journalctl/systemctl stop unit name with remote_debugger_ + dirname.
  • Leave the previous strncpy/strncat unit-name construction in commented form.

Comment thread src/rrdRunCmdThread.c Outdated
Comment thread src/rrdRunCmdThread.c Outdated
Comment thread src/rrdRunCmdThread.c Outdated
Copy link
Copy Markdown

Copilot AI commented May 2, 2026

@copilot
12:15:13 | ../../git/src/rrdRunCmdThread.c: In function 'executeCommands':
12:15:13 | ../../git/src/rrdRunCmdThread.c:380:97: error: '%s' directive output may be truncated writing up to ...

Fixed in commit 02ad766.

The root cause: remoteDebuggerServiceStr was declared as BUF_LEN_256 (256 bytes), but the snprintf concatenates remoteDebuggerPrefix ("remote_debugger_", 16 chars) with dirname (up to 255 chars), requiring up to 272 bytes — exceeding the destination buffer.

Changes made:

  • Added #define BUF_LEN_512 512 to rrdRunCmdThread.h
  • Changed remoteDebuggerServiceStr buffer from BUF_LEN_256 to BUF_LEN_512
  • Removed the dead commented-out code

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Code Coverage Summary

                               Total:|83.5%   5888|97.0%  1531|    -      0

Copilot AI review requested due to automatic review settings May 4, 2026 16:44
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Code Coverage Summary

                               Total:|83.5%   5888|97.0%  1531|    -      0

@Abhinavpv28 Abhinavpv28 changed the title Feature/rrd append error RDKB-64757 : Remotedebugger debug.txt getting appended while repeatedly query same issueype May 4, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Code Coverage Summary

                               Total:|83.5%   5888|97.0%  1531|    -      0

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 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread src/rrdRunCmdThread.c Outdated
Comment thread src/rrdRunCmdThread.c Outdated
Copy link
Copy Markdown
Contributor

@AravindanNC AravindanNC left a comment

Choose a reason for hiding this comment

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

are multiple command outputs present in the upload file ?

Copilot AI review requested due to automatic review settings May 5, 2026 02:53
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Code Coverage Summary

                               Total:|83.5%   5892|97.0%  1531|    -      0

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 2 out of 2 changed files in this pull request and generated 3 comments.

Comment thread src/rrdRunCmdThread.c
Comment thread src/rrdRunCmdThread.c Outdated
Comment thread src/rrdRunCmdThread.c Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Code Coverage Summary

                               Total:|83.5%   5892|97.0%  1531|    -      0

Copilot AI review requested due to automatic review settings May 5, 2026 04:30
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Code Coverage Summary

                               Total:|83.5%   5892|97.0%  1531|    -      0

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 3 out of 3 changed files in this pull request and generated 5 comments.

Comment thread src/rrdRunCmdThread.c Outdated
Comment thread src/rrdRunCmdThread.c
Comment thread .github/workflows/L2-tests.yml Outdated
Comment thread src/rrdRunCmdThread.c Outdated
Comment thread src/rrdRunCmdThread.c Outdated
Comment on lines +394 to +398
RDK_LOG(RDK_LOG_ERROR,LOG_REMDEBUG,"[%s:%d]: Starting remote_debugger_%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 remote_debugger_%s service success...\n",__FUNCTION__,__LINE__,remoteDebuggerServiceStr);
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Code Coverage Summary

                               Total:|83.5%   5892|97.0%  1531|    -      0

Copilot AI review requested due to automatic review settings May 5, 2026 12:04
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Code Coverage Summary

                               Total:|83.5%   5892|97.0%  1531|    -      0

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 2 out of 2 changed files in this pull request and generated 3 comments.

Comment thread src/rrdRunCmdThread.c Outdated
strncpy(remoteDebuggerServiceStr, remoteDebuggerPrefix, sizeof(remoteDebuggerServiceStr) - 1);
remoteDebuggerServiceStr[sizeof(remoteDebuggerServiceStr) - 1] = '\0';
strncat(remoteDebuggerServiceStr, cmdData->rfcvalue, sizeof(remoteDebuggerServiceStr) - strlen(remoteDebuggerServiceStr) - 1);
snprintf(remoteDebuggerServiceStr, sizeof(remoteDebuggerServiceStr),"%s%s_%ld", remoteDebuggerPrefix, cmdData->rfcvalue, (long)epochTime);
Comment thread src/rrdRunCmdThread.c
Comment thread src/rrdRunCmdThread.c Outdated
Comment on lines +379 to +386
time_t epochTime = time(NULL);
if (epochTime == ((time_t)-1))
{
RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "[%s:%d]: Failed to get epoch time\n", __FUNCTION__, __LINE__);
return false;
}

strncpy(remoteDebuggerServiceStr, remoteDebuggerPrefix, sizeof(remoteDebuggerServiceStr) - 1);
remoteDebuggerServiceStr[sizeof(remoteDebuggerServiceStr) - 1] = '\0';
strncat(remoteDebuggerServiceStr, cmdData->rfcvalue, sizeof(remoteDebuggerServiceStr) - strlen(remoteDebuggerServiceStr) - 1);
snprintf(remoteDebuggerServiceStr, sizeof(remoteDebuggerServiceStr),"%s%s_%ld", remoteDebuggerPrefix, cmdData->rfcvalue, (long)epochTime);
Copilot AI review requested due to automatic review settings May 5, 2026 12:55
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Code Coverage Summary

                               Total:|83.5%   5892|97.0%  1531|    -      0

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Code Coverage Summary

                               Total:|83.5%   5891|97.0%  1531|    -      0

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 2 out of 2 changed files in this pull request and generated 4 comments.

Comment thread src/rrdRunCmdThread.c
Comment thread src/rrdRunCmdThread.c
Comment thread src/rrdRunCmdThread.c
Comment thread src/rrdRunCmdThread.c
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.

4 participants