scp fails with "protocol error: filename does not match request" : <p>I have a script that uses SCP to pull a file from a remote Linux host on AWS.  After running the same code nightly for about 6 months without issue, it started failing today with <code>protocol error: filename does not match request</code>.  I reproduced the issue on some simpler filenames below:</p>

<pre><code>$ scp -i $IDENT $HOST_AND_DIR/"foobar" .
# the file is copied successfully

$ scp -i $IDENT $HOST_AND_DIR/"'foobar'" .
protocol error: filename does not match request
# used to work, i swear...

$ scp -i $IDENT $HOST_AND_DIR/"'foobarbaz'" .
scp: /home/user_redacted/foobarbaz: No such file or directory
# less surprising...
</code></pre>

<p>The reason for my single quotes was that I was grabbing a file with spaces in the name originally.  To deal with the spaces, I had done <code>$HOST_AND_DIR/"'foo bar'"</code> for many months, but starting today, it would only accept <code>$HOST_AND_DIR/"foo\ bar"</code>.  So, my issue <em>is</em> fixed, but I'm still curious about what's going on.</p>

<p>I Googled the error message, but I don't see any real mentions of it, which surprises me.</p>

<p>Both hosts involved have <code>OpenSSL 1.0.2g</code> in the output of <code>ssh -v localhost</code>, and <code>bash --version</code> says <code>GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)</code>
Any ideas?</p>
