Skip to content

Feature/rdkemw 22385 - #166

Open
Abhinavpv28 wants to merge 38 commits into
developfrom
feature/RDKEMW-22385
Open

Feature/rdkemw 22385#166
Abhinavpv28 wants to merge 38 commits into
developfrom
feature/RDKEMW-22385

Conversation

@Abhinavpv28

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI lite review requested due to automatic review settings August 1, 2026 10:30
@Abhinavpv28
Abhinavpv28 requested a review from a team as a code owner August 1, 2026 10:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 extends the uploadstblogs library/binary to support an “UploadLogsNow” workflow when invoked via the structured API, and makes the library headers installable/usable by external consumers (including C++ callers).

Changes:

  • Add an uploadlogsnow_mode flag to UploadSTBLogsParams and route uploadstblogs_run() through the UploadLogsNow workflow when enabled.
  • Install uploadstblogs public headers via Automake for consumption by other components.
  • Add C++ compatibility guards (extern "C") to the public header.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

File Description
uploadstblogs/src/uploadstblogs.c Adds API-side UploadLogsNow mode branch to execute the custom workflow early.
uploadstblogs/src/Makefile.am Installs uploadstblogs headers for external consumers.
uploadstblogs/include/uploadstblogs.h Adds extern "C" guards for C++ consumption.
uploadstblogs/include/uploadstblogs_types.h Extends public API params with uploadlogsnow_mode.

"[%s:%d] UploadLogsNow mode detected via API, executing custom workflow\n",
__FUNCTION__, __LINE__);

ret = execute_uploadlogsnow_workflow(&ctx);
Comment on lines +44 to +48
# Install public headers for external consumers (e.g. tr69hostif)
uploadstblogsincludedir = $(includedir)/uploadstblogs
uploadstblogsinclude_HEADERS = \
$(top_srcdir)/uploadstblogs/include/uploadstblogs.h \
$(top_srcdir)/uploadstblogs/include/uploadstblogs_types.h
Comment on lines +124 to +126
#ifdef __cplusplus
}
#endif
Copilot AI review requested due to automatic review settings August 1, 2026 10:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 6 out of 6 changed files in this pull request and generated 1 comment.

Suppressed comments (3)

uploadstblogs/src/uploadstblogs.c:292

  • uploadstblogs_run() is documented to return 0 on success and 1 on failure, but execute_uploadlogsnow_workflow() returns 0 on success and a negative value on failure. Returning its raw return code breaks the API contract for external callers.
        ret = execute_uploadlogsnow_workflow(&ctx);

uploadstblogs/include/uploadstblogs.h:125

  • This header is now being installed for external consumers, but it still declares main(). Exposing main() from a public library header is misleading and can cause conflicts in consumers; it should be available only when building the standalone binary.
int main(int argc, char** argv);

#ifdef __cplusplus
}

uploadstblogs/src/context_manager.c:158

  • rdk_LogOutput_File filelog is passed to rdk_logger_ext_init() with only fileName/fileLocation initialized; any remaining fields in the struct are left uninitialized and may be read by the logger implementation (undefined behavior). Zero-initialize the struct before populating fields.
    rdk_LogOutput_File filelog;

Comment thread dcm_utils.c Outdated
Comment on lines +58 to +62
rdk_logger_ext_config_t config = {
.pModuleName = "LOG.RDK.UPLOADSTB", /* Module name */
.loglevel = RDK_LOG_INFO, /* Default log level */
.output = RDKLOG_OUTPUT_CONSOLE, /* Output to console (stdout/stderr) */
.output = RDKLOG_OUTPUT_FILE,
Copilot AI review requested due to automatic review settings August 1, 2026 10:40
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

Code Coverage Summary

                                   Total:|72.9%   4541|92.5%   227|    -      0

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

Code Coverage Summary

                                   Total:|73.0%   4546|92.5%   227|    -      0

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 6 out of 6 changed files in this pull request and generated 1 comment.

Suppressed comments (3)

dcm_utils.c:66

  • The rdk_logger_ext_config_t designated initializer duplicates fields (.output and .pFilePolicy) and is missing a comma, which will either fail compilation or trigger -Werror warnings about overwritten initializers. It also sets the module name to LOG.RDK.UPLOADSTB inside DCMLOGInit(), which conflicts with the DCM logging component used elsewhere (LOG.RDK.DCM).
        .output = RDKLOG_OUTPUT_CONSOLE,          /* Output to console (stdout/stderr) */
        .output = RDKLOG_OUTPUT_FILE,
        .format = RDKLOG_FORMAT_WITH_TS,          /* Timestamped format */
        .pFilePolicy = NULL                       /* Not using file output, so NULL */
        .pFilePolicy =  &filelog                  /* using file output */

uploadstblogs/src/uploadstblogs.c:290

  • uploadstblogs_run() initializes telemetry (t2_init) before validate_system(), but on validation failure the function returns without calling t2_uninit() or cleanup_iarm_connection(), while the new UploadLogsNow early-return path does. This leaves resources initialized on an error path and makes cleanup inconsistent.
    /* Handle UploadLogsNow mode */
    if (ctx.uploadlogsnow_mode) {
        RDK_LOG(RDK_LOG_INFO, LOG_UPLOADSTB,
                "[%s:%d] UploadLogsNow mode detected via API, executing custom workflow\n",
                __FUNCTION__, __LINE__);

uploadstblogs/src/context_manager.c:163

  • rdk_LogOutput_File is stack-allocated and only fileName/fileLocation are initialized. If the struct contains other policy fields (e.g., size/count), they will be left uninitialized. Zero-initialize the struct before populating fields to avoid undefined behavior.
    rdk_LogOutput_File filelog;
    strncpy(filelog.fileName, "dcmscript.log", sizeof(filelog.fileName)-1);
    filelog.fileName[sizeof(filelog.fileName) - 1] = '\0';
    strncpy(filelog.fileLocation, "/opt/logs/", sizeof(filelog.fileLocation)-1);
    filelog.fileLocation[sizeof(filelog.fileLocation) - 1] = '\0';

TriggerType trigger_type; /**< Trigger type (TRIGGER_SCHEDULED, TRIGGER_ONDEMAND, etc.) */
bool rrd_flag; /**< RRD flag */
const char* rrd_file; /**< RRD upload log file path (optional) */
bool uploadlogsnow_mode; /**< When true, execute UploadLogsNow workflow */
Copilot AI review requested due to automatic review settings August 1, 2026 10:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 6 out of 6 changed files in this pull request and generated 1 comment.

Suppressed comments (3)

uploadstblogs/src/uploadstblogs.c:299

  • uploadstblogs_run() is documented to return 0 on success and 1 on failure, but in UploadLogsNow mode it returns the raw result of execute_uploadlogsnow_workflow(), which can be negative (e.g. -1). This breaks the API contract for external callers.
        return ret;

dcm_utils.c:63

  • DCMLOGInit() switched to extended logger init without guarding it behind an extended-logger feature macro and without falling back to rdk_logger_init() when extended logging isn’t enabled. This risks build/link failures on platforms that only provide the standard logger path, and also logs an incorrect component name ("UPLOADSTB") on failure.
    rdk_logger_ext_config_t config = {
        .pModuleName = "LOG.RDK.DCM",     /* Module name */
        .loglevel = RDK_LOG_INFO,         /* Default log level */
        .output = RDKLOG_OUTPUT_FILE,
        .format = RDKLOG_FORMAT_WITH_TS,  /* Timestamped format */

uploadstblogs/src/context_manager.c:163

  • rdk_LogOutput_File filelog is not zero-initialized, so any fields beyond fileName/fileLocation (e.g., fileSizeMax, fileCountMax as used in backup_logs/src/backup_logs.c) are passed to the logger with indeterminate values. This can cause unpredictable logger behavior.
    rdk_LogOutput_File filelog;
    strncpy(filelog.fileName, "dcmscript.log", sizeof(filelog.fileName)-1);
    filelog.fileName[sizeof(filelog.fileName) - 1] = '\0';
    strncpy(filelog.fileLocation, "/opt/logs/", sizeof(filelog.fileLocation)-1);
    filelog.fileLocation[sizeof(filelog.fileLocation) - 1] = '\0';

Comment thread dcm_utils.c
#include <signal.h>
#include <dirent.h>
#include <errno.h>
#include "rdk_logger.h"
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

Code Coverage Summary

                                   Total:|73.0%   4546|92.5%   227|    -      0

1 similar comment
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

Code Coverage Summary

                                   Total:|73.0%   4546|92.5%   227|    -      0

Copilot AI review requested due to automatic review settings August 1, 2026 12:33
Copilot AI review requested due to automatic review settings August 2, 2026 13:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 2, 2026 13:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 2, 2026 13:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 4, 2026 11:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 4, 2026 11:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 4, 2026 11:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 4, 2026 11:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 5, 2026 02:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 7, 2026 16:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 8, 2026 02:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants