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

fix 'date: illegal time format' error that occurs when the status command is executed on MacOS. #1146

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

YAMASHITAHiroki
Copy link

Description of the issue

When the amazon-cloudwatch-agent-ctl status command is executed on MacOS (x86-64) with the ja_JP locale set, it results in a 'date: illegal time format' error.

% locale
LANG="ja_JP.UTF-8"
LC_COLLATE="ja_JP.UTF-8"
LC_CTYPE="ja_JP.UTF-8"
LC_MESSAGES="ja_JP.UTF-8"
LC_MONETARY="ja_JP.UTF-8"
LC_NUMERIC="ja_JP.UTF-8"
LC_TIME="ja_JP.UTF-8"
LC_ALL=
% 
% ./packaging/darwin/amazon-cloudwatch-agent-ctl -a status
Failed conversion of ``Wed Apr 24 12:49:52 2024    '' using format ``%a %b %d %T %Y ''
date: illegal time format
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
            [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]

Description of changes

Call date with LC_ALL=C

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Tests

% locale
LANG="ja_JP.UTF-8"
LC_COLLATE="ja_JP.UTF-8"
LC_CTYPE="ja_JP.UTF-8"
LC_MESSAGES="ja_JP.UTF-8"
LC_MONETARY="ja_JP.UTF-8"
LC_NUMERIC="ja_JP.UTF-8"
LC_TIME="ja_JP.UTF-8"
LC_ALL=
%
% ./packaging/darwin/amazon-cloudwatch-agent-ctl -a status
{
  "status": "running",
  "starttime": "2024-04-24T12:49:52+0000",
  "configstatus": "configured",
  "version": "1.300035.0b547"
}

Requirements

Before commit the code, please do the following steps.

  1. Run make fmt and make fmt-sh
  2. Run make lint

@YAMASHITAHiroki YAMASHITAHiroki requested a review from a team as a code owner April 24, 2024 13:19
Copy link
Contributor

github-actions bot commented May 2, 2024

This PR was marked stale due to lack of activity.

@github-actions github-actions bot added the Stale label May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant