Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-07-24 Thread Chet Ramey
On 7/23/23 9:20 AM, Rob Landley wrote: $ bash -c $'echo $LINENO\necho $(echo $LINENO\necho $LINENO\n); echo $LINENO' 0 3 4 3 $ bash -c $'echo $LINENO\necho $LINENO $(echo $LINENO\necho $LINENO\n); echo $LINENO' 0 1 1 2 3 Why does the 3 4 turn into 1 2? (Where does it get "3" from the first

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-07-23 Thread Rob Landley
On 6/30/23 19:57, Rob Landley wrote: >> On 6/12/23 19:40, Chet Ramey wrote: >>> I wish you were not so reluctant. Look at how many things you've discovered >>> that I decided were bugs based on our discussions. >> >> But since you asked, today's new question I wrestled with was $ bash -c $'echo

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-07-11 Thread Chet Ramey
On 7/10/23 5:57 PM, enh wrote: > iirc we even _tried_ -1/ENOSYS to test the predictions that (a) most c > programmers don't check for failures (b) even those that do don't log > enough to be able to debug these problems It penalizes those who do. yeah, but we optimize

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-07-11 Thread Rob Landley
On 7/10/23 16:57, enh wrote: > and i think that's the cross-purpose we're talking at here ... the 99% case is > app code... > the kind of collaborative command-line debugging over a mailing list that > you're > familiar with doesn't exist for the TikToks of this world. There's no amount of

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-07-10 Thread enh via Toybox
On Sun, Jul 9, 2023 at 5:54 PM Chet Ramey wrote: > On 7/7/23 6:45 PM, enh wrote: > > > > define "mess up"... > > > > Maybe "mess up" was too strong. I think it's rude to send a fatal > signal if > > you have the function. Either don't provide it or make it return > -1/ENOSYS. > >

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-07-10 Thread Chet Ramey
On 7/8/23 7:41 AM, Rob Landley wrote: On 7/6/23 20:09, Chet Ramey wrote: ... Distinguishing : from true seems deeply silly true wasn't a special builtin in the Bourne shell. It isn't because it wasn't. Historical reasons, no other pattern or logic. Is there pattern or logic in the

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-07-10 Thread Chet Ramey
On 7/9/23 7:43 PM, Rob Landley wrote: On 6/18/23 16:28, Rob Landley wrote: On 6/12/23 19:40, Chet Ramey wrote: I wish you were not so reluctant. Look at how many things you've discovered that I decided were bugs based on our discussions. But since you asked, today's new question I wrestled

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-07-09 Thread Chet Ramey
On 7/7/23 6:45 PM, enh wrote: > define "mess up"... Maybe "mess up" was too strong. I think it's rude to send a fatal signal if you have the function. Either don't provide it or make it return -1/ENOSYS. Android is by no means the only place this is a problem; it happens with

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-07-09 Thread Rob Landley
On 6/18/23 16:28, Rob Landley wrote: > On 6/12/23 19:40, Chet Ramey wrote: >> I wish you were not so reluctant. Look at how many things you've discovered >> that I decided were bugs based on our discussions. > > But since you asked, today's new question I wrestled with was What happens when you

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-07-08 Thread Rob Landley
On 7/6/23 20:09, Chet Ramey wrote: > On 7/5/23 3:29 AM, Rob Landley wrote: > It's really a useless concept, by the way. It's not that simple: kill has to be built-in or it can't interface with job control... >>> >>> That's not what a special builtin is. `kill' is a

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-07-07 Thread enh via Toybox
On Fri, Jul 7, 2023 at 1:43 PM Chet Ramey wrote: > On 7/7/23 3:29 PM, enh wrote: > > > cd is a weird one. The v7 Bourne shell exited the shell if the > directory > > argument didn't exist, and that didn't change until SVR4.2, > > > > > > and people complain unix isn't user-friendly...

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-07-07 Thread Chet Ramey
On 7/7/23 3:29 PM, enh wrote: cd is a weird one. The v7 Bourne shell exited the shell if the directory argument didn't exist, and that didn't change until SVR4.2, and people complain unix isn't user-friendly... :-) Ha. Sometimes they write books on the subject. > I know

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-07-07 Thread enh via Toybox
On Thu, Jul 6, 2023 at 6:09 PM Chet Ramey wrote: > On 7/5/23 3:29 AM, Rob Landley wrote: > > > It's really a useless concept, by the way. > >>> > >>> It's not that simple: kill has to be built-in or it can't interface > with job > >>> control... > >> > >> That's not what a special builtin

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-07-06 Thread Chet Ramey
On 7/5/23 3:29 AM, Rob Landley wrote: It's really a useless concept, by the way. It's not that simple: kill has to be built-in or it can't interface with job control... That's not what a special builtin is. `kill' is a `regular builtin' anyway. I started down the "rereading that mess"

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-07-05 Thread David Seikel
On 2023-07-05 02:29:39, Rob Landley wrote: > >> still matching the behavior in my devuan install. (Still devuan bronchitis, > >> haven't updated to devuan cholera yet. Um, the web page says devuan B > >> matches > >> debian "buster" and devuan C matches "bullseye", if that helps.) > > > > Not at

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-07-05 Thread Rob Landley
I have a window open with a half-finished reply in it, and if I've already replied to this email I apologize... On 6/19/23 18:32, Chet Ramey wrote: > On 6/17/23 7:23 PM, Rob Landley wrote: >> On 6/12/23 19:40, Chet Ramey wrote: and they have a list of "special built-in utilities" that does

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-07-01 Thread Chet Ramey
On 6/30/23 8:57 PM, Rob Landley wrote: On 6/12/23 19:40, Chet Ramey wrote: I wish you were not so reluctant. Look at how many things you've discovered that I decided were bugs based on our discussions. But since you asked, today's new question I wrestled with was Why does eval "" clear $?

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-06-30 Thread Rob Landley
> On 6/12/23 19:40, Chet Ramey wrote: >> I wish you were not so reluctant. Look at how many things you've discovered >> that I decided were bugs based on our discussions. > > But since you asked, today's new question I wrestled with was Why does eval "" clear $? when a normal newline doesn't, and

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-06-21 Thread Chet Ramey
On 6/18/23 5:28 PM, Rob Landley wrote: Where did the FF come from? $ bash -c $'cat<<0\n\\' | hd bash: line 1: warning: here-document at line 0 delimited by end-of-file (wanted `0') 5c ff 0a |\..| 0003 If I had to guess, I'd say the EOF

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-06-19 Thread Chet Ramey
On 6/17/23 7:23 PM, Rob Landley wrote: On 6/12/23 19:40, Chet Ramey wrote: and they have a list of "special built-in utilities" that does NOT include cd (that's listed in normal utilities: how would one go about implementing that outside of the shell, do you think?) That's not what a special

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-06-18 Thread Rob Landley
> On 6/12/23 19:40, Chet Ramey wrote: >> I wish you were not so reluctant. Look at how many things you've discovered >> that I decided were bugs based on our discussions. > > But since you asked, today's new question I wrestled with was Where did the FF come from? $ bash -c $'cat<<0\n\\' | hd

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-06-17 Thread Rob Landley
On 6/12/23 19:40, Chet Ramey wrote: >> and they have a list of "special built-in utilities" that does NOT include cd >> (that's listed in normal utilities: how would one go about implementing that >> outside of the shell, do you think?) > > That's not what a special builtin means. alias,

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-06-12 Thread Chet Ramey
On 6/12/23 5:23 PM, Rob Landley wrote: On 6/9/23 15:23, Chet Ramey wrote: On 6/8/23 10:31 PM, Rob Landley wrote: On 6/5/23 18:08, Chet Ramey wrote: You got me. You're right; I had it backwards. I'm not trying to gotcha anybody, I'm just trying to understand what the right thing to implement

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-06-12 Thread Rob Landley
On 6/9/23 15:23, Chet Ramey wrote: > On 6/8/23 10:31 PM, Rob Landley wrote: >> On 6/5/23 18:08, Chet Ramey wrote: > You got me. You're right; I had it backwards. I'm not trying to gotcha anybody, I'm just trying to understand what the right thing to implement is. I find this entire area

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-06-09 Thread Chet Ramey
On 6/8/23 10:31 PM, Rob Landley wrote: On 6/5/23 18:08, Chet Ramey wrote: But escaping a _newline_ is funny in that it glues lines together instead of creating a command line argument out of the result, which means it has to be special cased and obviously I'm special casing it wrong, but the

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-06-08 Thread Rob Landley
On 6/5/23 18:08, Chet Ramey wrote: >> But escaping a _newline_ is funny in that it glues lines together instead of >> creating a command line argument out of the result, which means it has to be >> special cased and obviously I'm special casing it wrong, but the special case >> has multiple

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-06-05 Thread Chet Ramey
On 6/5/23 1:04 AM, Rob Landley wrote: On 6/1/23 10:20, Chet Ramey wrote: On 5/29/23 12:39 PM, Rob Landley wrote: But I'm still left with this divergence: $ ./sh -c 'echo abc\' abc $ bash -c 'echo abc\' abc\ The backslash doesn't escape anything, EOF delimits the token and

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-06-04 Thread Rob Landley
On 6/1/23 10:20, Chet Ramey wrote: > On 5/29/23 12:39 PM, Rob Landley wrote: > >> But I'm still left with this divergence: >> >>$ ./sh -c 'echo abc\' >>abc >>$ bash -c 'echo abc\' >>abc\ > > The backslash doesn't escape anything, EOF delimits the token and command, > and the

[Toybox] [PATCH] sh: pass "\" to the later app

2023-06-01 Thread Mingliang HU 胡明亮 via Toybox
Here is failed case for “echo -e "a\n\b\nc\td". The expected result is: a c d The current result is: anbnctd The patch let sh pass “\” to “echo”. Then it works fine. Mingliang 0001-sh-pass-to-the-later-app.patch Description: 0001-sh-pass-to-the-later-app.patch

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-06-01 Thread Chet Ramey
On 5/29/23 12:39 PM, Rob Landley wrote: But I'm still left with this divergence: $ ./sh -c 'echo abc\' abc $ bash -c 'echo abc\' abc\ The backslash doesn't escape anything, EOF delimits the token and command, and the backslash remains in place for echo to process (or not).

Re: [Toybox] [PATCH] sh: pass "\" to the later app

2023-05-29 Thread Rob Landley
On 5/29/23 02:19, Mingliang HU 胡明亮 wrote: > Here is failed case for “echo -e "a\n\b\nc\td". > > The expected result is: > > a > > c   d You're missing a "b" there, but I get the general idea. > The current result is: > > anbnctd Yeah, that's wrong. > The patch let sh pass “\” to