On Fri, Jun 21, 2024 at 22:26:07 +0500, Mikhail Gavrilov wrote: > On Fri, Jun 21, 2024 at 10:06 PM Chet Ramey <chet.ra...@case.edu> wrote: > > Bash allows recursive trap handlers. > > Ok. But it's very suspicious for me because the script ended without > any issues on macOS. > > mikhail@MBP-Mikhail ~> ./splitcurl.sh "ftp://test.rebex.net/no-file" 10 > Download failed! > mikhail@MBP-Mikhail ~> > mikhail@MBP-Mikhail ~> bash --version > GNU bash, version 3.2.57(1)-release (arm64-apple-darwin24) > Copyright (C) 2007 Free Software Foundation, Inc.
That version of bash is 17 years old. Recursive trap handling was added in version 4.3, if I'm reading this CHANGES entry correctly: n. The shell no longer blocks receipt of signals while running trap handlers for those signals, and allows most trap handlers to be run recursively (running trap handlers while a trap handler is executing). There are some newer entries than that for SIGINT specifically, but that's not relevant in this case.