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

fly sftp get /path/to/base.txt should create base.txt locally #2280

Merged
merged 2 commits into from May 18, 2023
Merged

Conversation

kzys
Copy link
Member

@kzys kzys commented May 12, 2023

It was creating /path/to/base.txt locally and it is counter-intuitive.

In fact, sftp shell's get command used the remote file's basename even before this change.

kzys added 2 commits May 12, 2023 15:07
It was creating /path/to/base.txt locally and it is counter-intuitive.

In fact, sftp shell's get command used the remote file's basename even
before this change.
@kzys kzys marked this pull request as ready for review May 12, 2023 22:55
@@ -509,6 +516,10 @@ func (sc *sftpContext) get(args ...string) error {
} else {
sc.out("wrote %d bytes", bytes)
}
err = f.Sync()
if err != nil {
sc.out("failed to sync %s: %s", localFile, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we give the user more information about what happened and what to do about it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The err part should have what happened. E.g. "no space left on device" if this downloads 2GB file and the local host doesn't have the space.

"What to do about" is difficult. This error is not coming from Fly's platform. So we don't have much concrete suggestions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good.

I'd say these error messages are very normal. We tell the user "wrote %d bytes" which is technically true even if it can seem weird if the sync to disk then goes wrong. I was just wondering if we could very easily do better than "normal," while you've got a PR going already. I wonder this about most of our error messages. ;)

@catflydotio
Copy link
Contributor

I would guess not in this case, but is this change going to break anything for existing users?

@kzys
Copy link
Member Author

kzys commented May 12, 2023

I would guess not in this case, but is this change going to break anything for existing users?

Yes and some might depend this behavior. That said, at least three people were confused about and fly ssh sftp shell's get command has been taking this "take its basename" approach. So the current behavior (especially the mismatch) is too wild to keep it as is.

@catflydotio
Copy link
Contributor

I agree with your previous answer for various reasons; this was a belt-and-braces check.

@kzys kzys requested review from tqbf, billyb2 and pborzenkov May 18, 2023 18:03
Copy link
Member

@billyb2 billyb2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kzys kzys merged commit 68f8aa3 into master May 18, 2023
9 checks passed
@kzys kzys deleted the sftp-get branch May 18, 2023 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants