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

Error listing Source Files Starting with Ñ #2239

Closed
rgarciale opened this issue Aug 29, 2024 · 58 comments · Fixed by #2334
Closed

Error listing Source Files Starting with Ñ #2239

rgarciale opened this issue Aug 29, 2024 · 58 comments · Fixed by #2334
Labels
bug A confirmed issue when something isn't working as intended

Comments

@rgarciale
Copy link

Type: Bug

In the new version of Code for i, 2.13.0 when navigating in the Object Browser, it is not possible to view the members of source files that start with the letter Ñ. This issue did not exist in the previous version.

Steps to Replicate the Error:

Update to the latest version of Code for i. 2.13.0
Create a source file that starts with the letter Ñ (from IBM i).
Create a member for the source file (from IBM i).
Create a filter for this source in the VS Code
Attempt to view the members of the source file that starts with Ñ from the Object Browser.

Best regards,

Extension version: 2.13.0
VS Code version: Code 1.92.2 (fee1edb8d6d72a0ddff41e5f71a671c23ed924b9, 2024-08-14T17:29:30.058Z)
OS version: Windows_NT x64 10.0.22631
Modes:

System Info
Item Value
CPUs AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx (8 x 2096)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 9.94GB (3.36GB free)
Process Argv --crash-reporter-id 587481dc-7481-4237-b6c2-fc757d6b10f8
Screen Reader no
VM 0%
@worksofliam
Copy link
Contributor

This issue did not exist in the previous version.

What version are you referring to here?

@worksofliam worksofliam added the info-needed More information is requied from the issuer label Aug 29, 2024
@rgarciale
Copy link
Author

This issue did not exist in the previous version.

What version are you referring to here?

2.12.1.

@worksofliam
Copy link
Contributor

@rgarciale What is your QCCSID and typical job CCSID or user profile CCSID?

@worksofliam
Copy link
Contributor

cc @sebjulliand possibly related to #2215. Going to try and write a test case when I get more info.

@rgarciale
Copy link
Author

@rgarciale What is your QCCSID and typical job CCSID or user profile CCSID?

User CCSID is 65535 (*sysval)
SourceFile CCSID is 284

@worksofliam
Copy link
Contributor

@rgarciale What is the QCCSID?

@rgarciale
Copy link
Author

@rgarciale What is the QCCSID?

65535

@worksofliam
Copy link
Contributor

Are you able to go back to 2.12.1, and open the member successfully? Please share the contents of your Code for IBM i output channel after the member opens. Then, please do the same with 2.13.0. Thanks!

image

@rgarciale

This comment was marked as abuse.

@worksofliam worksofliam changed the title Error with Source Files Starting with Ñ Error listing Source Files Starting with Ñ Aug 29, 2024
@worksofliam
Copy link
Contributor

worksofliam commented Aug 29, 2024

In Code for IBM i 2.12.1, I cannot create a source file with Ñ.

/home/LIAMA: /QOpenSys/usr/bin/qsh
system  "CRTSRCPF FILE(LIAMA/ÑHELLO) RCDLEN(112)"
{
    "code": 1,
    "signal": null,
    "stdout": "",
    "stderr": "CPD0012:  Characters in qualifier beginning 'ÑHELLO) RC' not valid.\nCPF0001:  Error found on *N command."
}

Are you able to do this @rgarciale?

@rgarciale
Copy link
Author

In Code for IBM i 2.12.1, I cannot create a source file with Ñ.

/home/LIAMA: /QOpenSys/usr/bin/qsh
system  "CRTSRCPF FILE(LIAMA/ÑHELLO) RCDLEN(112)"
{
    "code": 1,
    "signal": null,
    "stdout": "",
    "stderr": "CPD0012:  Characters in qualifier beginning 'ÑHELLO) RC' not valid.\nCPF0001:  Error found on *N command."
}

Are you able to do this @rgarciale?

yes I do.

/home/BCOINFRGL: /QOpenSys/usr/bin/qsh
system "CRTSRCPF FILE(LIBDREAMT/ÑPRUEBA) RCDLEN(112)"
{
"code": 0,
"signal": null,
"stdout": "",
"stderr": "CPC7301: Archivo ÑPRUEBA creado en la biblioteca LIBDREAMT.\nCPC2206: Se ha modificado la propiedad del objeto QZSHSYSTEM en QTEMP del tipo *USRSPC."
}

@worksofliam
Copy link
Contributor

@rgarciale After connecting to the system, are you able to click on the Report an Issue item and then share the contents that appear in this issue? That might help me track down some more information I need.

image

@rgarciale
Copy link
Author

@rgarciale After connecting to the system, are you able to click on the Report an Issue item and then share the contents that appear in this issue? That might help me track down some more information I need.

image

I cannot perform that action because company policies prevent me from generating the report.

Sorry for the inconvenience. :-(

@chrjorgensen
Copy link
Collaborator

@rgarciale Have you tried changing your userprofile to have CCSID 284 instead of 65535? Does that make a difference?

65535 means no conversion at all - and you need conversion of the character Ñ, which is a variant of the character # in CCSID 37 (US).

Btw, what is the reason for creating a member with a variant character in the name? These variant characters are causing a lot of problems for IBM i programmers - and it is recommended to avoid using these characters in object names, member name, variable names etc. They were typically used to indicate a special type of variable, member, object, but they are not that useful anymore in the modern world with long RPG variable names, long SQL identifiers etc.

@rgarciale
Copy link
Author

@rgarciale Have you tried changing your userprofile to have CCSID 284 instead of 65535? Does that make a difference?

65535 means no conversion at all - and you need conversion of the character Ñ, which is a variant of the character # in CCSID 37 (US).

Btw, what is the reason for creating a member with a variant character in the name? These variant characters are causing a lot of problems for IBM i programmers - and it is recommended to avoid using these characters in object names, member name, variable names etc. They were typically used to indicate a special type of variable, member, object, but they are not that useful anymore in the modern world with long RPG variable names, long SQL identifiers etc.

I will request a change of the CCSID for my user profile to run the test, as I don't have permission to modify the profile myself.

Regarding the creation of source files with the character Ñ, it happens because the PDE tool we use for source control creates them this way. :-/

Best regards, and thank you for your help! :-)

@e1mais
Copy link

e1mais commented Aug 30, 2024

Hi @chrjorgensen,

I tried this advice that you provide

@rgarciale Have you tried changing your userprofile to have CCSID 284 instead of 65535? Does that make a difference?

DSPUSRPRF USRPRF(MY USER)

The detail:

ID de juego de caracteres . . . . .: 284

But this not make any difference for me, the problem it's still happening.

Any other idea? :(

@chrjorgensen
Copy link
Collaborator

@e1mais Did you Connect and Reload Server Settings? The changed user setting is only picked up when doing this...

@e1mais
Copy link

e1mais commented Aug 30, 2024

@chrjorgensen Yes I did.

My steps:

F1 > dev:Reload window > code4i: Connect and Reload Server settings.

I also notice other thing on the tooltip when I hover the Source File name, those are named without Ñ character expand with all the information (Text, Members, Length, and the CCSID with the corresponding 284) but for those Ñ-named Source files the information is: Members: 0, Length works well, and for CCSID is ?

I attached you the tooltip info for better understanding

IMG_20240830_131509.jpg

@SoresuMasterHn
Copy link

Right, same problem hete.

@rgarciale
Copy link
Author

Hello @worksofliam, I was able to replicate the error on PUB400. These are the steps I followed to do so:

IBM i:
CHGPRF LANGID(ESP) CNTRYID(ES) CCSID(284)

image

CRTPF FILE(BCOINFRGL1/ÑTEST) RCDLEN(112) FILETYPE(*SRC) MAXMBRS(*NOMAX)
image

ADDPFM FILE(BCOINFRGL1/ÑTEST) MBR(PGM1) SRCTYPE(RPGLE)
image

WRKMBRPDM FILE(BCOINFRGL1/ÑTEST)
image

VS Code:
image

log.txt

@rgarciale
Copy link
Author

Hello, @worksofliam

It seems that the issue is with the cast char for bit data in the IBMContent.ts/getMemberList.
I removed the for bit data, and now the members are showing up.

image

image

However, the problem now is that the authority of the objects isn't changing, and they cannot be edited. I will continue investigating.

image

@sebjulliand
Copy link
Collaborator

@rgarciale I'd like to check something. Could you connect to your LPAR and click on Report an issue?
image

It will open a new issue template in your browser. Copy and paste the template here, I'd like to see some details about your LPAR. Thanks!

@rgarciale
Copy link
Author

@sebjulliand. Sure,

👉🏻 Issue text goes here.


⚠️ REMOVE THIS LINE AND ANY SENSITIVE INFORMATION BELOW! ⚠️

Context Version
Code for IBM i version 2.13.0
Visual Studio Code version 1.93.0
Operating System win32_x64
Active extensions
COBOL (cobol): 10.8.31
Code for IBM i Walkthroughs (vscode-ibmi-walkthroughs): 0.5.0
Configuration Editing (configuration-editing): 1.0.0
Db2 for IBM i (vscode-db2i): 1.3.1
ESLint (vscode-eslint): 3.0.10
Emmet (emmet): 1.0.0
Error Lens (errorlens): 3.20.0
Extension Authoring (extension-editing): 1.0.0
Git (git): 1.0.0
Git Base (git-base): 1.0.0
GitHub (github): 0.0.1
GitHub Authentication (github-authentication): 0.0.2
IBM i Debug (ibmidebug): 2.0.1
JSON Language Features (json-language-features): 1.0.0
Merge Conflict (merge-conflict): 1.0.0
NPM support for VS Code (npm): 1.0.1
Node Debug Auto-attach (debug-auto-launch): 1.0.0
TODO Highlight (vscode-todo-highlight): 1.0.5
TypeScript and JavaScript Language Features (typescript-language-features): 1.0.0

Remote system
Setting Value
IBM i OS V7R5M0
Tech Refresh n/a
CCSID Origin 273
Runtime CCSID 273
Default CCSID 273
SQL Enabled
Source dates Disabled

Enabled features

/QOpenSys/pkgs/bin /usr/bin /QSYS.LIB /QIBM/ProdData/IBMiDebugService/bin
bash attr QZDFMDB2.PGM startDebugService.sh
chsh iconv
find setccsid
git
grep
ls
md5sum
sort
stat
tar
tn5250
Shell env
BUILDLIB=BCOINFRGL1
CURLIB=BCOINFRGL1
HOME=/home/BCOINFRGL
HOST=PUB400.COM
LIBLS=GAMES400 QTEMP QGPL
LOGIN=bcoinfrgl
LOGNAME=bcoinfrgl
MAIL=/var/spool/mail/bcoinfrgl
OLDPWD=/home/BCOINFRGL
PASE_USRGRP_LIMITED=N
PATH=/QOpenSys/pkgs/bin:/QOpenSys/usr/bin:/usr/ccs/bin:/QOpenSys/usr/bin/X11:/usr/sbin:.:/usr/bin:/QOpenSys/usr/bin:/usr/bin
PWD=/home/BCOINFRGL
SHELL=/QOpenSys/pkgs/bin/bash
SHLVL=1
SSH_CLIENT=186.26.118.186 35999 2222
SSH_CONNECTION=186.26.118.186 35999 185.113.5.134 2222
TZ=<UTC>0
USER=bcoinfrgl
USERNAME=BCOINFRGL
WORKDIR=/home/BCOINFRGL
_=/QOpenSys/pkgs/bin/env
Variants
{
  "american": "#@$",
  "local": "#§$"
}
Errors
[
  {
    "command": "/QOpenSys/usr/bin/qsh",
    "code": 1,
    "stderr": "CPD0012:  Characters in qualifier beginning 'ÑRPGLESRC)' not valid.\nCPF0001:  Error found on *N command.",
    "cwd": "/home/BCOINFRGL"
  },
  {
    "command": "cd \"/QSYS.LIB/BCOINFRGL1.LIB/ÑRPGLESRC.FILE\" && (ls | wc -l)",
    "code": 1,
    "stderr": "bash: line 1: cd: $'/QSYS.LIB/BCOINFRGL1.LIB/\\303\\221RPGLESRC.FILE': No such file or directory",
    "cwd": "/home/BCOINFRGL"
  },
  {
    "command": "/QOpenSys/usr/bin/qsh",
    "code": 1,
    "stderr": "CPD0012:  Characters in qualifier beginning 'ÑTEST) OBJ' not valid.\nCPF0001:  Error found on *N command.",
    "cwd": "/home/BCOINFRGL"
  }
]

@rgarciale
Copy link
Author

@sebjulliand

I have been doing some testing and have found the following:

When commands are executed directly from qsh, the objects are displayed with the # character.
For example:
image

However, when the command is executed from DB2, the objects are listed with the Ñ character. It seems this is causing some issues.

image
image

@sebjulliand
Copy link
Collaborator

There is an issue with the variant characters here. I assume that the issue template you sent was taken from PUB400, and not the LPAR your issue originated from.

image

As you can see, the LPAR CCSID is 273, and Ñ is not handled there because it's not a valid object name character with this CCSID.
Ñ is CCSID 284 variant of # and that's why it can be used when the job CCSID is 284.

I tried your use case above on PUB400, and it failed, as expected. But more importantly, I noticed the variant characters were still CCSID 273's, and not 284's, even after changing my profile's CCSID and reloading the settings.
image

All I can assume for now is:

  • variant characters are messing with some of our queries
  • if system variable QCCSID is set to something else than 65535, then variant characters are not loaded for the user's CCSID but for QCCSID's value

My guess here is that if:

  • the LPAR QCCSID is set to 284
  • OR if it is set to 65535 and your user profile's CCSID is 284

Then having Ñ in object names should be OK.
Otherwise, welcome to CCSID's hell 😁

@rgarciale
Copy link
Author

rgarciale commented Sep 20, 2024

Hello @sebjulliand

I managed to get it working. I made the following change, and now I can see the sources and modify them. Obviously, it's not a real fix, but maybe this’ll help fix the issue.

image

image

image

image

And yeah, CCSID is a total pain ;-D

@rgarciale
Copy link
Author

Hello, @worksofliam @sebjulliand @chrjorgensen

I finally found the error.

The problem is not exclusive to the "Ñ" character. It happens when there is a character conversion due to the LPAR configuration between variantChars.american and variantChars.locale

For example, in PUB400, the "@" character has a conversion:

Variants
{
  "american": "#@$",
  "local": "#§$"
}

The issue arises when listing the objects using the getObjectList function, as they are listed in local format.

However, when retrieving members using getMemberList, the object filter is passed through the sysNameInAmerican function, which causes the members not to be listed correctly.

"I created a source that starts with @ in my library."

image

When I view it in VS Code, it appears in the LPAR format.

image

But when trying to retrieve the members, they are processed using the variantChars.american format

image

And it doesn't display anything.

image

To fix the issue, I modified the functions getObjectList and getMemberList so that when listing the members, it does not convert them in american format.

getObjectList
image
image

getMemberList
image

And now it works as it should.

image

Can this solution be implemented to fix the problem with character conversion?

@worksofliam
Copy link
Contributor

@rgarciale @hn000246

I have a vsix available for testing: #2334 (comment)

@worksofliam worksofliam added bug A confirmed issue when something isn't working as intended and removed info-needed More information is requied from the issuer labels Nov 12, 2024
@rgarciale
Copy link
Author

@rgarciale @hn000246 Are either of you able to share the following with us:

  • Any variables in WRKENVVAR *SYS
  • Any variables in WRKENVVAR *JOB
  • The result of the set command in a PASE/bash shell.

Hi @worksofliam, at the moment I no longer have access to the LPAR :-(, maybe @hn000246 can help us with this one ;-)

@rgarciale
Copy link
Author

@rgarciale @hn000246

I have a vsix available for testing: #2334 (comment)

@worksofliam, Great news! I’m going to download it and ask a friend with access to the LPAR where the error occurred to test it ;-)

@worksofliam
Copy link
Contributor

@rgarciale Make sure when you test it: you right click on the connection and use 'Connect and Reload'!

@worksofliam
Copy link
Contributor

@rgarciale @hn000246

We've shipped a pre-release with a fix, and you can switch to the 'pre-release'. When using the new release, before connecting to your server, please right click on your server and use 'Connect and Reload Server Settings'.

image

@worksofliam
Copy link
Contributor

@rgarciale @hn000246 Once again, we have shipped a new pre-release: 2.13.8 - please try this out and let me know how it goes.

@worksofliam
Copy link
Contributor

worksofliam commented Nov 18, 2024

@hn000246 Can you share what version of Code for IBM i you're using?

Using 2.13.8 pre-release, I can see a working filter

image

@codefori codefori deleted a comment from e1mais Nov 18, 2024
@worksofliam
Copy link
Contributor

@hn000246 Did you switch to the pre-release 2.13.8 and tested that?

@worksofliam
Copy link
Contributor

@hn000246 Please try the pre-release (2.13.8) and try the Object Browser again:

Screenshot 2024-11-18 at 2 23 40 PM

@worksofliam
Copy link
Contributor

After the list does not load, can you please share the output from the Output tab, under Code for IBM i? It will be a lot of data, so please save into a text file and send that.

