zowe / zowe-explorer-vscode

Visual Studio Code Extension for Zowe, which lets users interact with z/OS Data Sets, Unix System Services, and Jobs on a remote mainframe instance. Powered by Zowe SDKs.
Eclipse Public License 2.0
173 stars 92 forks source link

Zowe Explorer fails to open a USS directory #1447

Open plavjanik opened 3 years ago

plavjanik commented 3 years ago

Describe the bug

I am trying to open my home USS directory on the mainframe using Zowe Explorer. The directory exists and is accessible via SSH and ls works without issues. I do not have issues with other directories that I have tried but my home is quite useful for me.

But when I try to open it in Zowe Explorer I get the following error:

Retrieving response from uss-file-list Error: The get request appeared to succeed, but the response was not in the expected format:
Unexpected token  in JSON at position 20774

image

To Reproduce

  1. Open a directory like mine (I am not sure what is causing it but I can provide any information that you request)
  2. You will get the message that is described above but no list of files displayed: image

Expected behavior

No error and list of files and directories displayed.

Screenshots

Above.

Desktop (please complete the following information):

Additional context

plavjanik commented 3 years ago

It might be connected to #111 that has been closed but not resolved.

lauren-li commented 3 years ago

@plavjanik Could this be due to a special character(s) in the name of a file or directory underneath your home directory? Do you get the error when you try the steps below?:

  1. Create an empty test directory with no special characters in the name (for example, a/plape03/abc).
  2. In the USS view, search for and open the directory you created in Step 1.
  3. See if error occurs.
plavjanik commented 3 years ago

Hello @lauren-li, if I create a new directory with files with just standard ASCII characters then there is no problem.

When you create a file in it using:

touch `echo "Test\001\002"`

You will get a similar problem. Note: The you need to preserve \ characters when you copy & paste it. If it is not possible in your terminal, then putting the command in a shell script will work.

plavjanik commented 3 years ago

If you want to create a file with all special characters then you can use the following script: https://gist.github.com/plavjanik/803c98271e9f9cb574580a14a8ad2d5f

lauren-li commented 3 years ago

Hi @plavjanik, thank you for the additional information!

I was trying to recreate the issue according to your steps with creating files like Test\001\002. Although my Terminal does not preserve the \ character and running the provided script creates files with spaces instead of the \-prefixed characters in the filename, I was able to use ISPF to create both directories and files with a \ in the name on z/OS.

I tested with both Zowe Explorer 1.18.0 and the newer Zowe Explorer 1.20.0, and got the same result:

Does the below screenshot resemble what you are trying to do with accessing a USS directory containing a file whose name contains the \ character?:

Screen Shot 2021-11-04 at 4 16 58 PM
plavjanik commented 3 years ago

Hello, it looks like that you have created a file that has a name the real \ in it so there is no special character.

When I run a shell script that has one command:

touch `echo "Test\001\002"`

Then it creates one file that cannot be listed in Explorer:

image

Such directory is does not expand in Explorer:

image

This is how it is displayed in USS:

$ ls
Test
$ ls -b
Test\001\002

I have prepared a script that can create more special characters: https://gist.github.com/plavjanik/803c98271e9f9cb574580a14a8ad2d5f

t1m0thyj commented 1 year ago

This is caused by z/OSMF returning a broken JSON object with invalid syntax when USS filenames contain special characters. Please upvote this RFE to request a fix in the z/OSMF REST API: https://ibm-z-hardware-and-operating-systems.ideas.ibm.com/ideas/ZOS-I-3760

JillieBeanSim commented 11 months ago

Removing from Epic as it requires an update from zosmf rest apis