Re: bash 5.1 heredoc pipes problematic, shopt needed

2022-04-25 Thread tetsujin
On 2022-04-25 13:03, Alexey via Bug reports for the GNU Bourne Again SHell wrote: There is one more problem with pipes — they are extremely slow. Examples: GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) 1) Preparation: create two files with ASCII content: one for to be file

Re: Light weight support for JSON

2022-08-29 Thread tetsujin
On 2022-08-29 11:43, Chet Ramey wrote: On 8/28/22 2:11 PM, Lawrence Velázquez wrote: On Sun, Aug 28, 2022, at 9:24 AM, Yair Lenga wrote: Wanted to get feedback about the following "extensions" to bash that will make it easier to work with simple JSON object. (...) just to make it easier to bu

Re: Fwd: Non-upstream patches for bash (2014)

2017-06-26 Thread tetsujin
It seems a strange inconsistency, though: Double-quoted strings (and, really, pretty much all other Bash syntax as far as I have seen) recognize 0x81 0x5C as a two-byte character rather than treating 0x5C as a backslash within the quoting syntax, but $'..' strings unconditionally treat 0x5C as a b

Re: Fwd: Non-upstream patches for bash (2014)

2017-06-26 Thread tetsujin
That's not a reason why this disparity is "desirable" IMO. Generally, the rule is that the shell interprets the shell script it's given according to the character set of the active locale. It may not allow any given sequence of characters in any given context, but in terms of how the parser trans

Re: mapfile doesn't accept input from a pipe

2017-06-29 Thread tetsujin
I think that when programmers first learn shell programming, this is a hard piece of information to effectively convey. The Bash documentation provides the important facts: - Subshells are quietly and automatically constructed for a variety of shell programming constructs, including pipelines - C

Re: mapfile doesn't accept input from a pipe

2017-06-29 Thread tetsujin
It's a fair point but I think there may be a reasonable middle-ground, in which common pitfalls are briefly addressed in TFM, but the manual doesn't become bogged down with exhaustive detail of every possible pitfall. After all, information overload would just become another thing preventing read

Re: Feature request: PROMPT_COMMANDS array variable

2018-01-23 Thread tetsujin
Well, PROMPT_COMMAND does take shell syntax, so if this is just a question of getting multiple commands in there, you can separate them with semicolons. That said, I do think using an array would be nicer (mainly, it's easier to manipulate the list of commands programmatically) but then you can't

Re: Directing into a variable doesn't work

2018-06-27 Thread tetsujin
When I initially read this thread, I was concerned about the idea of adding yet another mutation of the redirect syntax. Like how far does this go? Would we introduce a "" someday for some other bit of functionality? Ideally, I think it would be better if this could be done with pipe syntax

Bash feature request: provide state data pointer and unset_func for dynamic variables

2017-05-19 Thread tetsujin
Hi, I think this is probably kind of an unusual request, but you don't get anything you don't ask for, right? So I figure it's worth a shot. Basically, I am working on a library called shell-pepper (it's not too far along at this point) - the general concept is that it's like a grab-bag of functi

Re: {varname} redirection for a command or group leaves the file open

2017-05-19 Thread tetsujin
> On Wed, May 10, 2017 at 8:52 PM, Pierre Gaston wrote: > >_ See:_ > >_ https://lists.gnu.org/archive/html/bug-bash/2012-11/msg00040.html[https://lists.gnu.org/archive/html/bug-bash/2012-11/msg00040.html [1]]_ > >_ Pierre_ > >_ PS: I'm with you ;)_ > > Thanks for the link, I

Re: read -e allows execution of commands (edit-and-execute-command) as the shell's process user

2017-05-30 Thread tetsujin
- Original Message - From: "dualbus" To:"George" Cc:, Sent:Tue, 30 May 2017 09:19:46 -0500 Subject:Re: read -e allows execution of commands (edit-and-execute-command) as the shell's process user On Mon, May 29, 2017 at 11:40:54PM -0400, George wrote: [...] > You misunderstand. Bein

Re: RFE: Please allow unicode ID chars in identifiers

2017-06-02 Thread tetsujin
It's all but impossible to establish an "absolute need" for a new feature. In the extreme case there is always the argument that one does not "absolutely need" a feature added to bash, because one could simply use Bash to launch another tool that provides that feature - code in Python rather than

