[Bug 2481] Tilde expansion in -i option inconsistent

bugzilla-daemon at bugzilla.mindrot.org bugzilla-daemon at bugzilla.mindrot.org
Thu Oct 22 09:37:33 AEDT 2015


https://bugzilla.mindrot.org/show_bug.cgi?id=2481

Darren Tucker <dtucker at zip.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dtucker at zip.com.au

--- Comment #1 from Darren Tucker <dtucker at zip.com.au> ---
The reason for the discrepancy is that in this case, -i doesn't do
tilde expansion, the shell does.  It only does it at the start of an
argument, and when you combine the arguments like that it doesn't
expand:

$ echo -i~/bin
-i~/bin
$ echo -i ~/bin
-i /home/dtucker/bin

This then falls foul of the file existence check inside the -i
handling:

case 'i':
        if (stat(optarg, &st) < 0) {
              fprintf(stderr, "Warning: Identity file %s "
                            "not accessible: %s.\n", optarg,
                            strerror(errno));
                        break;
                }
                add_identity_file(&options, NULL, optarg, 1);
                break;

and the key doesn't get added before the call to tilde_expand_filename
later.  We could probably fix this by adding a call to
tilde_expand_filename in the -i handling.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.


More information about the openssh-bugs mailing list