[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: segmentation fault after interrupting function that uses "time"
From: |
Chet Ramey |
Subject: |
Re: segmentation fault after interrupting function that uses "time" |
Date: |
Thu, 23 May 2024 15:54:57 -0400 |
User-agent: |
Mozilla Thunderbird |
On 5/23/24 7:43 AM, Michael Maurer wrote:
Bash Version: 5.2
Patch Level: 15
Release Status: release
Description:
Calling a function that itself uses the keyword "time" to call another
function that performs a long task, and then interrupting with Ctrl+C before it is
complete, causes a segfault. Behavior varies depending on whether or not the output of
time is piped into another command, and whether the functions were sourced from a file or
typed in directly.
Seems similar to the bug previously reported here:
https://lists.gnu.org/archive/html/bug-bash/2019-07/msg00004.html
I can't reproduce this on macOS, RHEL 9, or Debian 12 with either the
latest devel branch or bash-5.2.26.
Here's a sample transcript from the Debian 12 instance:
admin@ip-172-29-1-176:~/build/bash-5.2.26$ ./bash
admin@ip-172-29-1-176:~/build/bash-5.2.26$ cd scratch/
admin@ip-172-29-1-176:~/build/bash-5.2.26/scratch$ foo () { sleep 10; echo
'output from long task'; }
admin@ip-172-29-1-176:~/build/bash-5.2.26/scratch$ bar_1 () { time foo; }
admin@ip-172-29-1-176:~/build/bash-5.2.26/scratch$ bar_1
^C
real 0m5.780s
user 0m0.001s
sys 0m0.000s
admin@ip-172-29-1-176:~/build/bash-5.2.26/scratch$ bar_1
output from long task
real 0m10.002s
user 0m0.002s
sys 0m0.000s
admin@ip-172-29-1-176:~/build/bash-5.2.26/scratch$ echo $BASH_VERSION
5.2.26(1)-release
admin@ip-172-29-1-176:~/build/bash-5.2.26/scratch$ uname -a
Linux ip-172-29-1-176 6.1.0-21-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian
6.1.90-1 (2024-05-03) x86_64 GNU/Linux
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature