* completion ignoring @ 1998-05-22 15:01 Timothy J Luoma 1998-05-22 15:22 ` Matthew Lovell ` (2 more replies) 0 siblings, 3 replies; 18+ messages in thread From: Timothy J Luoma @ 1998-05-22 15:01 UTC (permalink / raw) To: zsh-users I've recently started using Emacs RCS for some scripts. The problem is that I'm getting the comma-v and the backup files when I go to do tab completion: # mkt[tab] mktargz mktargz,v mktargz.~1~ Is there a way to make completion ignore files that end with ,v and .~1~ ?? If so, how and if not, when ;-? Thanks TjL ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: completion ignoring 1998-05-22 15:01 completion ignoring Timothy J Luoma @ 1998-05-22 15:22 ` Matthew Lovell 1998-05-22 15:23 ` Andrew Main 1998-05-22 15:32 ` Bruce Stephens 2 siblings, 0 replies; 18+ messages in thread From: Matthew Lovell @ 1998-05-22 15:22 UTC (permalink / raw) To: Timothy J Luoma; +Cc: zsh-users On 22 May 1998, Timothy J Luoma writes: > > I've recently started using Emacs RCS for some scripts. > > The problem is that I'm getting the comma-v and the backup files when I go > to do tab completion: > > # mkt[tab] > mktargz mktargz,v mktargz.~1~ > > Is there a way to make completion ignore files that end with ,v and .~1~ ?? > If so, how and if not, when ;-? Try something similar to this... # filename completion suffixes to ignore fignore=(.o .c~ .old .pro \~) -- Matthew Lovell voice: (970) 898-6264 Hewlett-Packard FSL fax: (970) 898-2510 3404 E. Harmony Rd. MS A0 location: 3UR4 Fort Collins, CO 80528-9599 mailto:lovell@fc.hp.com ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: completion ignoring 1998-05-22 15:01 completion ignoring Timothy J Luoma 1998-05-22 15:22 ` Matthew Lovell @ 1998-05-22 15:23 ` Andrew Main 1998-05-22 15:34 ` Timothy J Luoma 1998-05-22 15:32 ` Bruce Stephens 2 siblings, 1 reply; 18+ messages in thread From: Andrew Main @ 1998-05-22 15:23 UTC (permalink / raw) To: Timothy J Luoma; +Cc: zsh-users Timothy J Luoma wrote: ># mkt[tab] >mktargz mktargz,v mktargz.~1~ > >Is there a way to make completion ignore files that end with ,v and .~1~ ?? >If so, how and if not, when ;-? fignore=(,v .\~1\~) or, if this is for a particular command, use a ~ exclusion in a compctl -g pattern. -zefram ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: completion ignoring 1998-05-22 15:23 ` Andrew Main @ 1998-05-22 15:34 ` Timothy J Luoma 1998-05-22 16:00 ` Bruce Stephens 0 siblings, 1 reply; 18+ messages in thread From: Timothy J Luoma @ 1998-05-22 15:34 UTC (permalink / raw) To: Andrew Main; +Cc: zsh-users Hrm..... did I do this wrong? # fignore=(.o .elc \~ .wmd ,v .\~1\~) # mktar[tab] mktar mktargz mktargz,v mktargz.~1~ TjL ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: completion ignoring 1998-05-22 15:34 ` Timothy J Luoma @ 1998-05-22 16:00 ` Bruce Stephens 1998-05-22 16:52 ` Bart Schaefer 0 siblings, 1 reply; 18+ messages in thread From: Bruce Stephens @ 1998-05-22 16:00 UTC (permalink / raw) To: zsh-users Timothy J Luoma <luomat+Lists/Zsh/users@luomat.peak.org> writes: > Hrm..... did I do this wrong? > > # fignore=(.o .elc \~ .wmd ,v .\~1\~) > # mktar[tab] > mktar mktargz mktargz,v mktargz.~1~ That's not a file, it's a command name. The rules are different for those. You'll need to look at compctl, I'm afraid. ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: completion ignoring 1998-05-22 16:00 ` Bruce Stephens @ 1998-05-22 16:52 ` Bart Schaefer 1998-05-27 12:20 ` Vincent Lefevre 0 siblings, 1 reply; 18+ messages in thread From: Bart Schaefer @ 1998-05-22 16:52 UTC (permalink / raw) To: zsh-users; +Cc: Timothy J Luoma On May 22, 5:00pm, Bruce Stephens wrote: } Subject: Re: completion ignoring } } Timothy J Luoma <luomat+Lists/Zsh/users@luomat.peak.org> writes: } } > Hrm..... did I do this wrong? } > } > # fignore=(.o .elc \~ .wmd ,v .\~1\~) } > # mktar[tab] } > mktar mktargz mktargz,v mktargz.~1~ } } That's not a file, it's a command name. The rules are different for } those. You'll need to look at compctl, I'm afraid. Or put the ,v in a directory that isn't in $PATH, which would make the most sense anyway. I'm not sure how the .~1~ file got created, but it probably shouldn't be in the search path either. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: completion ignoring 1998-05-22 16:52 ` Bart Schaefer @ 1998-05-27 12:20 ` Vincent Lefevre 1998-05-27 13:18 ` Bruce Stephens 1998-05-27 22:34 ` Shawn Leas 0 siblings, 2 replies; 18+ messages in thread From: Vincent Lefevre @ 1998-05-27 12:20 UTC (permalink / raw) To: zsh-users On Fri, May 22, 1998 at 09:52:32 -0700, Bart Schaefer wrote: > Or put the ,v in a directory that isn't in $PATH, which would make the > most sense anyway. I'm not sure how the .~1~ file got created, but it > probably shouldn't be in the search path either. But why does zsh take all the files from the directories that are in $PATH, and not only the files that can be executed by the user? -- Vincent Lefevre <vlefevre@ens-lyon.fr> | Acorn Risc PC, StrongARM @ 202MHz WWW: http://www.ens-lyon.fr/~vlefevre/ | 20+2MB RAM, Eagle M2, TV + Teletext PhD st. in Computer Science, 2nd year | Apple CD-300, SyQuest 270MB (SCSI) ----------------------------------------------------------------------------- ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: completion ignoring 1998-05-27 12:20 ` Vincent Lefevre @ 1998-05-27 13:18 ` Bruce Stephens 1998-05-27 15:41 ` Sven Guckes 1998-05-27 22:34 ` Shawn Leas 1 sibling, 1 reply; 18+ messages in thread From: Bruce Stephens @ 1998-05-27 13:18 UTC (permalink / raw) To: zsh-users Vincent Lefevre <Vincent.Lefevre@ens-lyon.fr> writes: > But why does zsh take all the files from the directories that are > in $PATH, and not only the files that can be executed by the user? It does only consider executable files. There's nothing wrong with a command ending in ~1~ or ,v. Other than looking at the executable bit, how should zsh determine which files are really executable? ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: completion ignoring 1998-05-27 13:18 ` Bruce Stephens @ 1998-05-27 15:41 ` Sven Guckes 1998-05-27 16:21 ` Bruce Stephens 1998-05-27 16:31 ` Bart Schaefer 0 siblings, 2 replies; 18+ messages in thread From: Sven Guckes @ 1998-05-27 15:41 UTC (permalink / raw) To: zsh-users Vincent Lefevre <Vincent.Lefevre@ens-lyon.fr> writes: > But why does zsh take all the files from the directories that are > in $PATH, and not only the files that can be executed by the user? Quoting Bruce Stephens (b.stephens@isode.com): > It does only consider executable files. There's nothing wrong with a > command ending in ~1~ or ,v. Other than looking at the executable > bit, how should zsh determine which files are really executable? I think Vincent.Lefevre meant this: When using command name expansion (correct term?) can the zsh check the permissions on the executable files and present those that are actually executable for the user? Example: Let's assume that the current dir (ie '.') is in the $PATH [*]. Then the zsh should behave like this: $ touch foo $ chmod 700 foo $ f<TAB> "foo" is shown $ chmod 600 foo $ f<TAB> "foo" is NOT shown Is this possible? (I hope that's not in the manual. ;-) [*] Yes, I know this is a bad thing. it's just an example, ok? ;-) Sven -- Sven Guckes guckes@math.fu-berlin.de using zsh-3.0.5 [961218] ZSH HomePage: http://www.zsh.org | Latest version: zsh-3.1.3 [980501] ZSH Pages: http://www.math.fu-berlin.de/~guckes/zsh/ Tips and tricks ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: completion ignoring 1998-05-27 15:41 ` Sven Guckes @ 1998-05-27 16:21 ` Bruce Stephens 1998-05-29 14:14 ` Vincent Lefevre 1998-05-27 16:31 ` Bart Schaefer 1 sibling, 1 reply; 18+ messages in thread From: Bruce Stephens @ 1998-05-27 16:21 UTC (permalink / raw) To: zsh-users Sven Guckes <guckes@math.fu-berlin.de> writes: > Example: Let's assume that the current dir (ie '.') is in the $PATH [*]. > Then the zsh should behave like this: > > $ touch foo > $ chmod 700 foo > $ f<TAB> > "foo" is shown > $ chmod 600 foo > $ f<TAB> > "foo" is NOT shown > > Is this possible? (I hope that's not in the manual. ;-) That's what I understood the question to be. And yes, isn't this how zsh works right now? I don't remember this being changed recently, so I'd guess it's quite old behaviour? I just tried with "zsh -f" (3.1.2-zefram3), and it has exactly the behaviour you list above. Not only that, but "chmod 670 foo" still has foo not being displayed. ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: completion ignoring 1998-05-27 16:21 ` Bruce Stephens @ 1998-05-29 14:14 ` Vincent Lefevre 1998-05-29 15:36 ` Bruce Stephens 0 siblings, 1 reply; 18+ messages in thread From: Vincent Lefevre @ 1998-05-29 14:14 UTC (permalink / raw) To: zsh-users On Wed, May 27, 1998 at 17:21:18 +0100, Bruce Stephens wrote: > That's what I understood the question to be. And yes, isn't this how > zsh works right now? I don't remember this being changed recently, so > I'd guess it's quite old behaviour? No: $ benchmul[TAB] benchmul-sparc4 benchmul-ultra1 benchmul.o (These 3 files are in a directory that is in my PATH.) $ ll sparc/benchmul* -rwxr-xr-x 1 vlefevre lip 14924 May 29 16:12 sparc/benchmul-sparc4* -rwxr-xr-x 1 vlefevre lip 14924 May 29 13:27 sparc/benchmul-ultra1* -rw-r--r-- 1 vlefevre lip 1388 May 29 16:12 sparc/benchmul.o $ which benchmul.o benchmul.o not found zsh: exit 1 $ echo $ZSH_VERSION 3.0.5 -- Vincent Lefevre <vlefevre@ens-lyon.fr> | Acorn Risc PC, StrongARM @ 202MHz WWW: http://www.ens-lyon.fr/~vlefevre/ | 20+2MB RAM, Eagle M2, TV + Teletext PhD st. in Computer Science, 2nd year | Apple CD-300, SyQuest 270MB (SCSI) ----------------------------------------------------------------------------- ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: completion ignoring 1998-05-29 14:14 ` Vincent Lefevre @ 1998-05-29 15:36 ` Bruce Stephens 1998-05-29 16:59 ` Vincent Lefevre 1998-05-29 18:55 ` Bart Schaefer 0 siblings, 2 replies; 18+ messages in thread From: Bruce Stephens @ 1998-05-29 15:36 UTC (permalink / raw) To: zsh-users Vincent Lefevre <Vincent.Lefevre@ens-lyon.fr> writes: > $ benchmul[TAB] > benchmul-sparc4 benchmul-ultra1 benchmul.o > > (These 3 files are in a directory that is in my PATH.) > > $ ll sparc/benchmul* > -rwxr-xr-x 1 vlefevre lip 14924 May 29 16:12 sparc/benchmul-sparc4* > -rwxr-xr-x 1 vlefevre lip 14924 May 29 13:27 sparc/benchmul-ultra1* > -rw-r--r-- 1 vlefevre lip 1388 May 29 16:12 sparc/benchmul.o > $ echo $ZSH_VERSION > 3.0.5 OK, I think that's a bug in 3.0.5 then. It could be your configuration (if things work properly with "zsh -f" then you should look there), but it may be something that was added since. I only have 3.1.2 and later (which are still beta, but which will be released properly relatively soon, I hope), so I can't easily check 3.0.5. What does the manpage zshcompctl say, under the -C option? For 3.1.2, it explicitly says: -C controls completion when the command word itself is being completed. If no compctl -C command has been issued, the names of any executable command (whether in the path or specific to the shell, such as aliases or functions) are completed. ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: completion ignoring 1998-05-29 15:36 ` Bruce Stephens @ 1998-05-29 16:59 ` Vincent Lefevre 1998-05-29 18:55 ` Bart Schaefer 1 sibling, 0 replies; 18+ messages in thread From: Vincent Lefevre @ 1998-05-29 16:59 UTC (permalink / raw) To: zsh-users On Fri, May 29, 1998 at 16:36:20 +0100, Bruce Stephens wrote: > OK, I think that's a bug in 3.0.5 then. It could be your > configuration (if things work properly with "zsh -f" then you should > look there), I have the same problem with "zsh -f", so it seems to be a bug... > What does the manpage zshcompctl say, under the -C option? For 3.1.2, > it explicitly says: [snip] It says the same thing (with "executable"). -- Vincent Lefevre <vlefevre@ens-lyon.fr> | Acorn Risc PC, StrongARM @ 202MHz WWW: http://www.ens-lyon.fr/~vlefevre/ | 20+2MB RAM, Eagle M2, TV + Teletext PhD st. in Computer Science, 2nd year | Apple CD-300, SyQuest 270MB (SCSI) ----------------------------------------------------------------------------- ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: completion ignoring 1998-05-29 15:36 ` Bruce Stephens 1998-05-29 16:59 ` Vincent Lefevre @ 1998-05-29 18:55 ` Bart Schaefer 1 sibling, 0 replies; 18+ messages in thread From: Bart Schaefer @ 1998-05-29 18:55 UTC (permalink / raw) To: zsh-users On May 29, 4:14pm, Vincent Lefevre wrote: } Subject: Re: completion ignoring } } On Wed, May 27, 1998 at 17:21:18 +0100, Bruce Stephens wrote: } > That's what I understood the question to be. And yes, isn't this how } > zsh works right now? } } No: } } $ benchmul[TAB] } benchmul-sparc4 benchmul-ultra1 benchmul.o } } (These 3 files are in a directory that is in my PATH.) } } -rw-r--r-- 1 vlefevre lip 1388 May 29 16:12 sparc/benchmul.o On May 29, 4:36pm, Bruce Stephens wrote: } Subject: Re: completion ignoring } } OK, I think that's a bug in 3.0.5 then. It's a deficiency (?) in building the command hash table, specifically. If you enter a full (or even relative) path to a prefix of the name of any non-executable file and then attempt to do command completion on it, it fails. But if you look at the output of "hash" you'll see that every file in every directory in $PATH has been put in the table -- and command completion reads the hash table by default, without further testing the file permissions on the target of the hashed name. gen_matches_files(), which is called for things not in the PATH, does do a stat() and look for the S_IEXEC bit. I don't think hashtable.c has changed much in 3.1.x, so this problem is likely still present. However, stat()-ing every file in every directory in $PATH is probably prohibitively slow, so this could reasonably only be handled as a special case during completion. Unfortunately, the code that determines whether a word matches the prefix is completely generic -- it doesn't know that the word came from the command hash table, or even that it's a command being completed -- and it works by adding the word to the completion list if it matches the prefix or by ignoring it if it doesn't match the prefix. There's no hook for discovering that the word *might* match and then doing an extra test on it using any other information (such as the target of the hash). So this behavior is unlikely to be changed anytime soon. Of course, you could do something like function xhash () { emulate -R zsh setopt localoptions local maybe cmd i=0 reply=() hash -f maybe=( $(hash -m ${1}\*${2}) ) for cmd in ${maybe##*\=} do ((++i)) [[ -x $cmd ]] && reply=( $reply ${${maybe[$i]}%\=*} ) done } compctl -C -aBF -K xhash -g '*(*)' This says, attempt to complete any aliases, builtins or functions, any executables in the hash table, and any executable files. The `xhash' function fills the hash table, lists everything in it that matches the prefix and suffix of the completion, then tests the path to which each hashes to see if it is executable before adding it to the result. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: completion ignoring 1998-05-27 15:41 ` Sven Guckes 1998-05-27 16:21 ` Bruce Stephens @ 1998-05-27 16:31 ` Bart Schaefer 1 sibling, 0 replies; 18+ messages in thread From: Bart Schaefer @ 1998-05-27 16:31 UTC (permalink / raw) To: Sven Guckes, zsh-users On May 27, 5:41pm, Sven Guckes wrote: } Subject: Re: completion ignoring } } I think Vincent.Lefevre meant this: } } When using command name expansion (correct term?) } can the zsh check the permissions on the executable files } and present those that are actually executable for the user? That already happens; that's what Bruce Stevens' meant. When you check an executable into RCS, the ,v file has write permission removed but not execute permission: zagzig[23] ci bleep bleep,v <-- bleep initial revision: 1.1 done zagzig[24] ls -l bleep* -r-xr-xr-x 1 schaefer schaefer 249 May 27 09:27 bleep,v* That's how RCS keeps track of what permissions to assign when checking the file out again. But zsh has no way of knowing that the ,v file is "not really" executable. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: completion ignoring 1998-05-27 12:20 ` Vincent Lefevre 1998-05-27 13:18 ` Bruce Stephens @ 1998-05-27 22:34 ` Shawn Leas 1 sibling, 0 replies; 18+ messages in thread From: Shawn Leas @ 1998-05-27 22:34 UTC (permalink / raw) To: Vincent Lefevre; +Cc: zsh-users Gee, maybe zsh should determine whether your kernel supports the a.out you were about to try to run, or whether it thinks it's really wise that you run that SUID script at that priority... Or maybe we should have it check for viruses and clip the hedges, mow the lawn, change your diapers... -shawn <=========== America Held Hostage ===========> Day 1953 for the poor and the middle class. Day 1972 for the rich and the dead. 969 days remaining in the Raw Deal. <============================================> On Wed, 27 May 1998, Vincent Lefevre wrote: > On Fri, May 22, 1998 at 09:52:32 -0700, Bart Schaefer wrote: > > Or put the ,v in a directory that isn't in $PATH, which would make the > > most sense anyway. I'm not sure how the .~1~ file got created, but it > > probably shouldn't be in the search path either. > > But why does zsh take all the files from the directories that are > in $PATH, and not only the files that can be executed by the user? > > -- > Vincent Lefevre <vlefevre@ens-lyon.fr> | Acorn Risc PC, StrongARM @ 202MHz > WWW: http://www.ens-lyon.fr/~vlefevre/ | 20+2MB RAM, Eagle M2, TV + Teletext > PhD st. in Computer Science, 2nd year | Apple CD-300, SyQuest 270MB (SCSI) > ----------------------------------------------------------------------------- > ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: completion ignoring 1998-05-22 15:01 completion ignoring Timothy J Luoma 1998-05-22 15:22 ` Matthew Lovell 1998-05-22 15:23 ` Andrew Main @ 1998-05-22 15:32 ` Bruce Stephens 2 siblings, 0 replies; 18+ messages in thread From: Bruce Stephens @ 1998-05-22 15:32 UTC (permalink / raw) To: zsh-users Timothy J Luoma <luomat+Lists/Zsh/users@luomat.peak.org> writes: > Is there a way to make completion ignore files that end with ,v and .~1~ ?? Yes. > If so, how and if not, when ;-? See zshparam(1), under "fignore". fignore=(.o .c~ .old .pro .tt ,v .~1~) ought to do it. (Change the details to taste.) ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <"hsoX92.0.773.iEPPr"@tequila.systemsz.cs.yale.edu>]
* Re: completion ignoring [not found] <"hsoX92.0.773.iEPPr"@tequila.systemsz.cs.yale.edu> @ 1998-05-22 20:07 ` Stefan Monnier 0 siblings, 0 replies; 18+ messages in thread From: Stefan Monnier @ 1998-05-22 20:07 UTC (permalink / raw) To: zsh-users Timothy J Luoma <luomat+Lists/Zsh/users@luomat.peak.org> writes: > # mkt[tab] > mktargz mktargz,v mktargz.~1~ put the `*,v' files in a RCS subdirectory (rcs automatically put the files there if the directory already exists) Stefa PS: don't put `.' in your PATH. After all `./mktargz' works just as well ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~1998-05-29 19:03 UTC | newest] Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 1998-05-22 15:01 completion ignoring Timothy J Luoma 1998-05-22 15:22 ` Matthew Lovell 1998-05-22 15:23 ` Andrew Main 1998-05-22 15:34 ` Timothy J Luoma 1998-05-22 16:00 ` Bruce Stephens 1998-05-22 16:52 ` Bart Schaefer 1998-05-27 12:20 ` Vincent Lefevre 1998-05-27 13:18 ` Bruce Stephens 1998-05-27 15:41 ` Sven Guckes 1998-05-27 16:21 ` Bruce Stephens 1998-05-29 14:14 ` Vincent Lefevre 1998-05-29 15:36 ` Bruce Stephens 1998-05-29 16:59 ` Vincent Lefevre 1998-05-29 18:55 ` Bart Schaefer 1998-05-27 16:31 ` Bart Schaefer 1998-05-27 22:34 ` Shawn Leas 1998-05-22 15:32 ` Bruce Stephens [not found] <"hsoX92.0.773.iEPPr"@tequila.systemsz.cs.yale.edu> 1998-05-22 20:07 ` Stefan Monnier
Code repositories for project(s) associated with this public inbox https://git.vuxu.org/mirror/zsh/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).