Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

SCPing a file to a server running fish fails when config.fish prints anything #623

Closed
robacarp opened this Issue · 5 comments

3 participants

@robacarp

In my fish config, I have this little bit of logic that takes care of some command incompatibilities between OS X's bsd ls and a Debian ls:

https://github.com/robacarp/config_files/blob/master/.config/fish/config.fish#L13

Through some poking at a problem I was having using SCP to copy to a remote server using the same config file, I found out that something about printing from a config.fish on a remote host causes the scp transfer to fail silently.

@ridiculousfish

Very strange. Why would scp do an interactive login anyways?

@robacarp

Well, that was my thought.

I vaguely remember some logic in a bashrc I wrote one that had a early exit if it detected it was being included non-interactively.

Nothing strange from the scp command, just the basic scp file remote:~ stuff.

@xfix
Collaborator

This also happens with bash, in case you don't know. It's because scp is a failure that expects you to be insane (sadly). See http://www.openssh.org/faq.html#2.9. You could try moving part that outputs stuff to fish_greeting function, it's automatically ran only in interactive mode. Or checking whatever you are using following snippet.

if status --is-login
    echo Hello, world!
end

If anything shows when you run ssh ssh-server /bin/true, something is wrong, and SCP and SFTP will break badly.

Technically, fish could redirect entire output of init script when running it non-interactively to /dev/null, but that would be annoying when you really would want to print something. bash doesn't do that anyway, so it has similar issues with .bashrc.

@ridiculousfish

Thanks very much for the explanation GlitchMr.

(Your second sentence made me laugh.)

@robacarp

Indeed, thanks for the explanation and the code sample.

@robacarp robacarp closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.