Skip to content

To improve the error handling of vtysh read config file #15568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

StormLiangMS
Copy link
Contributor

@StormLiangMS StormLiangMS commented Jun 21, 2023

Why I did it

When read from config file, if any i/o error, vtysh_b will return but doesn't drop any error msg, that would lead to silent failure. In this PR to improve the error handling when read from config file.

Work item tracking
  • Microsoft ADO (24233242):

How I did it

To deal with error of fgets

How to verify it

PR test

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@StormLiangMS StormLiangMS requested a review from lguohan as a code owner June 21, 2023 08:20
@@ -0,0 +1,42 @@
From 33a231ac26a46bfb728975d1695b7a71a7bc95ab Mon Sep 17 00:00:00 2001
From: stormliang <[email protected]>
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this upstream patch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I this is not upstream patch, I create this one.

}
+ if (feof(fp)) {
+ // Handle end-of-file (EOF) error
+ vty_out(vty, "fgets error: End of file reached.\n");
Copy link
Collaborator

Choose a reason for hiding this comment

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

where do we see such message, in syslog?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR is not ready for review yet, make it as draft.

@StormLiangMS StormLiangMS marked this pull request as draft June 24, 2023 12:13
@StormLiangMS
Copy link
Contributor Author

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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.

2 participants