Skip to content

ZE FileSystemProvider stat function throws the FileNotFound error for files that exist #3554

@hohy

Description

@hohy

Describe the bug

When attempting to retrieve the stats of a dataset member that is not listed in the Zowe Explorer (ZE) dataset tree, the FileNotFound error is returned, even though the file exists.
However, if the dataset is added to the tree and its members are listed, the stats are correctly retrieved.

To Reproduce

I'm using following function that I execute as a VSCode command to call the stat function of the ZE FS provider.

  public async testFSProviderStat() {
    const treeFileUri = vscode.Uri.parse(
      "zowe-ds:/zosmf/WORK.ASMMAC/TEST",
    );
    try {
      const treeFileStats = await vscode.workspace.fs.stat(treeFileUri);
      debug(
        `File stats ${treeFileUri.toString()} ${JSON.stringify(treeFileStats)}`,
      );
    } catch (err) {
      debug(
        `File stats error ${treeFileUri.toString()} ${JSON.stringify(err)}`,
      );
    }

    const notInTreeFileUri = vscode.Uri.parse("zowe-ds:/zosmf/SYS1.MACLIB/ABEND");
    try {
      const notInTreeStats = await vscode.workspace.fs.stat(notInTreeFileUri);
      debug(
        `File stats ${notInTreeFileUri.toString()} ${JSON.stringify(notInTreeStats)}`,
      );
    } catch (err) {
      debug(
        `File stats error ${notInTreeFileUri.toString()} ${JSON.stringify(err)}`,
      );
    }
  }
  1. Open VSCode with empty ZE dataset tree
  2. Run the sample code that executes vscode.workspace.fs.stat function
  3. FileNotFound is thrown for both dataset members
  4. Add the WORK.ASMMAC dataset to the ZE tree and list its members
  5. Run the test command again
  6. It returns stats for the WORK.ASMMAC/TEST member, but still throws FileNotFound error for SYS1.MACLIB/ABEND
  7. Add SYS1.MACLIB to the ZE Tree
  8. Run the command again
  9. Stats for both files are returned correctly.

Expected behavior

The stats for a dataset member should be retrievable even if the parent dataset is not listed in the ZE dataset tree. The FileNotFound error should not occur when querying existing files.

Screenshots

Desktop (please complete the following information):

  • OS: MacOS
  • Zowe Explorer Version: 3.1.2
  • (Optional) Zowe CLI Version:
  • (Optional) Are you using Secure Credential Store?

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority-mediumNot functioning - next quarter if capacity permitsseverity-mediumBug where workaround exists or that doesn't prevent the usage of Zowe. Just makes it more complex.

    Type

    No type

    Projects

    Status

    Medium Priority

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions