Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Quantum Mechanics is God's version of "Trust me."


devel / comp.lang.awk / GAWK documentation error: PROCINFO[command,"pty"]

SubjectAuthor
* GAWK documentation error: PROCINFO[command,"pty"]Kenny McCormack
+* Re: GAWK documentation error: PROCINFO[command,"pty"]Janis Papanagnou
|`* Re: GAWK documentation error: PROCINFO[command,"pty"]Kenny McCormack
| `- Re: GAWK documentation error: PROCINFO[command,"pty"]Janis Papanagnou
`- Re: GAWK documentation error: PROCINFO[command,"pty"]Andrew Schorr

1
GAWK documentation error: PROCINFO[command,"pty"]

<stbbpa$3t9hk$1@news.xmission.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1034&group=comp.lang.awk#1034

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.awk
Subject: GAWK documentation error: PROCINFO[command,"pty"]
Date: Tue, 1 Feb 2022 13:15:22 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <stbbpa$3t9hk$1@news.xmission.com>
Injection-Date: Tue, 1 Feb 2022 13:15:22 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="4105780"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Tue, 1 Feb 2022 13:15 UTC

"man gawk" (for Gawk 5.0) says:

PROCINFO["command", "pty"]
Use a pseudo-tty for two-way communication with
command instead of setting up two one-way pipes.

Prior to that, it says "These variables may be set to control ...", but
doesn't really say what to set them to. Normally, this sort of phrasing
implies that setting them to anything - i.e., just causing them to exist -
will qualify as "being set".

However, experimentation shows that here, the variable needs to be set to a
non-zero value in order to take effect. If is set to 0 or "", it will not
use a pty.

Use the following program to test:

$ gawk 'BEGIN { cmd="tty";PROCINFO[cmd,"pty"];cmd |& getline;print }'
not a tty
$ gawk 'BEGIN { cmd="tty";PROCINFO[cmd,"pty"]=0;cmd |& getline;print }'
not a tty
$ gawk 'BEGIN { cmd="tty";PROCINFO[cmd,"pty"]=1;cmd |& getline;print }'
/dev/pts/N

This should either be fixed in the documentation or fixed in the code
(i.e., the code changed so that merely setting it is enough).

--
He must be a Muslim. He's got three wives and he doesn't drink.

Re: GAWK documentation error: PROCINFO[command,"pty"]

<stbfeu$7p4$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1035&group=comp.lang.awk#1035

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.awk
Subject: Re: GAWK documentation error: PROCINFO[command,"pty"]
Date: Tue, 1 Feb 2022 15:18:05 +0100
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <stbfeu$7p4$1@dont-email.me>
References: <stbbpa$3t9hk$1@news.xmission.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 1 Feb 2022 14:18:06 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="104b6dee84ab88669742ec376381c132";
logging-data="7972"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3yux0B5Yh2L0jK+t1Txun"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:pX6l6htB+iZlqo6kE4axmGFU7b8=
In-Reply-To: <stbbpa$3t9hk$1@news.xmission.com>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Tue, 1 Feb 2022 14:18 UTC

On 01.02.2022 14:15, Kenny McCormack wrote:
> "man gawk" (for Gawk 5.0) says:
>
>
> PROCINFO["command", "pty"]
> Use a pseudo-tty for two-way communication with
> command instead of setting up two one-way pipes.
>
> Prior to that, it says "These variables may be set to control ...", but
> doesn't really say what to set them to. Normally, this sort of phrasing
> implies that setting them to anything - i.e., just causing them to exist -
> will qualify as "being set".

Just a nitpick...
PROCINFO["command", "pty"] makes it already "exist", just its value
is unset; the predicate (cmd,"pty") in PROCINFO evaluates to true.
Assigning an undefined variable x as in PROCINFO["command", "pty"] = x
will also make it exist, but will still have its value status 'unset'.
If variable x has a defined value then its value is set, but the outcome
depends; as you say, values of 0 or "" will not activate the feature.
We have a couple possible states; existing, unset, set, non-null set.
The 'set' state is indeed irrelevant, and using that word misleading,
I agree.

Janis

>
> However, experimentation shows that here, the variable needs to be set to a
> non-zero value in order to take effect. If is set to 0 or "", it will not
> use a pty.
>
> Use the following program to test:
>
> $ gawk 'BEGIN { cmd="tty";PROCINFO[cmd,"pty"];cmd |& getline;print }'
> not a tty
> $ gawk 'BEGIN { cmd="tty";PROCINFO[cmd,"pty"]=0;cmd |& getline;print }'
> not a tty
> $ gawk 'BEGIN { cmd="tty";PROCINFO[cmd,"pty"]=1;cmd |& getline;print }'
> /dev/pts/N
>
> This should either be fixed in the documentation or fixed in the code
> (i.e., the code changed so that merely setting it is enough).
>

Re: GAWK documentation error: PROCINFO[command,"pty"]

<stbi7d$3tca0$1@news.xmission.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1036&group=comp.lang.awk#1036

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.awk
Subject: Re: GAWK documentation error: PROCINFO[command,"pty"]
Date: Tue, 1 Feb 2022 15:05:17 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <stbi7d$3tca0$1@news.xmission.com>
References: <stbbpa$3t9hk$1@news.xmission.com> <stbfeu$7p4$1@dont-email.me>
Injection-Date: Tue, 1 Feb 2022 15:05:17 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="4108608"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Tue, 1 Feb 2022 15:05 UTC

In article <stbfeu$7p4$1@dont-email.me>,
Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
>On 01.02.2022 14:15, Kenny McCormack wrote:
>> "man gawk" (for Gawk 5.0) says:
>>
>>
>> PROCINFO["command", "pty"]
>> Use a pseudo-tty for two-way communication with
>> command instead of setting up two one-way pipes.
>>
>> Prior to that, it says "These variables may be set to control ...", but
>> doesn't really say what to set them to. Normally, this sort of phrasing
>> implies that setting them to anything - i.e., just causing them to exist -
>> will qualify as "being set".
>
>Just a nitpick...
>PROCINFO["command", "pty"] makes it already "exist", just its value
....
>The 'set' state is indeed irrelevant, and using that word misleading,
>I agree.

Agreed.

The general point of this thread is that it is impossible to figure out
what works (I.e., what you have to do) from the text. You have to resort
to experimentation to figure it out.

For me, the issue is that I use this particular bit of functionality so
rarely that I have to look it up each time, and then end up doing the
experiments all over again each time.

--
I am not a troll.
Rick C. Hodgin
I am not a crook.
Rick M. Nixon

Re: GAWK documentation error: PROCINFO[command,"pty"]

<stblb0$igh$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1037&group=comp.lang.awk#1037

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.awk
Subject: Re: GAWK documentation error: PROCINFO[command,"pty"]
Date: Tue, 1 Feb 2022 16:58:23 +0100
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <stblb0$igh$1@dont-email.me>
References: <stbbpa$3t9hk$1@news.xmission.com> <stbfeu$7p4$1@dont-email.me>
<stbi7d$3tca0$1@news.xmission.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 1 Feb 2022 15:58:24 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="104b6dee84ab88669742ec376381c132";
logging-data="18961"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+fT3XuuHVjzCagVthe4vrw"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:nEB3xpL+4k3DuewB4I+pWXXugrk=
In-Reply-To: <stbi7d$3tca0$1@news.xmission.com>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Tue, 1 Feb 2022 15:58 UTC

On 01.02.2022 16:05, Kenny McCormack wrote:
>
> The general point of this thread is that it is impossible to figure out
> what works (I.e., what you have to do) from the text. You have to resort
> to experimentation to figure it out.
>
> For me, the issue is that I use this particular bit of functionality so
> rarely that I have to look it up each time, and then end up doing the
> experiments all over again each time.

Absolutely understandable. Myself I had discussions in the past about
map and set semantics implemented by set[value] and map[key] = value
respectively. Arnold preferred for the former also set[value] = 1 and
said it's better to use an explicit (but _arbitrary_, non-0) value to
indicate existence, where I prefer a 'key in map' predicate instead.
Such philosophy/thoughts about design lets me usually _assume_ explicit
settings of non-null values to activate things in GNU Awk and I am not
too surprised. Notwithstanding should that behavior be reflected by a
proper description. There's no dissent here.

Janis

Re: GAWK documentation error: PROCINFO[command,"pty"]

<f244cf2b-87a8-466e-a963-22d44849b55fn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1043&group=comp.lang.awk#1043

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:a05:622a:18e:: with SMTP id s14mr24795682qtw.391.1643847012974;
Wed, 02 Feb 2022 16:10:12 -0800 (PST)
X-Received: by 2002:a0d:eb0b:: with SMTP id u11mr2813882ywe.75.1643847012685;
Wed, 02 Feb 2022 16:10:12 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.awk
Date: Wed, 2 Feb 2022 16:10:12 -0800 (PST)
In-Reply-To: <stbbpa$3t9hk$1@news.xmission.com>
Injection-Info: google-groups.googlegroups.com; posting-host=38.76.0.51; posting-account=n5ws7AoAAADMJDAWfsygCPkNAonhHPfT
NNTP-Posting-Host: 38.76.0.51
References: <stbbpa$3t9hk$1@news.xmission.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f244cf2b-87a8-466e-a963-22d44849b55fn@googlegroups.com>
Subject: Re: GAWK documentation error: PROCINFO[command,"pty"]
From: aschorr@telemetry-investments.com (Andrew Schorr)
Injection-Date: Thu, 03 Feb 2022 00:10:12 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 21
 by: Andrew Schorr - Thu, 3 Feb 2022 00:10 UTC

On Tuesday, February 1, 2022 at 8:15:25 AM UTC-5, Kenny McCormack wrote:
> "man gawk" (for Gawk 5.0) says:
>
>
> PROCINFO["command", "pty"]
> Use a pseudo-tty for two-way communication with
> command instead of setting up two one-way pipes.

I see your point. It does say "the following elements may be SET by a program to
change gawk's behavior" (emphasis mine). And there's similar language in the
info docs. I think it's supposed to be implicit that this is evaluated as a typical awk
boolean value, i.e. it's true if it's nonzero or non-null. I tend to agree that the language
could be more explicit.

Also, the info docs include a couple of examples clearly showing the value being
set to 1. So if you look there, you will see how to use it.

If you feel this is a bug, please report it to the gawk bug mailing list. This is
not the ideal forum for reporting bugs.

Regards,
Andy

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor