Re: Fwd: Re: interactive shell detection in shrc

2024-09-24 Thread RVP
On Tue, 24 Sep 2024, RVP wrote: | if "${___SHRC:-:}" A syntax error of yours? No, that becomes `if ":" ...' $___SHRC is undefined or empty. You need to write it that way, else it's a syntax error. Sorry, I meant to say a "command not found" error (when trying to execute an empty string

Re: Fwd: Re: interactive shell detection in shrc

2024-09-24 Thread RVP
On Tue, 24 Sep 2024, Steffen Nurpmeso wrote: Robert Elz wrote in <7132.1727161...@jacaranda.noi.kre.to>: |Date:Tue, 24 Sep 2024 00:56:40 +0200 [...] | if $___SHRC Oh, i would be afraid of doing this implicit test. I no longer have many shells around, not even as source code, so i w

Fwd: Re: interactive shell detection in shrc

2024-09-24 Thread Steffen Nurpmeso
--- Forwarded from Steffen Nurpmeso --- Date: Tue, 24 Sep 2024 22:26:34 +0200 Author: Steffen Nurpmeso From: Steffen Nurpmeso To: Robert Elz Cc: Valery Ushakov Subject: Re: interactive shell detection in shrc Message-ID: <20240924202634.-Z-0KGXP@steffen%sdaoden.eu> Robert Elz wrote in <7132.

Re: interactive shell detection in shrc

2024-09-24 Thread Steffen Nurpmeso
Robert Elz wrote in <23334.1727160...@jacaranda.noi.kre.to>: |Date:Tue, 24 Sep 2024 03:06:49 +0300 |From:Valery Ushakov |Message-ID: | || I also wanted to drop the ${1+"$@"} workaroud for the v7 shell bug || which I'm pretty sure we are not going to hit in this

Re: sh(1) read: add LINE_MAX safeguard and "-n" option

2024-09-24 Thread tlaronde
On Wed, Sep 25, 2024 at 12:18:28AM +0700, Robert Elz wrote: > > It isn't possible. Actually using \ as the delimiter (without > -r anyway) makes little sense at all, but that doesn't mean it > needs to be prohibited. Then, this is another thing that has to be corrected in POSIX, issue 8: ---8<

Re: sh(1) read: add LINE_MAX safeguard and "-n" option

2024-09-24 Thread Robert Elz
Date:Tue, 24 Sep 2024 17:30:42 +0200 From:tlaro...@kergis.com Message-ID: | In the present code, a delimiter can not be "any character": because | if the delimiter is the backslash, what shall be the behavior? That isn't even a half an issue ... the read reads ch

Re: sh(1) read: add LINE_MAX safeguard and "-n" option

2024-09-24 Thread Robert Elz
Date:Tue, 24 Sep 2024 14:27:48 +0200 From:tlaro...@kergis.com Message-ID: | This can be solved by resetting nread to 0 when an actual end-of-line | is reached and escaped. I think it better to just not have a limit in the normal case, it serves no purpose, except

Re: sh(1) read: add LINE_MAX safeguard and "-n" option

2024-09-24 Thread Robert Elz
Date:Tue, 24 Sep 2024 09:09:29 -0400 From:Greg Troxel Message-ID: | Sure, but the problem is that if you have a file which is e.g one line | (single \n at end) that is 10 MB, read from it is unreasonable, and it's | difficult to deal with this in portable code.

Re: sh(1) read: add LINE_MAX safeguard and "-n" option

2024-09-24 Thread tlaronde
On Tue, Sep 24, 2024 at 06:54:35PM +0700, Robert Elz wrote: > Date:Tue, 24 Sep 2024 12:56:49 +0200 > From: > Message-ID: > > | The present patch does two things: > | > | 1) Set, by default, the maximum of bytes read, in every case, as being > | LINE_MAX (the m

Re: sh(1) read: add LINE_MAX safeguard and "-n" option

2024-09-24 Thread tlaronde
On Tue, Sep 24, 2024 at 09:09:29AM -0400, Greg Troxel wrote: > Robert Elz writes: > > > Date:Tue, 24 Sep 2024 12:56:49 +0200 > > From: > > Message-ID: > > > > | The present patch does two things: > > | > > | 1) Set, by default, the maximum of bytes read, in eve

Re: sh(1) read: add LINE_MAX safeguard and "-n" option

2024-09-24 Thread Greg Troxel
Robert Elz writes: > Date:Tue, 24 Sep 2024 12:56:49 +0200 > From: > Message-ID: > > | The present patch does two things: > | > | 1) Set, by default, the maximum of bytes read, in every case, as being > | LINE_MAX (the maximum number of bytes in a line in a te

Re: sh(1) read: add LINE_MAX safeguard and "-n" option

2024-09-24 Thread tlaronde
On Tue, Sep 24, 2024 at 06:54:35PM +0700, Robert Elz wrote: > Date:Tue, 24 Sep 2024 12:56:49 +0200 > From: > Message-ID: > > | The present patch does two things: > | > | 1) Set, by default, the maximum of bytes read, in every case, as being > | LINE_MAX (the m

Re: sh(1) read: add LINE_MAX safeguard and "-n" option

2024-09-24 Thread Robert Elz
Date:Tue, 24 Sep 2024 12:56:49 +0200 From: Message-ID: | The present patch does two things: | | 1) Set, by default, the maximum of bytes read, in every case, as being | LINE_MAX (the maximum number of bytes in a line in a text file); I am not really in favour

sh(1) read: add LINE_MAX safeguard and "-n" option

2024-09-24 Thread tlaronde
The intrinsics built-in read was specified in earlier POSIX to treat text file, that are supposed to end with a newline. It has been relaxed to take into account usage and implementation, allowing to treat as input a file without a newline. Problem arise when read is used, for example in pkgsrc u

Re: interactive shell detection in shrc

2024-09-24 Thread Robert Elz
Date:Tue, 24 Sep 2024 03:06:49 +0300 From:Valery Ushakov Message-ID: | I also wanted to drop the ${1+"$@"} workaroud for the v7 shell bug | which I'm pretty sure we are not going to hit in this day and age on a | NetBSD system, but I won't to get down that rabb

Re: interactive shell detection in shrc

2024-09-24 Thread Robert Elz
Date:Tue, 24 Sep 2024 00:56:40 +0200 From:Steffen Nurpmeso Message-ID: <20240923225640.BZkYDiMv@steffen%sdaoden.eu> | and then (in ~/.shrc) | | eval "___isinc=\$___SHRC$$" | if [ -z "${___isinc}" ]; then | eval "___SHRC${$}=YES" | e