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

[CBRD-25756] Update initialization method for 'lang_str' #5741

Merged
merged 3 commits into from
Jan 6, 2025

Conversation

H2SU
Copy link
Contributor

@H2SU H2SU commented Dec 26, 2024

http://jira.cubrid.org/browse/CBRD-25756

Purpose

  • 문제 원인
    • http://jira.cubrid.org/browse/CBRD-25302 해당 이슈에서 lang_string의 checksum을 확인하여 일치하지 않는 경우
      에러를 return하도록 수정
    • cdc_put_value_to_loginfo 함수에서 lang_str을 초기화 할 때 0으로 초기화를 해주고 있기 때문에
      checksum이 일치하지 않아 에러가 발생
    • 에러가 return 되어 NULL로 초기화된 result에 아무 데이터도 담기지 않음
    • 그렇기 때문에 strncpy (line, db_get_string (&result), line_length); 구문에서 segmentation fault가 발생하여 core파일 생성

주요 함수 및 변수

  • char *lang_str = NULL
    • lang_str이 NULL이라면 lang_set_flag_from_lang 함수에 의해 default(en_US)로 설정된다
    • en_US / ko_KR / tr_TR 등을 의미한다.
  • has_user_format, has_user_lang
    • CDC loginfo 생성과정에서 사용자가 format이나 lang을 입력하지 않기 때문에 false로 설정
    • 기존 스펙에서 사용자가 따로 lang_str을 설정하지 않았었기 때문에 default(en_US)로 설정된다.
  • lang_set_flag_from_lang (lang_str, has_user_format, has_user_lang, &flag);
    • lang_str을 읽어 flag 설정
    • checksum 추가
  • db_make_int (&lang_val, flag);
    • flag를 기반으로 lang_val 생성

Implementation

  • lang_val 변수 추가 및 초기화 방식 변경
  • db_to_char 에러 처리 추가

@H2SU H2SU self-assigned this Dec 26, 2024
@H2SU H2SU requested a review from hornetmj as a code owner December 26, 2024 10:17
@hornetmj
Copy link
Contributor

@H2SU lang_string이 무엇인가요?

@H2SU
Copy link
Contributor Author

H2SU commented Dec 27, 2024

@H2SU lang_string이 무엇인가요?

lang_string은 en_US , ko_KR과 같은 locale을 이야기합니다.

@H2SU H2SU marked this pull request as draft December 27, 2024 11:03
@H2SU H2SU marked this pull request as ready for review December 27, 2024 11:26
db_make_int (&lang_str, 1);
db_make_null (&result);

lang_set_flag_from_lang (lang_str, has_user_format, has_user_lang, &flag);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
lang_set_flag_from_lang (lang_str, has_user_format, has_user_lang, &flag);
lang_set_flag_from_lang (NULL, false, false, &flag);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

수정하였습니다.

Comment on lines 13609 to 13610
bool has_user_format = false;
bool has_user_lang = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bool has_user_format = false;
bool has_user_lang = false;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

수정하였습니다.

const char *src, *end;
char *lang_str = NULL;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
char *lang_str = NULL;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

수정하였습니다.

@@ -13626,8 +13631,9 @@ cdc_put_value_to_loginfo (db_value * new_value, char **data_ptr)
const char *timestamp_frmt = "YYYY-MM-DD HH24:MI:SS";
const char *timestamptz_frmt = "YYYY-MM-DD HH24:MI:SS TZH:TZM";
const char *timestampltz_frmt = "YYYY-MM-DD HH24:MI:SS TZR";
db_make_int (&lang_str, 1);
db_make_null (&result);
Copy link
Contributor

Choose a reason for hiding this comment

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

db_make_null (&result); 제거는 의도된 것인가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

수정하였습니다.

@H2SU H2SU requested a review from hornetmj January 6, 2025 04:56
@H2SU H2SU force-pushed the CBRD-25756 branch 2 times, most recently from d779a8d to 4c47c38 Compare January 6, 2025 05:55
@hornetmj hornetmj merged commit 2e7cad9 into CUBRID:develop Jan 6, 2025
14 of 15 checks passed
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.

5 participants