Commit Graph

7 Commits

Author SHA1 Message Date
Cassondra Foesch 861a8eaf5c pointer receivers and statusFromError(uint32, error) 2021-02-22 12:11:42 +00:00
Nicola Murino 5dbfeffd12 request-server: add StatVFS support 2021-02-10 19:13:19 +01:00
John Eikenberry 1afc1d9a78 refactor server response to allow for extending
Instead of sendPacket/sendError being sprayed all over the place, this
change has all those places instead return a responsePacket (eventually)
back to the main handling function which then calls sendPacket in one
place.

Behaviour of the code should remain exactly the same.

This makes it much easier to work with the response packets (eg. for the
packet ordering issue I'm working on).
2018-07-25 15:01:43 -07:00
Tamir Duberstein 83a859a04e Remove gccgo special cases
This was fixed in a different way in 4d0e916.
2018-02-02 15:01:09 -05:00
Eric Garrido a71e8f580e Fix build directive to properly compile under gccgo in Linux (#126)
Before this fix:

eric@workstation:~/go/src/github.com/pkg/sftp$ /opt/gccgo/bin/go test
client.go:12:2: cannot find package "github.com/kr/fs" in any of:
        /opt/gccgo/src/github.com/kr/fs (from $GOROOT)
        ($GOPATH not set)
client.go:13:2: cannot find package "github.com/pkg/errors" in any of:
        /opt/gccgo/src/github.com/pkg/errors (from $GOROOT)
        ($GOPATH not set)
client.go:14:2: cannot find package "golang.org/x/crypto/ssh" in any of:
        /opt/gccgo/src/golang.org/x/crypto/ssh (from $GOROOT)
        ($GOPATH not set)
eric@workstation:~/go/src/github.com/pkg/sftp$ export GOPATH=/home/eric/go
eric@workstation:~/go/src/github.com/pkg/sftp$ /opt/gccgo/bin/go test
./server_statvfs_stubs.go:9:1: error: redefinition of ‘respond’
 func (p sshFxpExtendedPacketStatVFS) respond(svr *Server) error {
 ^
./server_statvfs_impl.go:12:1: note: previous definition of ‘respond’ was here
 func (p sshFxpExtendedPacketStatVFS) respond(svr *Server) error {
 ^
./server_statvfs_impl.go:18:17: error: reference to undefined name ‘statvfsFromStatfst’
  retPkt, err := statvfsFromStatfst(stat)
                 ^
go1: internal compiler error: in do_get_backend, at go/gofrontend/statements.cc:476
0x67d1b3 Temporary_statement::do_get_backend(Translate_context*)
        ../../gccgo/gcc/go/gofrontend/statements.cc:476
0x64b9d0 Block::get_backend(Translate_context*)
        ../../gccgo/gcc/go/gofrontend/gogo.cc:5816
0x67a4cc Block_statement::do_get_backend(Translate_context*)
        ../../gccgo/gcc/go/gofrontend/statements.cc:1836
0x64b9d0 Block::get_backend(Translate_context*)
        ../../gccgo/gcc/go/gofrontend/gogo.cc:5816
0x67a556 If_statement::do_get_backend(Translate_context*)
        ../../gccgo/gcc/go/gofrontend/statements.cc:3213
0x64b9d0 Block::get_backend(Translate_context*)
        ../../gccgo/gcc/go/gofrontend/gogo.cc:5816
0x67a4cc Block_statement::do_get_backend(Translate_context*)
        ../../gccgo/gcc/go/gofrontend/statements.cc:1836
0x64b9d0 Block::get_backend(Translate_context*)
        ../../gccgo/gcc/go/gofrontend/gogo.cc:5816
0x64c3cb Function::build(Gogo*, Named_object*)
        ../../gccgo/gcc/go/gofrontend/gogo.cc:5422
0x64ca17 Named_object::get_backend(Gogo*, std::vector<Bexpression*, std::allocator<Bexpression*> >&, std::vector<Btype*, std::allocator<Btype*> >&, std::vector<Bfunction*, std::allocator<Bfunction*> >&)
        ../../gccgo/gcc/go/gofrontend/gogo.cc:7140
0x655ac9 Gogo::write_globals()
        ../../gccgo/gcc/go/gofrontend/gogo.cc:1262
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
FAIL    github.com/pkg/sftp [build failed]

After this fix:

eric@workstation:~/go/src/github.com/pkg/sftp$ /opt/gccgo/bin/go test
PASS
ok      github.com/pkg/sftp     0.093s

and, under gc Go:

eric@workstation:~/go/src/github.com/pkg/sftp$ /home/eric/src/go/bin/go test
PASS
ok      github.com/pkg/sftp     0.005s
2016-07-22 09:14:53 +10:00
Dave Cheney 4c7551ad7e Refactor all the calls to sendPacket(statusFromError(...)) to a sendError helper (#114)
* statusFromError now takes a type with an id() uint32 method

* Introduce sendError

Refactor all the calls to sendPacket(statusFromError(...)) to a
sendError helper.
2016-06-14 21:11:15 +10:00
Mark Sheahan 9ff4de5c31 add serverside StatVFS function, implemented for darwin and linux (#89) 2016-06-13 14:45:13 +10:00