Package: zsh
Version: 4.2.5-22
Severity: wishlist
Tags: patch

Some scripts end with a .sh (a common example being autogen.sh). For
such scripts, zsh-mime-handler ends up executing the mime action for
the suffix sh, which sometimes happens to be to just display the
file. This, I guess is due to alias -s, which blindly maps in case
the suffix matches. To counter this, it would be good if
zsh-mime-handler uses a style to take a set of patterns that would
be executed as-is, despite having a suffix found in the mime
configuration. I am enclosing a patch for the same. I have made the
set of executable files as the default for this style, I hope this
deviation from the original behaviour is acceptable.



--- zsh-mime-handler.orig       2005-11-17 23:21:14.000000000 +0530
+++ zsh-mime-handler    2005-11-17 23:31:37.000000000 +0530
@@ -45,6 +45,22 @@
 context=":mime:.${suffix}:"
 
 local handler flags no_sh no_bg
+local -a exec_asis
+
+# Set to a list of patterns which are ignored and executed as they are,
+# despite being called for interpretation by the mime handler.
+# Defaults to executable files, which ensures that they are executed as
+# they are, even if they have a suffix.
+zstyle -a $context execute-as-is exec_asis || exec_asis=('*(*)')
+
+local pattern
+
+for pattern in $exec_asis; do
+    if [[ $1 = ${~pattern} ]]; then
+       $@
+       return 0
+    fi
+done
 
 zstyle -s $context handler handler ||
   handler="${zsh_mime_handlers[$suffix]}"
Hope this helps :)

Regards,
Ramkumar

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (101, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.14-archck1
Locale: LANG=en_IN, LC_CTYPE=en_IN (charmap=UTF-8)

Versions of packages zsh depends on:
ii  debconf [debconf-2.0]         1.4.58     Debian configuration management sy
ii  libc6                         2.3.5-6    GNU C Library: Shared libraries an
ii  libncurses5                   5.4-9      Shared libraries for terminal hand

Versions of packages zsh recommends:
ii  libcap1                       1:1.10-14  support for getting/setting POSIX.
ii  libpcre3                      6.4-1.0.1  Perl 5 Compatible Regular Expressi

-- no debconf information

-- 
WARN_(accel)("msg null; should hang here to be win compatible\n");
                                   -- WINE source code

Reply via email to