From nobody@FreeBSD.org  Mon Sep 16 10:28:32 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTP id E35DCAC9
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 16 Sep 2013 10:28:32 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id CF7ED2DC4
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 16 Sep 2013 10:28:32 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r8GASWOt094644
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 16 Sep 2013 10:28:32 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r8GASW9k094639;
	Mon, 16 Sep 2013 10:28:32 GMT
	(envelope-from nobody)
Message-Id: <201309161028.r8GASW9k094639@oldred.freebsd.org>
Date: Mon, 16 Sep 2013 10:28:32 GMT
From: Thomas Schweikle <tps@vr-web.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: "time -h portupgrade -aDFR -O" stops sending ^D
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         182148
>Category:       misc
>Synopsis:       "time -h portupgrade -aDFR -O" stops sending ^D
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 16 10:30:00 UTC 2013
>Closed-Date:    
>Last-Modified:  Mon Sep 16 10:40:00 UTC 2013
>Originator:     Thomas Schweikle
>Release:        9.2-PRERELEASE
>Organization:
>Environment:
FreeBSD cc-tps-pfsB-muc.bfs.de 9.2-PRERELEASE FreeBSD 9.2-PRERELEASE #25 r255510: Fri Sep 13 17:27:51 CEST 2013     root@cc-tps-pfsB-muc.bfs.de:/usr/obj/usr/src/sys/CC-TPS-PFSB-MUC  amd64
>Description:
Having a script:
--- snip
#!/bin/sh

timecmd() {
  echo "$(date) -- \"$*\""
  time -h -- $*
  res=$?
  echo
  echo
  return $res
}

timecmd portupgrade -aDFR -O
--- snap

leads to output:
--- snip
# update up
Mon Sep 16 11:28:47 CEST 2013 -- "portupgrade -aDFR -O"
[Reading data from pkg(8) ... - 272 packages found - done]
--->  Fetching the distfile(s) for 'sqlite3-3.8.0.2' (databases/sqlite3)
--->  Fetching '/usr/ports/databases/sqlite3'
^D
--- snap

at this point the script stops. Changing it to read:
--- snip
#!/bin/sh

timecmd() {
  echo "$(date) -- \"$*\""
  time -h -- $*
  res=$?
  echo
  echo
  return $res
}

timecmd portupgrade -aDFR -O \< /dev/null
--- snap

leads to output:
--- snip
# update up
Mon Sep 16 12:22:51 CEST 2013 -- "portupgrade -aDFR -O < /dev/null"
[Reading data from pkg(8) ... - 272 packages found - done]
: date format error

--- snap

Looks like there is something going on inside portupgrade while fiddling with stdio/stderr/stdin giving strange results or leading to hanging processes waiting for input.
>How-To-Repeat:
Copy the above script, execute it to update ports database
>Fix:
Do not use portupgrade with any io-redirects
Do not use "time" or others to execute portupgrade

So really: no fix known.

>Release-Note:
>Audit-Trail:

From: Thomas Schweikle <tschweikle@gmail.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: misc/182148: &quot;time -h portupgrade -aDFR -O&quot; stops
 sending ^D
Date: Mon, 16 Sep 2013 12:34:42 +0200

 --089e01634ec290394204e67dc09d
 Content-Type: text/plain; charset=UTF-8
 
 Fix must read: ... inside of scripts.
 
 -- 
 Thomas
 
 --089e01634ec290394204e67dc09d
 Content-Type: text/html; charset=UTF-8
 
 <div dir="ltr">Fix must read: ... inside of scripts.<br clear="all"><div><br></div>-- <br><div dir="ltr">Thomas</div>
 </div>
 
 --089e01634ec290394204e67dc09d--
>Unformatted:
