Re: current bash.git.devel segfaults on my code

2021-10-24 Thread Alex fxmbsw7 Ratchev
ill check the other more complete url but yours chet u posted twice doesnt say anything about an ending command, nor multiple commands beware im noob with git On Mon, Oct 25, 2021, 00:55 Chet Ramey wrote: > On 10/24/21 4:00 AM, Alex fxmbsw7 Ratchev wrote: > > and whats the cmd to fetch or change

Re: current bash.git.devel segfaults on my code

2021-10-24 Thread Chet Ramey
On 10/24/21 4:00 AM, Alex fxmbsw7 Ratchev wrote: and whats the cmd to fetch or change a commit state instead of newest At some point, you have to be able to read through the things people send you. For instance: https://thoughtbot.com/blog/git-bisect gives you all the information you need.

Re: Fixing coproc race condition bug

2021-10-24 Thread Jim Avera
On 10/24/21 1:44 PM, Jim Avera wrote: # Note: Ignore errors when closing pipes, as the user might have manually closed # the fds using 'exec {varname}>&-' or similar. Actually this isn't a good idea because the fd might have been re-used for something else; so an error should be reported to m

Fixing coproc race condition bug

2021-10-24 Thread Jim Avera
#!/usr/bin/env bash set -e -u coproc date sleep 1 # In bash 5.0.17, this aborts with "COPROC[0]: unbound variable" # if the coproc exits before the main process gets here. read -u ${COPROC[0]} line # Discussion: # # To prevent this race condition, Bash must not close the coproc output pipe # w

Re: current bash.git.devel segfaults on my code

2021-10-24 Thread Lawrence Velázquez
On Sun, Oct 24, 2021, at 7:28 AM, Shehu Dikko wrote: > Use this tldr client to get all the git tips you need and much else besides: > > https://github.com/raylee/tldr-sh-client > > tldr: https://tldr.sh There's also #git on irc.libera.chat, if you prefer. -- vq

Re: Option for read to handle incomplete last line

2021-10-24 Thread Chet Ramey
On 10/24/21 12:22 PM, Martin Schulte wrote: Before reading the source I would never have thought that read sets variables although it returns FAILURE. Think of them as orthogonal conditions. `read' reads until a newline, or EOF or other error condition (ignoring timeouts or reading N characte

Re: Option for read to handle incomplete last line

2021-10-24 Thread Martin Schulte
Hi Greg! > > Nevertheless, am I right that this solution relies on an undocumented > > feature? > > Which "undocumented" feature did you have in mind? Most things are > documented, somewhere. > > Are you thinking of -d '' signifying NUL as the delimiter? Chet told > us that he supports this "

Re: Option for read to handle incomplete last line

2021-10-24 Thread Greg Wooledge
On Sun, Oct 24, 2021 at 04:26:44PM +0200, Martin Schulte wrote: > Hi Greg, hi *! > > > For bash scripts using this, I'd go a little bit fancier: > > > > read_line() { > > if (($# == 0)) || [[ ${!#} = -* ]]; then > > declare -n _rl_lastvar=REPLY > > else > > declare -n _rl_lastvar=${!#

Re: Option for read to handle incomplete last line

2021-10-24 Thread Martin Schulte
Hi Greg, hi *! > For bash scripts using this, I'd go a little bit fancier: > > read_line() { > if (($# == 0)) || [[ ${!#} = -* ]]; then > declare -n _rl_lastvar=REPLY > else > declare -n _rl_lastvar=${!#} > fi > read -r "$@" || test -n "$_rl_lastvar" > } Great, thanks - this solu

Re: current bash.git.devel segfaults on my code

2021-10-24 Thread Shehu Dikko
* Alex fxmbsw7 Ratchev [2021-10-24] [gmane.comp.shells.bash.bugs]: > and whats the cmd to fetch or change a commit state instead of newest Use this tldr client to get all the git tips you need and much else besides: https://github.com/raylee/tldr-sh-client tldr: https://tldr.sh regards, s h e

Re: Option for read to handle incomplete last line

2021-10-24 Thread Greg Wooledge
On Sun, Oct 24, 2021 at 06:41:59PM +0900, Koichi Murase wrote: > > my apologies if there's a much easier solution for the following > > problem - in this case please let me know! > > We can always define a shell function (which would work in all the > POSIX shells): > > read_line() { read line ||

Re: Option for read to handle incomplete last line

2021-10-24 Thread Oğuz
On Sun, Oct 24, 2021 at 12:42 PM Koichi Murase wrote: > and I think this is the behavior implied by the POSIX standard: The spec also says: > STDIN > The standard input shall be a text file. A text file is either empty, or ends with a newline. The behavior of `read' is undefined when the input i

Re: Option for read to handle incomplete last line

2021-10-24 Thread Koichi Murase
> my apologies if there's a much easier solution for the following > problem - in this case please let me know! We can always define a shell function (which would work in all the POSIX shells): read_line() { read line || test -n "$line"; } printf '%s' "$input" | while read_line; do printf ' %s\n

Option for read to handle incomplete last line

2021-10-24 Thread Martin Schulte
Hello, my apologies if there's a much easier solution for the following problem - in this case please let me know! >From time to time a run into troubles when reading a file with a while-read >loop where the last "line" is not terminated with a newline. I found an ugly looking solution (probab

Re: current bash.git.devel segfaults on my code

2021-10-24 Thread Alex fxmbsw7 Ratchev
and whats the cmd to fetch or change a commit state instead of newest On Sun, Oct 24, 2021, 09:53 Alex fxmbsw7 Ratchev wrote: > i am nowhere ready, at slow thinking though i am.. does ' git bisect run ' > support shell syntax, and where to enter the cleanup ' make clean ' there > > On Sun, Oct 2

Re: current bash.git.devel segfaults on my code

2021-10-24 Thread Alex fxmbsw7 Ratchev
i am nowhere ready, at slow thinking though i am.. does ' git bisect run ' support shell syntax, and where to enter the cleanup ' make clean ' there On Sun, Oct 24, 2021, 00:25 Chet Ramey wrote: > On 10/22/21 9:03 PM, Alex fxmbsw7 Ratchev wrote: > > ./bash --noprofile --norc > > > > bash-5.1# ./