Repository navigation
Keep the job's locale inside QShell commands - #3565
Open
Juan-Concepcion wants to merge 1 commit into
Open
Juan-Concepcion wants to merge 1 commit into
Juan-Concepcion wants to merge 1 commit into
Conversation
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3555
Changes
sendQshstartsqshwithLC_ALL=EN_US.UTF-8in front of it. That prefix came in with #2546 to fix #2531, and it matters on the PASE side. But QShell inherits it too. QShell expects a locale object path (/QSYS.LIB/xx_XX.LOCALE), cannot resolveEN_US.UTF-8(theCPFA0A9 ... EN_US.UTF-8in the logs on #2519 is that lookup failing) and falls back to the C locale, which is CCSID 37.Some pattern characters (
| [ ] { } ^) sit at different positions in other EBCDIC code pages. On a job whose code page places them differently from 37 (273 and 280 are the two I tried), QShell reads them as the wrong bytes:grepwith more than one-eterm, or with a bracket expression, matches nothing and reports no error. That is #3555.This change leaves the PASE invocation exactly as it is and adds
unset LC_ALLas the first line of the script sent to QShell. QShell then uses the job's own locale fromLANG, the same as a QSH session on a 5250.Why this does not undo #2546: with
LC_ALLset inside QShell to theEN_US,DE_DE,IT_ITorFR_FRlocale paths, or to a value that does not exist, the bytes leavingqshwere identical every time. QShell's locale plays no part in the encoding of the output. The PASE side, which is what #2546 fixed, is untouched. The existing test that covers #2531 throughsendQsh, "Run variants through shells", passes with this change on a 37 job and on a 273 job.One visible side effect: commands that localize their output now follow the job's language, as they already do in the user's own QSH. On a German job,
dateprintedThu Dec 3 ...before andDon Dez 3 ...after. Nothing in the extension parses that output.attr -p, whichgetAttributesparses, is byte-identical before and after.How to test this PR
Test cases. Two new tests in
encoding.test.ts:I ran them against PUB400. With the change, on a job at 273, the encoding suite passes 21 of 22. Across the encoding, content and connection suites, every failure I got also happens without the change and comes from PUB400 itself: "Listing objects with variants" (PUB400 does not allow
CRTLIB), "should handle long library name" (noCREATE SCHEMA), and the two "Test runSQL" tests (a numeric column comes back as a string).In the UI. Change the profile so the job is not at 37:
Add a user action that searches a source member for two words it contains (library, file and member below are placeholders):
{ "name": "Locale probe", "command": "echo \"LC_ALL=[$LC_ALL]\"; /usr/bin/grep -c -i -F -e commit -e update /QSYS.LIB/MYLIB.LIB/QRPGLESRC.FILE/MYMBR.MBR; /usr/bin/grep -c -i -F -e commit /QSYS.LIB/MYLIB.LIB/QRPGLESRC.FILE/MYMBR.MBR; date", "extensions": ["GLOBAL"], "environment": "qsh", "type": "member" }Run it from the member's context menu. I ran it in two clean VS Code instances, one with 3.0.18 from the Marketplace and one with this PR's build:
LC_ALLinside QShell[EN_US.UTF-8][]commitorupdatecommitdateThu Dec 3 ...Don Dez 3 ...3.0.18 also shows "Action Locale probe was successful": nothing fails, the search just finds nothing. On a 37 job both builds give 4 and 2.
Restore the profile afterwards:
The profile change reaches the next action without reconnecting.
Reproducing the mechanism without the extension. On a job at 37, from QSH, a locale whose code page differs from the job is enough:
sendQshcreates the same mismatch on any job whose code page differs from 37, because QShell falls back to 37.Not tested
The setup from #2531, a system without
QIBM_PASE_CCSID. PUB400 sets it to 1208 system wide, so I could not reproduce that state. I expect no change there because the PASE side is untouched, but that is reasoning, not a test. Running the encoding suite on that system would settle it.A system that sets
LC_ALLitself at the ILE level.unsetremoves that too, but before this change the prefix overwrote it anyway, so nothing that worked stops working.Checklist
console.logs I added