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

sftp server implementation #46

Merged
merged 43 commits into from
Sep 9, 2015
Merged

Conversation

marksheahan
Copy link
Contributor

Mostly tested through integration tests, by using the client package and comparing behavior to the openssh sftp server.

Part of the server implementation of readdir involves implementing unix group lookup; gid -> groupname conversion for 'ls -l' style output. This is the user/ directory, which is os/user with this patchset applied: https://codereview.appspot.com/13454043

@davecheney
Copy link
Member

@marksheahan this looks awesome! Thank you for this.

I'll have a read through the diff later today, could you please fix the small build error.

Ta

@@ -312,6 +336,25 @@ func (c *Client) ReadLink(p string) (string, error) {
}
}

// Symlink creates a symbolic link at 'newname', pointing at target 'oldname'
Copy link
Member

Choose a reason for hiding this comment

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

This should be called Link, for compatibility with the os package, http://godoc.org/os#Link

You can do this in a followup if you like.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

os.Link() creates a hard link, not a soft link. This name was chosen for consistency with os.Symlink:
https://golang.org/pkg/os/#Symlink

Copy link
Member

Choose a reason for hiding this comment

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

My apologies, this was my mistake

On 8 Sep 2015, at 14:11, Mark Sheahan notifications@github.com wrote:

In client.go:

@@ -312,6 +336,25 @@ func (c *Client) ReadLink(p string) (string, error) {
}
}

+// Symlink creates a symbolic link at 'newname', pointing at target 'oldname'
os.Link() creates a hard link, not a soft link. This name was chosen for consistency with os.Symlink:
https://golang.org/pkg/os/#Symlink


Reply to this email directly or view it on GitHub.

@davecheney
Copy link
Member

Thanks. A bunch more comments and nits.

To get this landed as quickly as possible I want to encourage you to pull out anything that is controversial and handle it as a followup.

@marksheahan
Copy link
Contributor Author

Working on deleting the user/ dir, and the other items. Thanks for the quick review turnaround!

.*.swo
.*.swp

testdata/
Copy link
Member

Choose a reason for hiding this comment

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

the go tool ignores testdata, please remove this line

if something is writing into testdata/ let's fix that in a followup

@davecheney
Copy link
Member

LGTM. I've sent you an invitation to collaborate on the sftp repository, when you're happy, please submit this. Let's tackle the other changes that I asked to be deferred in follow up PRs.

Thanks again for this big improvement, this was a large hole in the package.

@marksheahan
Copy link
Contributor Author

Just got nervous before committing, wrote a few more tests and found a bug. I'll add a recursive put and get test; once those pass I'll be happy with it.

@davecheney
Copy link
Member

Cool. We can always land more pull requests after this one, you don't need
to eat the entire elephant in one sitting.

On Wed, Sep 9, 2015 at 10:11 AM, Mark Sheahan notifications@github.com
wrote:

Just got nervous before committing, wrote a few more tests and found a
bug. I'll add a recursive put and get test; once those pass I'll be happy
with it.


Reply to this email directly or view it on GitHub
#46 (comment).

.*.swo
.*.swp

server_standalone/server_standalone
Copy link
Member

Choose a reason for hiding this comment

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

you can probably delete this as well, this would only happen if you did go build in the server_standalone directory

Copy link

Choose a reason for hiding this comment

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

Not that .gitignore files need to be filled with thousands of lines of junk. Assumedly including 'server_standalone/server_standalone' is useful during development?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I did my integration tests that way. I probably could have used go install but it's just habit...

Copy link
Member

Choose a reason for hiding this comment

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

It's your call, doesn't really matter much each way, i'm just finding
things to nit pick while you land your change.

On Wed, Sep 9, 2015 at 3:06 PM, Mark Sheahan notifications@github.com
wrote:

In .gitignore #46 (comment):

@@ -0,0 +1,5 @@
+..swo
+.
.swp
+
+server_standalone/server_standalone

Yes, I did my integration tests that way. I probably could have used go
install but it's just habit...


Reply to this email directly or view it on GitHub
https://github.com/pkg/sftp/pull/46/files#r39007718.

marksheahan added a commit that referenced this pull request Sep 9, 2015
@marksheahan marksheahan merged commit aee0f78 into pkg:master Sep 9, 2015
@marksheahan marksheahan deleted the sftpserver branch January 26, 2016 18:15
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.

2 participants