This was targed at --current, but should apply against 3.1p1 without too much hassle since that code is pretty much unchanged. This patch implemented the following: 1. Command line completion (for those too lazy to type 5 letters at max =) 2. Local file name completion 3. Remote file name completion This patch does not contain the needed configure.ac logic to detect if readline/curses exist. I'll add that if/when it is approved. This patch is against the protable tree. I have an OpenBSD patch (on demand), but the differences are extremely small (Mainly API renaming issues due to readline library versions). It would be nice if we could find a NetBSD hanging around to test it against their libedit which has readline API implemented. FYI1, over SLOW connections a <tab><tab> filelisting may take some time. Since sftp does not cache remote globing. That should be fixed in a seperate patch. FYI2, this can/will be a compile time option so it is not a required dependancy. Enjoy, - Ben
Created attachment 59 [details] Patch Discussed above
sadly enough.. Setting Assign To: is a sure fire way of a report not hitting the main list unless you add a cc:
I tried it on NetBSD/sparc 1.5.2. The first problem was obvious: gcc [flags] -c sftp-int.c sftp-int.c:32: readline/readline.h: No such file or directory sftp-int.c:33: readline/history.h: No such file or directory *** Error code 1 readline.h and history.h are in /usr/include/. Fixing that and moving on, I got gcc [flags] -c sftp-int.c sftp-int.c: In function `rl_remote_match': sftp-int.c:901: `rl_completion_append_character' undeclared (first use in this function) sftp-int.c:901: (Each undeclared identifier is reported only once sftp-int.c:901: for each function it appears in.) sftp-int.c: In function `rl_remote_list': sftp-int.c:930: warning: implicit declaration of function `rl_display_match_list' sftp-int.c:931: warning: implicit declaration of function `rl_forced_update_display' sftp-int.c: In function `glob_match': sftp-int.c:942: `rl_completion_display_matches_hook' undeclared (first use in this function) sftp-int.c:948: warning: implicit declaration of function `rl_filename_completion_function' sftp-int.c:948: warning: assignment makes pointer from integer without a cast sftp-int.c: In function `sftp_completion': sftp-int.c:986: warning: implicit declaration of function `rl_completion_matches' sftp-int.c:986: warning: assignment makes pointer from integer without a cast sftp-int.c: In function `interactive_loop': sftp-int.c:1080: warning: assignment from incompatible pointer type *** Error code 1 libedit doesn't seem to have either of rl_completion_append_character or rl_completion_display_matches_hook.
NetBSD is wrong in not putting it in <readline/*.h>. Even their CVS tree admits to it: "Standard location of readline headers is /usr/include/readline/, so install them there. readline.h of libedit had to move to subdirectory 'readline', due to the way BSD makefiles work; this is better than potentially fragile Makefile hacks" Hmm.. From readline.h on NetBSD (cvs) extern int rl_completion_append_character; No history.h (looks like history.h and readline.h were merged.. BAD NetBSD, BAD). But rl_completion_display_matches_hook looks like it needs to be fleshed out in libedit unless someone can tell me a more portable way of handling glob_match() when switching between local, remote, and no globing support. I should grab the OpenBSD patch that was recently submited, but not commited yet.
I don't know why this was changed
Created attachment 1428 [details] Final Version Latest and Greatest.. and final sftp tab completion patch. Since OpenSSH moved to libedit with readline like API. The following attachment is the final version of the tab completion patch. This version is being submitting for approval to openssh@ list.
I'm not sure if we will finish this before 5.1, but it should at least be on the list.
only changes to portable OpenSSH are being considered for 5.3 at this stage.
Created attachment 1743 [details] /home/djm/sftp-autocomplete.diff Heavily revised autocompletion diff. Hacked on by myself, mouring, Carlos Silva (via 2009 Google Summer of Code) and polished to a fine sheen by myself again. It should deal more-or-less correctly with the ikky corner-cases presented by quoted filenames, but the UI could still be slightly improved.
committed! this will be in openssh-5.4
With the release of 5.4p1, this bug is now considered closed.