NetBSD Problem Report #54766

From elo@foobox.net  Sat Dec 14 20:17:12 2019
Return-Path: <elo@foobox.net>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id D6B6C7A18A
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 14 Dec 2019 20:17:12 +0000 (UTC)
Message-Id: <20191214201707.D44F0821A@marmite.localnet>
Date: Sat, 14 Dec 2019 20:17:07 +0000 (GMT)
From: elo@foobox.net
Reply-To: elo@foobox.net
To: gnats-bugs@NetBSD.org
Subject: Broken mime-hooks handling in mail(1)
X-Send-Pr-Version: 3.95

>Number:         54766
>Category:       bin
>Synopsis:       Broken mime-hooks handling in mail(1)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 14 20:20:00 +0000 2019
>Closed-Date:    Sun Dec 15 10:08:25 +0000 2019
>Last-Modified:  Tue Dec 17 12:35:03 +0000 2019
>Originator:     elo
>Release:        NetBSD 9.0_BETA
>Organization:
>Environment:
System: NetBSD marmite.localnet 9.0_BETA NetBSD 9.0_BETA (BLUEBELL) #3: Sun Nov 3 02:10:56 GMT 2019 elo@marmite.localnet:/usr/obj/sys/arch/amd64/compile/BLUEBELL amd64
Architecture: x86_64
Machine: amd64
>Description:
	The handling of mime hooks in the mail(1) client program
	was broken by revision 1.9, dated Thu, 9 Nov 2017, to the
	file 'src/usr.bin/mail/mime_child.c'. On that day, the 'f'
	modifier, permitting only regular files to be opened, was
	added to the mode string of calls to fopen(3) and fdopen(3)
	throughout the mail source. Unluckily, in two locations it
	was added to fdopen() calls that only ever operate on pipes,
	thereby ensuring that those calls, part of the mime-hooks
	handling code, would always fail.
>How-To-Repeat:
	Define a mime handler in the mail(1) configuration file.
	Something like this should suffice.

	set mime-body-text-html="+lynx -dump -force-html -stdin"

	Then try, and fail, to view an HTML e-mail message.
>Fix:
	Apply the following patch, which partly reverts revision 1.9.

--- a/usr/src/usr.bin/mail/mime_child.c	2019-12-14 18:11:24.005104242 +0000
+++ b/usr/src/usr.bin/mail/mime_child.c	2019-08-16 20:18:41.127522330 +0100
@@ -159,7 +159,7 @@
 	default:	/* parent */
 		(void)close(p[READ]);

-		nfo = fdopen(p[WRITE], "wef");
+		nfo = fdopen(p[WRITE], "we");
 		if (nfo == NULL) {
 			warn("mime_run_command: fdopen");
 			(void)close(p[WRITE]);
@@ -203,7 +203,7 @@

 	default:	/* parent */
 		(void)close(p[READ]);
-		nfo = fdopen(p[WRITE], "wef");
+		nfo = fdopen(p[WRITE], "we");
 		if (nfo == NULL) {
 			warn("run_function: fdopen");
 			(void)close(p[WRITE]);

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54766 CVS commit: src/usr.bin/mail
Date: Sat, 14 Dec 2019 15:21:43 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Sat Dec 14 20:21:43 UTC 2019

 Modified Files:
 	src/usr.bin/mail: mime_child.c

 Log Message:
 PR/54766: elo: Broken mime-hooks handling in mail(1)
 pullup-9.


 To generate a diff of this commit:
 cvs rdiff -u -r1.9 -r1.10 src/usr.bin/mail/mime_child.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Sun, 15 Dec 2019 10:08:25 +0000
State-Changed-Why:
Committed by christos. Thanks!


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54766 CVS commit: [netbsd-9] src/usr.bin/mail
Date: Tue, 17 Dec 2019 12:30:37 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Tue Dec 17 12:30:36 UTC 2019

 Modified Files:
 	src/usr.bin/mail [netbsd-9]: complete.c mail.1 mime_child.c

 Log Message:
 Pull up following revision(s) (requested by christos in ticket #555):

 	usr.bin/mail/mime_child.c: revision 1.10
 	usr.bin/mail/mail.1: revision 1.68
 	usr.bin/mail/complete.c: revision 1.21

 PR/54766: elo: Broken mime-hooks handling in mail(1)
 pullup-9.

 PR/54765: elo: Minor error in the mail(1) man page (-F description truncated)
 pullup-9

 PR/54764: elo: Incorrect '+file' filename completion in mail(1)
 Add propel completion stem so that file completion works.
 pullup-9


 To generate a diff of this commit:
 cvs rdiff -u -r1.20 -r1.20.48.1 src/usr.bin/mail/complete.c
 cvs rdiff -u -r1.65.2.1 -r1.65.2.2 src/usr.bin/mail/mail.1
 cvs rdiff -u -r1.9 -r1.9.6.1 src/usr.bin/mail/mime_child.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.