Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #11813
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: SIGSTOP and bash's time built-in |
| Date | 2015-11-02 07:50 -0500 |
| Message-ID | <mailman.1494.1446468676.7904.bug-bash@gnu.org> (permalink) |
| References | <20151026165906.3ceb8d0a@tauner-w510> <20151030165022.GM5154@vapier.lan> <5633B02A.30309@case.edu> <20151030203402.2d532766@misery> |
On 10/30/15 3:34 PM, Stefan Tauner wrote: > On Fri, 30 Oct 2015 14:00:10 -0400 > Chet Ramey <chet.ramey@case.edu> wrote: > >> On 10/30/15 12:50 PM, Mike Frysinger wrote: >>> On 26 Oct 2015 16:59, Stefan Tauner wrote: >>>> I was creating some exercises for my students when I noticed very >>>> strange behavior of the time built-in when sending SIGSTOP to a timed >>>> command interactively (via ^Z): >>> >>> you could always install the dedicated time program and then do: >>> $ /usr/bin/time sleep 5 >>> >>> that'll handle ^Z and such >> >> It's probably already installed, and \time will work to invoke it. > > Yes of course and this is the workaround I suggested to my students, > but this is still a major bug IMHO. The output of time(1) is defined in > POSIX as "[…]time between invocation of utility and its termination." > (http://pubs.opengroup.org/onlinepubs/9699919799/utilities/time.html). > I am not aware of any exceptions...(?) so the bash built-in clearly > breaks this major aspect of the defined behavior. It's not a builtin command. It's a commnand modifier -- that's what allows it to time pipelines and shell builtins, which an external command cannot do. The fact that it isn't tied to job control is technically a bug, but a minor one. It comes up occasionally as a problem. This is on the list of things to look at, but is not a high priority. If you'd like to take a shot at modifying bash to support this behavior, you'd probably have to start with time_command() and go into augmenting the job structure with timing info. If you're interested in a survey of shells' implementations of `time', bash, ksh93, and mksh print timing statistics when the process being timed is suspended, dash and its siblings don't implement `time' at all, and zsh behaves as you'd like. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
Back to gnu.bash.bug | Previous | Next | Find similar
Re: SIGSTOP and bash's time built-in Chet Ramey <chet.ramey@case.edu> - 2015-11-02 07:50 -0500
csiph-web