Skip to content
This repository was archived by the owner on Mar 30, 2022. It is now read-only.

ReceiveDir panic when trying to copy a file that link to a deleted one #10

Open
meliot opened this issue Apr 15, 2018 · 1 comment
Open

Comments

@meliot
Copy link

meliot commented Apr 15, 2018

As title said, ReceiveDir panic when I try to SCP a directory that contains link to files that no longer exists.

The code that perform the call is the following:

func ReceiveDir (srcDir string, outDir string) {
	err := scp.NewSCP(connection).ReceiveDir(srcDir, outDir, nil)
	if err != nil {
		log.Fatal("Unable to SCP directories: ", err)
        }
}

The error I get is:
2018/04/15 18:52:10 Unable to SCP directories: failed to read scp message header: err=failed to read scp start directory message header: err=newline in format does not match input

So I suppose the problem lies in this Fscanf: https://github.com/hnakamur/go-scp/blob/master/protocol.go#L213

I think the library should by default, or with a flag, ignore links to death files.

@hnakamur
Copy link
Owner

Sorry for being late.
I tried to reproduce the problem at 298399d, but I got a different error.

sink_test.go:224: fail to ReceiveDir; failed to read scp message header: err=scp: /tmp/go-scp-TestReceiveDir-remote868529785/dead-link: No such file or directory

Could you tell me how to reproduce your problem? The vresion of sshd, OS, and distribution might help.
Or could you write the failing test?

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants