Skip to content
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

Add quotes to tr constructs to fix command syntax #20464

Merged
merged 3 commits into from
Nov 18, 2024

Conversation

spilkey-cisco
Copy link
Contributor

Why I did it

bgp/test_startup_tsa_tsb_service.py::test_tsa_tsb_service_with_dut_abnormal_reboot is failing on LC due tr errors in TSC.

LC0:~$ sudo TSC
BGP0 : System Mode: Normal
BGP1 : System Mode: Normal
BGP2 : System Mode: Normal
The rates are calculated within 5 seconds period
      IFACE    STATE    RX_OK      RX_BPS    RX_UTIL    RX_ERR    RX_DRP    RX_OVR    TX_OK        TX_BPS    TX_UTIL    TX_ERR    TX_DRP    TX_OVR

  Ethernet0        U        0    0.71 B/s      0.00%         0         0         0        7  1972.90 KB/s      0.00%         0         0         0
  Ethernet8        U        6  121.73 B/s      0.00%         0         0         0        0  2379.44 KB/s      0.00%         0         0         0
 Ethernet16        U        0    0.79 B/s      0.00%         0         0         0        8  2384.06 KB/s      0.00%         0         0         0
 Ethernet24        U        7  109.43 B/s      0.00%         0         0         0        0  1976.17 KB/s      0.00%         0         0         0
 Ethernet32        U        7  109.49 B/s      0.00%         0         0         0        7  1975.57 KB/s      0.00%         0         0         0
 Ethernet40        U        0    0.79 B/s      0.00%         0         0         0        0  1974.79 KB/s      0.00%         0         0         0
 Ethernet48        U        0    0.79 B/s      0.00%         0         0         0        7  1977.27 KB/s      0.00%         0         0         0
 Ethernet56        U        6  109.34 B/s      0.00%         0         0         0        0  1984.46 KB/s      0.00%         0         0         0
 Ethernet64        U        6  109.34 B/s      0.00%         0         0         0        0  1985.28 KB/s      0.00%         0         0         0
 Ethernet72        U        0    0.79 B/s      0.00%         0         0         0        5  1985.01 KB/s      0.00%         0         0         0
 Ethernet80        U        0    0.79 B/s      0.00%         0         0         0        0  1975.96 KB/s      0.00%         0         0         0
 Ethernet88        U        6  108.50 B/s      0.00%         0         0         0        5  1975.86 KB/s      0.00%         0         0         0
 Ethernet96        U        8  109.56 B/s      0.00%         0         0         0        8  2352.76 KB/s      0.00%         0         0         0
Ethernet104        U        0    5.04 B/s      0.00%         0         0         0        0  2340.51 KB/s      0.00%         0         0         0
Ethernet112        U        8  122.52 B/s      0.00%         0         0         0        8  2421.37 KB/s      0.00%         0         0         0
Ethernet120        U        8  115.81 B/s      0.00%         0         0         0        8  2424.74 KB/s      0.00%         0         0         0
Ethernet128        U        0    5.04 B/s      0.00%         0         0         0        0  2420.84 KB/s      0.00%         0         0         0
Ethernet136        U       10  119.81 B/s      0.00%         0         0         0        8  2424.94 KB/s      0.00%         0         0         0
Ethernet144        U        8  115.22 B/s      0.00%         0         0         0        8  2425.84 KB/s      0.00%         0         0         0
Ethernet152        U        8  115.62 B/s      0.00%         0         0         0        8  2425.07 KB/s      0.00%         0         0         0
Ethernet160        U        9  135.75 B/s      0.00%         0         0         0       10  2422.25 KB/s      0.00%         0         0         0
Ethernet168        U        8   97.58 B/s      0.00%         0         0         0        8  2421.22 KB/s      0.00%         0         0         0
Ethernet176        U        8  147.07 B/s      0.00%         0         0         0       10  2417.51 KB/s      0.00%         0         0         0
Ethernet184        U        8  121.56 B/s      0.00%         0         0         0        9  2417.56 KB/s      0.00%         0         0         0
Ethernet192        U        6  121.19 B/s      0.00%         0         0         0        6  2001.94 KB/s      0.00%         0         0         0
Ethernet200        U        6  121.18 B/s      0.00%         0         0         0        6  2000.80 KB/s      0.00%         0         0         0
Ethernet208        U        6  121.21 B/s      0.00%         0         0         0        6  2000.55 KB/s      0.00%         0         0         0
Ethernet216        U        6  120.04 B/s      0.00%         0         0         0        6   795.03 KB/s      0.01%         0         0         0
Ethernet224        U        6  113.90 B/s      0.00%         0         0         0        6   650.28 KB/s      0.01%         0         0         0
Ethernet232        U        6  116.06 B/s      0.00%         0         0         0        6   645.00 KB/s      0.01%         0         0         0
Ethernet240        U        8  102.86 B/s      0.00%         0         0         0        6   641.52 KB/s      0.01%         0         0         0
Ethernet248        U        7  127.12 B/s      0.00%         0         0         0        7   667.74 KB/s      0.01%         0         0         0
Ethernet256        X        0    0.00 B/s      0.00%         0         0         0        0      0.00 B/s      0.00%         0         0         0
Ethernet264        X        0    0.00 B/s      0.00%         0         0         0        0      0.00 B/s      0.00%         0         0         0
Ethernet272        X        0    0.00 B/s      0.00%         0         0         0        0      0.00 B/s      0.00%         0         0         0
Ethernet280        X        0    0.00 B/s      0.00%         0         0         0        0      0.00 B/s      0.00%         0         0         0

