From: Clint Adams <schizo@debian.org>
To: zsh-workers@sunsite.dk
Cc: 339635-forwarded@bugs.debian.org
Subject: [ramk@cse.iitm.ernet.in: Bug#339635: zsh: zsh-mime-handler used even in the case of executable files]
Date: Fri, 31 Mar 2006 09:22:40 -0500 [thread overview]
Message-ID: <20060331142240.GA18008@scowler.net> (raw)
Another patch from R.Ramkumar for which I hold no opinion.
----- Forwarded message from "R.Ramkumar" <ramk@cse.iitm.ernet.in> -----
Date: Thu, 17 Nov 2005 23:34:25 +0530
From: "R.Ramkumar" <ramk@cse.iitm.ernet.in>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: Bug#339635: zsh: zsh-mime-handler used even in the case of executable files
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.
Content-Description: Patch for the execute-as-is style to zsh-mime-handler
--- 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
----- End forwarded message -----
next reply other threads:[~2006-03-31 14:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-31 14:22 Clint Adams [this message]
2006-04-05 10:14 Peter Stephenson
2006-04-06 13:07 Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060331142240.GA18008@scowler.net \
--to=schizo@debian.org \
--cc=339635-forwarded@bugs.debian.org \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).