Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: _canonical_path not working on *BSD




Quoting Peter Stephenson <pws@xxxxxxx>:


Pea suggested just removing the -q, but probably we should also redirect
stderr:

Index: Completion/Unix/Type/_canonical_paths
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_canonical_paths,v
retrieving revision 1.1
diff -u -r1.1 _canonical_paths
--- Completion/Unix/Type/_canonical_paths	28 May 2006 18:36:06 -0000	1.1
+++ Completion/Unix/Type/_canonical_paths	26 Mar 2008 15:05:05 -0000
@@ -38,7 +38,8 @@
   files=($@)
 else
   for __index in $@; do
-    files+=$(readlink -qf $__index)
+    # BSD doesn't have -q, so redirect stderr.
+    files+=$(readlink -f $__index 2>/dev/null)
   done
 fi

@@ -48,7 +49,7 @@
   expref=${~origpref}
   [[ $origpref == (|*/). ]] && rltrim=.
   curpref=${${expref%$rltrim}:-./}
-  canpref=$(readlink -qf $curpref)
+  canpref=$(readlink -f $curpref 2>/dev/null)
   if [[ $? -eq 0 ]]; then
     [[ $curpref == */ && $canpref == *[^/] ]] && canpref+=/
     canpref+=$rltrim


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


This only work on OpenBSD, readlink on FreeBSD doesn't allow -f.

here is the manpage on FreeBSD : http://www.freebsd.org/cgi/man.cgi?query=readlink&apropos=0&sektion=0&manpath=FreeBSD+6.3-RELEASE&format=html it seems to be ok on NetBSD, but I don't have tried (the manpage says -f is ok for readlink)

Darwin should have the same problem, the man page is the same as the freebsd one :
http://developer.apple.com/documentation/Darwin/Reference/Manpages/man1/readlink.1.html

I will also see with the freebsd folks if it is not possible to add -f to readlink.

---
Baptiste

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



Messages sorted by: Reverse Date, Date, Thread, Author