Re: Aging Dependencies?

Alexander Zangerl <[email protected]> Sat, 21 Apr 2012 01:14:53 +1000
Newsgroups gmane.mail.exmh.user,gmane.mail.exmh.devel
Message-ID <[email protected]>
On Fri, 20 Apr 2012 10:21:31 -0400, Ken Hornstein writes:
>It looks like the issues are: either mmencode needs a home, or we need to
>switch exmh to a package that is more recent than the first Clinton
>administration.

the debian variant of exmh (which i maintain) goes for mimencode
or recode and falls back to the tcl decoder. the changes are small and 
trivial (see attached patch).

regards
az

-- 
Alexander Zangerl + GnuPG Keys 0x42BD645D or 0x5B586291 + http://snafu.priv.at/
The programmer's national anthem is 'AAAAAAAAHHHHHHHH'. -- Weinberg, p.152

_______________________________________________
Exmh-users mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/exmh-users
10_nometamail.dpatch (text/x-shellscript, 5.4 KB)
#! /bin/sh /usr/share/dpatch/dpatch-run
## 10_nometamail.dpatch by  <[email protected]>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: fix fd leakage, add support for recode as alternative to mimencode

@DPATCH@
diff -urNad exmh-2.7.2~/lib/mime.tcl exmh-2.7.2/lib/mime.tcl
--- exmh-2.7.2~/lib/mime.tcl	2008-06-18 21:50:33.863033779 +1000
+++ exmh-2.7.2/lib/mime.tcl	2008-06-18 21:54:39.608893927 +1000
@@ -13,21 +13,24 @@
 # any specification.
 
 proc Mime_Init {} {
-    global mime env base64 mimeFont
+    global install mime env base64 mimeFont
 
     if [info exists mime(init)] {
 	return
     }
-    # Make sure Metamail is on the path
-    set hit 0
+
+    # no more metamail required
+    set env(NOMETAMAIL) 1
+
+    # look for mimencode or recode in path, prefer mimencode
+    set rhit 0
     foreach dir [split $env(PATH) :] {
-	if {[string compare $dir $mime(dir)] == 0 && [string length $mime(dir)]} {
-	    set hit 1
-	    break
+	if {[file executable "$dir/mimencode"]} {
+	    set mime(encode) "$dir/mimencode"
+	}
+	if {[file executable "$dir/recode"]} {
+	    set mime(recode) "$dir/recode"
 	}
-    }
-    if {! $hit} {
-	set env(PATH) $mime(dir):$env(PATH)
     }
 
     set mime(init) 1
@@ -35,18 +38,6 @@
     set mime(junkfiles) {}
     set mime(stop) 0
 
-    foreach dir [split $env(PATH) :] {
-      if {[file executable $dir/mimencode]} {
-          set mime(encode) mimencode
-          break
-      }
-      if {[file executable $dir/mmencode]} {
-          set mime(encode) mmencode
-          break
-      }
-    }
-    # If mime(encode) is not set, we use a fallback path
-
     set types [concat [option get . mimeTypes {}] [option get . mimeUTypes {}]]
     Exmh_Debug MimeTypes $types
     set mime(showproc,default)			Mime_ShowDefault
@@ -132,7 +123,7 @@
 "This is the maximum size of a message before exmh displays a
 warning about a large message and STOP button."}
 	{mime(ftpMethod) ftpMethod
-        {CHOICE expect ftp {ftp -n} metamail {URI tool}}
+        {CHOICE expect ftp {ftp -n} {URI tool}}
 	{FTP access method}
 "Sometimes the automatic FTP transfer fails because of
 problems logging into the remote host.	This option lets
@@ -141,7 +132,6 @@
 expect - use the ftp.expect script to download the file.
 ftp - use ftp and feed user and password to it via a pipe.
 ftp -n - use the ftp no-auto-login feature.
-metamail - pass control to metamail and let it try.
 URI tool - uses your favorite WWW browser to get the
            file.  See \"URI Preferences\"."}
 	{mime(ftpCommand) ftpCommand	ftp {FTP command name}
@@ -322,7 +312,8 @@
     # the tspecials: ()<>@,;:\"/[]?=
     # the forward slash is kept.
     set mimeHdr($part,hdr,content-type) $contentType
-    regsub -all {[[:cntrl:][:blank:]()<>@,;:\\"?=[.[.][.].]]} $type {} type
+    regsub -all {[[:cntrl:][:blank:]()<>@,;:\\"?=[.[.][.].]]} $type {} type 
+    # "
     set mimeHdr($part,type) $type
     regsub -all {[^-[:print:]]} $encoding {} encoding
     set mimeHdr($part,encoding) $encoding
@@ -1462,12 +1453,18 @@
 	    }
 	    quoted-printable -
 	    base64 {
-                if {[info exist mime(encode)]} {
-                  if {$encoding == "base64"} {
-                    exec $mime(encode) -u -b $fileName >@ $out
-                  } else {
-                    exec $mime(encode) -u -q $fileName >@ $out
-                  }
+		# tre mimencode or recode if available
+                if {[info exist mime(encode)] || [info exists mime(recode)]} {
+		    if {[info exist mime(encode)]} {
+			set cmd [list exec $mime(encode) -u]
+			lappend cmd [expr {$encoding == "base64"?"-b":"-q"}]
+			lappend cmd $fileName >@ $out
+		    } else {
+			set cmd [list exec $mime(recode)]
+			lappend cmd [expr {$encoding == "base64"?"base64..data":"qp..data"}]
+			lappend cmd < $fileName >@ $out
+		    }
+		    eval $cmd
                 } else {
                   # Replace use of mimencode with Tcl versions.
                   # This is noticably slower.  We should also
@@ -1493,6 +1490,7 @@
                   } else {
                       puts -nonewline $out [::mime::qp_decode $buffer]
                   }
+		  catch  {close $in}
                 }
 	    }
 	    .*uue.* {
diff -urNad exmh-2.7.2~/lib/seditExtras.tcl exmh-2.7.2/lib/seditExtras.tcl
--- exmh-2.7.2~/lib/seditExtras.tcl	2008-06-18 21:50:33.843034267 +1000
+++ exmh-2.7.2/lib/seditExtras.tcl	2008-06-18 21:50:53.674539168 +1000
@@ -238,9 +238,11 @@
             switch -- $encoding {
                 base64 {
                   if {[info exist mime(encode)]} {
-                    $t insert $mark [exec $mime(encode) -b < $file]
-                  } else {
-                    Base64_EncodeInit state old length
+		      $t insert $mark [exec $mime(encode) -b < $file]
+		  } elseif {[info exist mime(recode)]} {
+		      $t insert $mark [exec $mime(recode) data..base64 < $file]
+		  } else {
+		    Base64_EncodeInit state old length
                     set in [open $file]
 		    fconfigure $in -encoding binary -translation binary
                     while {![eof $in]} {
@@ -252,6 +254,8 @@
                 quoted-printable {
                   if {[info exist mime(encode)]} {
                     $t insert $mark [exec $mime(encode) -q < $file]
+		  } elseif {[info exist mime(recode)]} {
+		    $t insert $mark [exec $mime(recode) data..qp < $file]
                   } else {
                     set line_cnt 0  ;# Accumulate lines before calling the encoder
                     set buffer ""
signature.asc (application/pgp-signature, 230 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iF4EAREIAAYFAk+RfYEACgkQ+bKELRvb2DwF3wEA6yKrSGRm7bal+pbcgfpddf3d
bcm90+Za5EyowrqEi2MA/0TeMHDEgAj6Eujpgr03HedKC4VJn/PTxq+lQCJ3Wgo6
=mhCP
-----END PGP SIGNATURE-----