Re: RFE: Please allow unicode ID chars in identifiers

2017-06-13 Thread tetsujin
Please excuse the top-posting, this mail client isn't very good... To some extent, tying the shell script language to the locale is unavoidable. However, one of the points I was trying to make is that, in principle, at least, this shouldn't be the case. If a script is written in a particular cha

Re: RFE: Please allow unicode ID chars in identifiers

2017-06-13 Thread tetsujin
Well, my own reports have been to the mailing list (and just over the last year) - to be fair, while I haven't necessarily gotten the answers I wanted to hear, I did get answers. :) The "Support" and "Patches" pages on Savannah seem a bit neglected, however. Items from 2011-2015 with no status an

Re: RFE: Please allow unicode ID chars in identifiers

2017-06-13 Thread tetsujin
In that case, the answer is simple: The shell swiftly rejects the script, and provides a clear reason why it cannot be run. ("bash: Script requires the en_US.utf8 locale which is not installed on this system. Sorry, dude.") This, in my opinion, is certainly preferable over the current situation,

Re: Patch for unicode in varnames...

2017-06-13 Thread tetsujin
...Though Apple now sticks to Bash 3.2 to avoid GPL v3 right? Makes 'em kind of an odd use-case, and maybe a bit irrelevant with respect to the future direction of Bash. - Original Message - From: chet.ra...@case.edu To:"L A Walsh" , "Greg Wooledge" Cc:"bug-bash" , Sent:Tue, 13 Jun 2017

RFE: Fix the name collision issues and typing issues with namerefs, improve various issues for function libraries

2017-06-14 Thread tetsujin
This is relevant to my interests! So first off, the circular reference problem with "declare -n" apparently doesn't exist in Korn Shell: If you "typeset -n x=$1", and $1 is "x", it's not a circular reference. The nameref seems to take the origin of the name into account when creating the nameref:

Re: RFE: Fix the name collision issues and typing issues with namerefs, improve various issues for function libraries

2017-06-14 Thread tetsujin
Yeah I didn't really consider ksh's "backward compatible" function syntax in my post because using that form while looking for better support for function libraries would be a needless handicap. You don't even get local variables with the backward-compatible syntax, so there's no hope of getting

Re: RFE: Fix the name collision issues and typing issues with namerefs, improve various issues for function libraries

2017-06-14 Thread tetsujin
I should add the related problem: $ f() { declare -n x=$1; echo "x=$x"; declare y="local Y"; echo "x=$x"; } $ y="global Y" $ f y x=global Y x=local Y In other words, even if you do get a nameref to point to something in the caller's scope, as soon as you shadow that variable with another local v

Re: Why does 'connect' take so long (sometimes) and can't be interrupted?

2017-06-15 Thread tetsujin
I can't think of what could cause this problem. The TCP connection code in Bash seems pretty straightforward, and in my experiments I was able to interrupt it even if it was waiting for the server to accept a connection, or waiting for an available slot in the listen queue. It's possible the probl

RFE: File Descriptor passing and socket pair creation

2017-06-15 Thread tetsujin
Since the subject's come up - difficulties with /dev/tcp, no timeout feature, somehow a failure to interrupt it, etc.  I want to suggest an alternative.  I don't propose removing /dev/tcp from Bash (since it's been there quite a long time, people use it and I'm sure many people like it), but I pro

Re: RFE: Fix the name collision issues and typing issues with namerefs, improve various issues for function libraries

2017-06-19 Thread tetsujin
As a bonus you'd be able to lure the uninitiated into asking questions like "What's upvar?" - Original Message - From: "Greg Wooledge" To:"bug-bash" Cc: Sent:Mon, 19 Jun 2017 08:18:14 -0400 Subject:Re: RFE: Fix the name collision issues and typing issues with namerefs, improve various

Re: [PATCH] Unix domain socket filename redirection

2017-06-20 Thread tetsujin
Unix Domain Sockets form the basis of a lot of the modern forms of Unix/Posix IPC. Compared to using TCP sockets for IPC, Unix Domain sockets allow you to control access to the resource with filesystem permissions, and identify the socket with a file path so you don't have to come up with a system