Bug 182148 - "time -h portupgrade -aDFR -O" stops sending ^D
Summary: "time -h portupgrade -aDFR -O" stops sending ^D
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 9.2-PRERELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-16 11:30 UTC by Thomas Schweikle
Modified: 2017-12-31 22:27 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schweikle 2013-09-16 11:30:00 UTC
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.

Fix: 

Do not use portupgrade with any io-redirects
Do not use "time" or others to execute portupgrade

So really: no fix known.
How-To-Repeat: Copy the above script, execute it to update ports database
Comment 1 tschweikle 2013-09-16 11:34:42 UTC
Fix must read: ... inside of scripts.

-- 
Thomas
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:58:53 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped