zsh-users
 help / color / mirror / code / Atom feed
* Proposal to use patterns in fake-files style
@ 2007-04-30 12:08 Peter Stephenson
  2007-04-30 21:44 ` Phil Pennock
  2007-05-01  9:43 ` Peter Stephenson
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Stephenson @ 2007-04-30 12:08 UTC (permalink / raw)
  To: Zsh users list

Is anybody out there going to be disadvantaged if I turn the directory
part of the fake-files completion style into a pattern?  This shouldn't
make any difference unless the directory currently has a pattern
character in it, which I think is highly unlikely for typical uses.

The reason I want this is that our Netapp file server has a magic
".snapshot" directory within every directory that doesn't appear in the
listing (except, for some reason, in the home directory).  So I want an
easy way to add that as fake entry on some file systems and not on
others.  This change would allow me to do

zstyle ':completion:*' fake-files '/home/*:.snapshot'

or if I'm feeling bold

zstyle -e ':completion:*' fake-files 'reply=("$(mount |
perl -ne '\''/^[^:]*netapp[^:]*:.* on (.*) type nfs/ and
  push @dirs, "$1";
  END { @dirs and print "(" . join("|", @dirs), ")/*:.snapshot\n" }'\'')")'

Let me know if you don't like this and I'll add a separate style like
fake-file-patterns instead.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php

To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Proposal to use patterns in fake-files style
  2007-04-30 12:08 Proposal to use patterns in fake-files style Peter Stephenson
@ 2007-04-30 21:44 ` Phil Pennock
  2007-05-01  9:43 ` Peter Stephenson
  1 sibling, 0 replies; 3+ messages in thread
From: Phil Pennock @ 2007-04-30 21:44 UTC (permalink / raw)
  To: Zsh users list

On 2007-04-30 at 13:08 +0100, Peter Stephenson wrote:
> The reason I want this is that our Netapp file server has a magic
> ".snapshot" directory within every directory that doesn't appear in the
> listing (except, for some reason, in the home directory).

It's documented; you might want to ask your filer admins if they've put
a copy of the supplied man-pages anywhere convenient, so that you can
add it to your man search-path.

na_snap(1):

       Volume  snapshots are exported to all CIFS or NFS clients.  They can be
       accessed from each directory in the file system. From any directory,  a
       user  can  access the set of snapshots from a hidden sub-directory that
       appears to a CIFS client as ~snapsht and to an NFS client as .snapshot.
       These  hidden  sub-directories are special in that they can be accessed
       from every directory, but they only show up in directory listings at an
       NFS mount point or at the root of CIFS share.

Probably not worth the portability complexity of dealing with
statfs/statvfs/other and looking for something like f_mnttoname to
compare with the canonicalised path ... but might be worth letting
zstyle set a list of directories which are mountpoints to ignore
.snapshot in, default list value (/home) ?

I'm unable to remember what the EMC Celerra NAS heads name their
snapshot directories but I think it was something different, so
.snapshot itself could be a zstyle'd var?

And a search engine check for Sun's ZFS, (zfs NFS snapshot), turned up
<URL:http://www.solarisinternals.com/wiki/index.php/ZFS_Best_Practices_Guide>
which says the special directory is called ".zfs".

In neither case do I know if the entry is ever returned in a readdir().

But the completion stuff still gives me headaches, so I'm not supplying
a patch.  Sorry.

-Phil


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Proposal to use patterns in fake-files style
  2007-04-30 12:08 Proposal to use patterns in fake-files style Peter Stephenson
  2007-04-30 21:44 ` Phil Pennock
@ 2007-05-01  9:43 ` Peter Stephenson
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2007-05-01  9:43 UTC (permalink / raw)
  To: Zsh users list

Peter Stephenson <pws@csr.com> wrote:
> Is anybody out there going to be disadvantaged if I turn the directory
> part of the fake-files completion style into a pattern?

As no one seemed to be worried I've made this change on the main line.
I can still push it out to a new style if there turns out to be a good
reason.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php

To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-05-01  9:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-30 12:08 Proposal to use patterns in fake-files style Peter Stephenson
2007-04-30 21:44 ` Phil Pennock
2007-05-01  9:43 ` Peter Stephenson

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).