command/hook_ui: Truncate the ID considering multibyte characters#18823
command/hook_ui: Truncate the ID considering multibyte characters#18823pselle merged 1 commit intohashicorp:masterfrom
Conversation
|
Hi @minamijoyo, This commit touches a section of terraform that is being reworked as part of terraform 0.12, so if it's okay with you I'd prefer to wait and fix this in that release, mainly to avoid accidentally losing the work you've done when we merge in the 0.12 development branch. Thanks again for investigating and proposing a fix for this, especially with tests! |
|
@mildwonkey No problem. I'm looking forward to v0.12! |
|
@mildwonkey Now, this bug fix branch seems not to conflict with the latest master. Please review and merge when you can. Thanks! |
Fixes hashicorp#18822 The `tuncatedId` function had been introduced in hashicorp#12261 and increased the `maxIdLen` to 80 in hashicorp#13317. Since the number of bytes itself seems to be unimportant, the ID should be truncated to 80 characters, not 80 bytes.
b0a26da to
33e1839
Compare
|
@mildwonkey I rebased this PR on the master branch and confirmed that the test passed, but when I tried to reproduce the original issue reported in #18822 with With the change of v0.12, it seems that the Line 205 in 33e1839 I think there is still meaning to fix this bug at the moment. However, the current code base seems to be a somewhat inconsistent behavior in |
pselle
left a comment
There was a problem hiding this comment.
@minamijoyo 👋 It does seem that this code is still touched when stillApplying runs, and that is the only case where truncateId is used. I've opened a separate PR #22357 investigating that I'm not seeing the section populated consistently, and am still digging into it, but once I was able to get them displaying (...mostly) I was able to test your fix. Thank you for helping make Terraform more inclusive of other languages!
|
@pselle Thanks! |
|
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Fixes #18822
The
tuncatedIdfunction had been introduced in #12261 and increased themaxIdLento 80 in #13317.Since the number of bytes itself seems to be unimportant, the ID should be truncated to 80 characters, not 80 bytes.
Please let me know if we need to truncate it to 80 bytes considering multibyte character boundaries. This will require more complex logic.