[gnu.bash.bug] completion on sockets

jjd@BBN.COM (James J Dempsey) (07/25/89)

I'm running on a Sun 3/60, Sun OS 4.0.3, compiled with cc and yacc.

A minor nit:

Asking bash to complete on a socket in the file system (like
/tmp/.X11-unix/X0 if you run X)  will result in bash thinking the
socket is a directory:

$ ls /tmp/.X11-unix/X0/

The offending piece of code in readline.c looks like this:


		  if ((stat (filename, &finfo) == 0) &&
		      (finfo.st_mode & S_IFDIR))
		    {
		      if (the_line[rl_point] != '/')
			rl_insert_text ("/");
		    }
		  else


Since S_IFDIR (on Sun OS) is 0040000 and S_IFSOCK is 0140000 I guess
the only thing to do is to check if st_mode is S_IFDIR and *not*
S_IFSOCK. 

		--Jim Dempsey--
		BBN Communications
		jjd@bbn.com (ARPA Internet)
                ..!{decvax, harvard, wjh12, linus}!bbn!jjd