Reminder: Please execute 'show interface counters -d all' to include internal links

tr: misaligned [:upper:] and/or [:lower:] construct
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe
Work item tracking
  • Microsoft ADO (number only):

How I did it

Add quotes around tr upper and lower constructs everywhere they are missing so tr does not fail.

How to verify it

Run failing script to verify issue is not seen:

LC0:~$ sudo TSC
BGP0 : System Mode: Normal
BGP1 : System Mode: Normal
BGP2 : System Mode: Normal
The rates are calculated within 5 seconds period
      IFACE    STATE    RX_OK      RX_BPS    RX_UTIL    RX_ERR    RX_DRP    RX_OVR    TX_OK        TX_BPS    TX_UTIL    TX_ERR    TX_DRP    TX_OVR

  Ethernet0        U        0    0.76 B/s      0.00%         0         0         0        5  1944.30 KB/s      0.00%         0         0         0
  Ethernet8        U        8   93.01 B/s      0.00%         0         0         0        0  1975.44 KB/s      0.00%         0         0         0
 Ethernet16        U        0    0.76 B/s      0.00%         0         0         0        5  1966.25 KB/s      0.00%         0         0         0
 Ethernet24        U        8   98.88 B/s      0.00%         0         0         0        0  1977.93 KB/s      0.00%         0         0         0
 Ethernet32        U        7  135.36 B/s      0.00%         0         0         0        8  2455.01 KB/s      0.00%         0         0         0
 Ethernet40        U        0    0.76 B/s      0.00%         0         0         0        0  2459.09 KB/s      0.00%         0         0         0
 Ethernet48        U        0    0.46 B/s      0.00%         0         0         0        8  2468.40 KB/s      0.00%         0         0         0
 Ethernet56        U        8  146.17 B/s      0.00%         0         0         0        0  2465.11 KB/s      0.00%         0         0         0
 Ethernet64        U        8  151.50 B/s      0.00%         0         0         0        0  2464.46 KB/s      0.00%         0         0         0
 Ethernet72        U        0    0.66 B/s      0.00%         0         0         0        8  2464.52 KB/s      0.00%         0         0         0
 Ethernet80        U        1   23.42 B/s      0.00%         0         0         0        0  2464.30 KB/s      0.00%         0         0         0
 Ethernet88        U        5  127.55 B/s      0.00%         0         0         0        8  2463.28 KB/s      0.00%         0         0         0
 Ethernet96        U        8  153.39 B/s      0.00%         0         0         0        8  2323.23 KB/s      0.00%         0         0         0
Ethernet104        U        0    1.00 B/s      0.00%         0         0         0        0  2358.34 KB/s      0.00%         0         0         0
Ethernet112        U        7  133.34 B/s      0.00%         0         0         0        8  2403.96 KB/s      0.00%         0         0         0
Ethernet120        U        8  139.29 B/s      0.00%         0         0         0        8  2405.80 KB/s      0.00%         0         0         0
Ethernet128        U        0    1.36 B/s      0.00%         0         0         0        0  2411.24 KB/s      0.00%         0         0         0
Ethernet136        U        5  114.89 B/s      0.00%         0         0         0        8  2393.90 KB/s      0.00%         0         0         0
Ethernet144        U        5  114.29 B/s      0.00%         0         0         0        8  2392.99 KB/s      0.00%         0         0         0
Ethernet152        U        7  130.06 B/s      0.00%         0         0         0        8  2396.83 KB/s      0.00%         0         0         0
Ethernet160        U        7  135.03 B/s      0.00%         0         0         0        8  2394.82 KB/s      0.00%         0         0         0
Ethernet168        U        7  134.53 B/s      0.00%         0         0         0        8  2392.01 KB/s      0.00%         0         0         0
Ethernet176        U        6  123.51 B/s      0.00%         0         0         0        8  2391.63 KB/s      0.00%         0         0         0
Ethernet184        U        8  148.04 B/s      0.00%         0         0         0        8  2391.18 KB/s      0.00%         0         0         0
Ethernet192        U        7  109.04 B/s      0.00%         0         0         0        6  1972.75 KB/s      0.00%         0         0         0
Ethernet200        U        7  109.04 B/s      0.00%         0         0         0        6  1979.16 KB/s      0.00%         0         0         0
Ethernet208        U        7  110.00 B/s      0.00%         0         0         0        6  1980.34 KB/s      0.00%         0         0         0
Ethernet216        U        7  108.78 B/s      0.00%         0         0         0        6   647.53 KB/s      0.01%         0         0         0
Ethernet224        U        7  131.42 B/s      0.00%         0         0         0        7   789.17 KB/s      0.01%         0         0         0
Ethernet232        U        6  104.57 B/s      0.00%         0         0         0        5   654.17 KB/s      0.01%         0         0         0
Ethernet240        U        7  109.00 B/s      0.00%         0         0         0        6   657.83 KB/s      0.01%         0         0         0
Ethernet248        U        4   75.95 B/s      0.00%         0         0         0        4   657.67 KB/s      0.01%         0         0         0
Ethernet256        X        0    0.00 B/s      0.00%         0         0         0        0      0.00 B/s      0.00%         0         0         0
Ethernet264        X        0    0.00 B/s      0.00%         0         0         0        0      0.00 B/s      0.00%         0         0         0
Ethernet272        X        0    0.00 B/s      0.00%         0         0         0        0      0.00 B/s      0.00%         0         0         0
Ethernet280        X        0    0.00 B/s      0.00%         0         0         0        0      0.00 B/s      0.00%         0         0         0

Reminder: Please execute 'show interface counters -d all' to include internal links

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

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

Tested branch (Please provide the tested image version)

  • master
  • 202405

Description for the changelog

Add quotes to tr constructs to fix command syntax

Link to config_db schema for YANG module changes

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

🦫

@bmridul
Copy link
Contributor

bmridul commented Oct 18, 2024

@prgeor @abdosi Can u pls review.

Copy link
Contributor

@prgeor prgeor left a comment

Choose a reason for hiding this comment

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

@prsunny can you also review

@kperumalbfn
Copy link
Contributor

@spilkey-cisco Why is this failing only on LCs? Is there any change in 'tr' version on LCs?

@spilkey-cisco
Copy link
Contributor Author

@spilkey-cisco Why is this failing only on LCs? Is there any change in 'tr' version on LCs?

I'm not that familiar with these test cases, so it's not totally clear to me why it's not always seen everywhere. Cisco only saw this on some LCs, and I think only in TSC. I don't see why the tr version would be different, but it could be related to that.

I did find this about a possible cause depending on what locale is set for the OS (LANG=en_US.iso-8859-1 from the following example) where the language set has differing numbers of lower vs upper case letters: https://bug-coreutils.gnu.narkive.com/gnggAFek/tr-upper-lower-misaligned-construct

Another possible explanation can be the existence of single-letter files which would require the constructs be in quotes: https://stackoverflow.com/questions/55355552/linux-tr-command-failing-misaligned-construct

Adding quotes around the constructs has no negative effect and is always recommended. Most usage in SONiC already has quotes for these constructs, these are the only ones that were missing it, so all are being fixed.

@kperumalbfn
Copy link
Contributor

/azpw

@spilkey-cisco Why is this failing only on LCs? Is there any change in 'tr' version on LCs?

I'm not that familiar with these test cases, so it's not totally clear to me why it's not always seen everywhere. Cisco only saw this on some LCs, and I think only in TSC. I don't see why the tr version would be different, but it could be related to that.

I did find this about a possible cause depending on what locale is set for the OS (LANG=en_US.iso-8859-1 from the following example) where the language set has differing numbers of lower vs upper case letters: https://bug-coreutils.gnu.narkive.com/gnggAFek/tr-upper-lower-misaligned-construct

Another possible explanation can be the existence of single-letter files which would require the constructs be in quotes: https://stackoverflow.com/questions/55355552/linux-tr-command-failing-misaligned-construct

Adding quotes around the constructs has no negative effect and is always recommended. Most usage in SONiC already has quotes for these constructs, these are the only ones that were missing it, so all are being fixed.

Thanks

@kperumalbfn
Copy link
Contributor

/azpw run

@kperumalbfn
Copy link
Contributor

/azpw run Azure.sonic-buildimage

@spilkey-cisco
Copy link
Contributor Author

@kperumalbfn any idea why one build is failing, but all others succeeded? I'm unable to view the logs, but these changes shouldn't be causing a build failure.

@kperumalbfn
Copy link
Contributor

@spilkey-cisco could you rebase your branch?

@bmridul
Copy link
Contributor

bmridul commented Nov 13, 2024

@prgeor Can u merge this. All checks have passed.

@shivuv
Copy link

shivuv commented Nov 15, 2024

MSFT Team: Can you please merge this?

@prgeor
Copy link
Contributor

prgeor commented Nov 18, 2024

@kevinskwang @yxieca can you merge this PR. I don't have permission to merge. @bmridul FYI

@kperumalbfn kperumalbfn merged commit daa5b03 into sonic-net:master Nov 18, 2024
22 checks passed
@bmridul
Copy link
Contributor

bmridul commented Nov 19, 2024

@kperumalbfn , Pls include this for 202405.

@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202405: #20976

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

Successfully merging this pull request may close these issues.

8 participants