zowe / zowe-cli-ftp-plugin

Zowe CLI FTP Plugin
Eclipse Public License 2.0
16 stars 12 forks source link

upload file-to-uss-file tries to create a dataset #144

Closed eakst7 closed 10 months ago

eakst7 commented 11 months ago

Describe the bug

zowe zftp ul file-to-uss-file tries to create an MVS dataset (and might succeed) instead of a USS file when the target file does not start with a slash. Since the command is explicit about uploading to a USS file, it should not attempt to create an MVS dataset.

Expected and actual results

Details about the behavior:

  1. Issue: zowe zftp ul file-to-uss-file hello.txt hello.txt
  2. Expected behavior: The file hello.txt is created relative to the user's USS home directory or an error message indicating that the destination file must be fully qualified.
  3. Actual behavior:
    Command Error:
    SVC99 RETURN CODE=4 S99INFO=0 S99ERROR=38668 HEX=970C S99ERSN code X'000042CE'.
    Unable to create data set HELLO.TXT for STOR command.

    If the user has authority to create the dataset named HELLO.TXT, the dataset is created.

Describe your environment

I think the code eventually ends up in the zos-node-accessor module, zosAccessor.js, which calls ensureFullQualifiedDSN(destDataset), which puts single quotes around any name that does not begin with a forward slash. FTP then interprets that as a dataset name instead of a USS file name.

github-actions[bot] commented 11 months ago

Thank you for creating a bug report. We will investigate the bug and evaluate its impact on the product. If you haven't already, please ensure you have provided steps to reproduce the bug and as much context as possible.

std4lqi commented 11 months ago

Hi, @eakst7 , could you try the following?

zowe zftp ul file-to-uss-file hello.txt /u/my-user-id/hello.txt

zftp doesn't support the remote file name with the relative directory, as it doesn't provide the command to change current directory. So the absolute file path on remote z/OS USS is required.

std4lqi commented 11 months ago

Hi @eakst7 , are you OK to close this issue?

eakst7 commented 11 months ago

Hi @std4lqi , I'm ok to close if it's unlikely to be addressed.

It would preferable, though, to issue an error message if the remote path is not fully qualified, rather than trying to create a dataset.

std4lqi commented 11 months ago

Hi @eakst7, I see your point now. Let's re-evaluate it and come back to you later. Thanks!