Screenshot 2024-11-18 at 2 30 43 PM

@codefori codefori deleted a comment from SoresuMasterHn Nov 18, 2024
@worksofliam
Copy link
Contributor

@hn000246 Thank you! I think I have found the issue. I will get back to you soon.

@worksofliam
Copy link
Contributor

@hn000246 2.13.15 is now available which has additional fixes. Give it a go and let me know of your findings.

@worksofliam
Copy link
Contributor

worksofliam commented Nov 19, 2024

@hn000246 We need the logs like before after you try and open the filter.

image

@worksofliam
Copy link
Contributor

@hn000246 You need to set the CCSID of your user profile correctly going forward. This has always been a requirement, but now we warn you: https://codefori.github.io/docs/tips/ccsid/

@worksofliam
Copy link
Contributor

@hn000246 I am just looking into it. Thanks!

@worksofliam
Copy link
Contributor

@hn000246 Can you please try this:

Before connecting to your system, right click on your system and use 'Connect and reload' and then try again?

Thanks!

@worksofliam
Copy link
Contributor

@hn000246 Can you please share logs after you Connect and Reload Server Settings?

@worksofliam
Copy link
Contributor

@hn000246 Any chance you can run this SQL statement and tell me the result?

Thanks!

with SSH_DETAIL (id, iid) as (       select substring(job_name, locate('/', job_name, 15)+1, 10) as id, internal_job_id as iid from qsys2.netstat_job_info j where local_address = '0.0.0.0' and local_port = 22     )     select DEFAULT_CCSID, CCSID from table(QSYS2.ACTIVE_JOB_INFO( JOB_NAME_FILTER => (select id from SSH_DETAIL), DETAILED_INFO => 'ALL')) where INTERNAL_JOB_ID = (select iid from SSH_DETAIL)

@worksofliam
Copy link
Contributor

@hn000246 How about this?

Select DEFAULT_CCSID From Table(QSYS2.ACTIVE_JOB_INFO( JOB_NAME_FILTER => '*', DETAILED_INFO => 'ALL' ))

@worksofliam
Copy link
Contributor

@hn000246 I've just pre-released 2.13.16. Please give that a try and let me know how it goes.

@worksofliam
Copy link
Contributor

@hn000246 i need the logs from you please!

@worksofliam
Copy link
Contributor

@hn000246 I've just pre-released, can you try 2.13.17?

@worksofliam
Copy link
Contributor

@hn000246 I have found the issue. Will let you know when it's ready

@worksofliam
Copy link
Contributor

@hn000246 2.13.19 has been pre-released. Please give that a try soon!

@worksofliam
Copy link
Contributor

We believe to have solved this issue. You can switch to the pre-release to try the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A confirmed issue when something isn't working as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants