Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

To the systems programmer, users and applications serve only to provide a test load.


devel / comp.unix.programmer / Re: popen() and r+

SubjectAuthor
* popen() and r+Muttley
+* Re: popen() and r+Kaz Kylheku
|+- Re: popen() and r+Muttley
|`* Re: popen() and r+Nicolas George
| +* Re: popen() and r+Muttley
| |`* Re: popen() and r+Nicolas George
| | +- Re: popen() and r+Muttley
| | `* Re: popen() and r+Kenny McCormack
| |  `* Re: popen() and r+Scott Lurndal
| |   +- Re: popen() and r+Kenny McCormack
| |   `* Re: popen() and r+Muttley
| |    `* Re: popen() and r+Scott Lurndal
| |     `- Re: popen() and r+Muttley
| `* Re: popen() and r+Kaz Kylheku
|  `- Re: popen() and r+Muttley
`* Re: popen() and r+Scott Lurndal
 +* Re: popen() and r+Muttley
 |+* Re: popen() and r+Kenny McCormack
 ||`- Re: popen() and r+Muttley
 |`* Re: popen() and r+Kaz Kylheku
 | `* Re: popen() and r+Geoff Clare
 |  +- Re: popen() and r+Nicolas George
 |  `- Re: popen() and r+Kaz Kylheku
 `* Re: popen() and r+Nicolas George
  `* Re: popen() and r+Muttley
   `* Re: popen() and r+Geoff Clare
    `- Re: popen() and r+Muttley

Pages:12
Re: popen() and r+

<tpmpku$16c4$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17440&group=comp.unix.programmer#17440

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!aioe.org!QImplQW63EVMF2Hp+OxW0A.user.46.165.242.91.POSTED!not-for-mail
From: Muttley@dastardlyhq.com
Newsgroups: comp.unix.programmer
Subject: Re: popen() and r+
Date: Wed, 11 Jan 2023 16:54:54 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <tpmpku$16c4$1@gioia.aioe.org>
References: <tpgnk9$5sq$1@gioia.aioe.org> <20230109030226.641@kylheku.com>
<63bc021f$0$22249$426a74cc@news.free.fr>
<20230111022557.476@kylheku.com>
Injection-Info: gioia.aioe.org; logging-data="39300"; posting-host="QImplQW63EVMF2Hp+OxW0A.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
 by: Muttley@dastardlyhq.com - Wed, 11 Jan 2023 16:54 UTC

On Wed, 11 Jan 2023 10:40:06 -0000 (UTC)
Kaz Kylheku <864-117-4973@kylheku.com> wrote:
>On 2023-01-09, Nicolas George <nicolas$george@salle-s.org> wrote:
>> Kaz Kylheku , dans le message <20230109030226.641@kylheku.com>, a
>> écrit :
>>> However, if some trailing part of your request is sitting in a buffer,
>>> such that lp is waiting for that last bit before replying, then you have
>>> a deadlock.
>>
>> I would guess it is not enough: lp is probably waiting for EOF, and there is
>> no way to close only half of a popen stream.
>
>That's a great observation.
>
>Now the "r+" mode is not portable to begin with.
>
>The POSIX model of standard I/O streams is such that a stream has one
>underlying descriptor, accessible via fileno.
>
>Suppose an implementation implements a bidirectional popen using only
>one descriptor, such that the descriptor returned by fileno is all there
>is; that object handles both data transfer directions.
>
>Such an implementation is quite possibly using the socketpair function
>to creae the bidirectional descriptor.
>
>And so if socketpair is being used, then it should be possible to use
>shutdown on the descriptor to do a half-close.
>
>As in:
>
> // write data to lp ...
>
> // send everything to socket
> fflush(pipe_stream);
>
> // close in writing direction
> if (shutdown(fileno(pipe_stream), SHUT_WR) != 0)
> {
> // didn't work: not a socket?
> }
>
>It's worth a try.

Tried, didn't work. feof() was always true and fgets() returned garbage. :(

Re: popen() and r+

<20230111212307.115@kylheku.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17441&group=comp.unix.programmer#17441

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: 864-117-4973@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.programmer
Subject: Re: popen() and r+
Date: Thu, 12 Jan 2023 05:23:42 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <20230111212307.115@kylheku.com>
References: <tpgnk9$5sq$1@gioia.aioe.org>
<a8XuL.575788$GNG9.424370@fx18.iad> <tphh1a$q5j$1@gioia.aioe.org>
<20230111024122.143@kylheku.com>
<p1r29j-29d.ln1@ID-313840.user.individual.net>
Injection-Date: Thu, 12 Jan 2023 05:23:42 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="d99206896d2c543257280c53b772a82e";
logging-data="1264742"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/YMHxFsTxHnxaTtN+XaZygt/m0T6h8QBI="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:dOz9hXO/DW/E1uIQYQFeuG71oLE=
 by: Kaz Kylheku - Thu, 12 Jan 2023 05:23 UTC

On 2023-01-11, Geoff Clare <geoff@clare.See-My-Signature.invalid> wrote:
> Kaz Kylheku wrote:
>
>> 2. The bidirectional pipe is actually a socket pair.
>
> This would not conform to POSIX, as fstat() would show S_ISSOCK(st_mode)
> true instead of S_ISFIFO(st_mode).

Sure, but the behavior "r+" in popen is unspecified.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Pages:12
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor