bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why does "mapfile -d delim" (delim != '\n') use unbuffered read?


From: Koichi Murase
Subject: Re: Why does "mapfile -d delim" (delim != '\n') use unbuffered read?
Date: Mon, 10 May 2021 09:38:49 +0900

2021年5月10日(月) 8:11 Chet Ramey <chet.ramey@case.edu>:
> On 5/7/21 8:35 PM, Koichi Murase wrote:
> >
> > Ah, I see it was based on the fact that there have been no bug
> > reports.
>
> That't my best metric.
>
> > Actually, I'm wondering in what situation we can
> > usefully specify the `-C callback' option because it seems like we can
> > anytime process blocks of elements after the entire array is loaded.
>
> `mapfile' came as part of contributions associated with the bash debugger.
> Maybe take a look there to see how it uses -C?

Oh, that is new information for me. Thank you.

I've checked bashdb-5.0-1.1.2 and found that `-C callback' was
actually used to show the progress bar for reading data. OK, the
option `-C' is indeed useful in showing the progress of
mapfile/readarray processing.

bashdb-5.0-1.1.2/lib/filecache.sh:220
>   builtin mapfile -t -O 1 -c $BIGFILE \
>       -C "_Dbg_progess_show \"${progress_prefix}\" ${line_count}" \
>       $_Dbg_source_array_var < "$fullname"
bashdb-5.0-1.1.2/lib/filecache.sh:231
>           builtin readarray -t -O 1 -c $BIGFILE \
>               -C "_Dbg_progess_show \"${progress_prefix}\" ${line_count}" \
>               $_Dbg_highlight_array_var < "$tempfile"
bashdb-5.0-1.1.2/init/io.sh:33
> # _Dbg_progess_show --- print the progress bar
> # $1: prefix string
> # $2: max value
> # $3: current value
> function _Dbg_progess_show {

--
Koichi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]