Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #36002

Re: Don't be a bit-twiddling monkey

From "Rod Pemberton" <buzz@notnotnontnooatno.cmm>
Newsgroups comp.lang.forth
Subject Re: Don't be a bit-twiddling monkey
Date 2015-01-25 01:37 -0500
Organization Aioe.org NNTP Server
Message-ID <op.xsz909xsv6dtjm@localhost> (permalink)
References (1 earlier) <op.xsx2bf2ov6dtjm@localhost> <a2a29e94-ef39-45f9-9367-0fcbf48978e2@googlegroups.com> <55204dd8-646b-4caa-bd35-adc3b38bb43f@googlegroups.com> <op.xszgdvu2v6dtjm@localhost> <43ae5ff4-4eba-4379-aa1b-74dd6382d173@googlegroups.com>

Show all headers | View raw


On Sat, 24 Jan 2015 17:32:17 -0500, Julian Fondren  
<julian.fondren@gmail.com> wrote:

> popen() is a POSIX function that lets you communicate with a
> subprocess on your choice of stdin or stdout.  popen2(), and
> popen3(), as named by every single person who has approached
> the problem ever, not just Python people, are non-POSIX
> functions that allow you to communicate with a subprocess on
> on *both* stdout and stdin or on *all* of stdout, stdin, and
> stderr.

Can't you do that with any child process?  Aren't all open
file descriptors which includes stdin, stdout, stderr,
inherited by child processes for fork() or spawn() or system()?
I know they are for DOS.  For DOS, this is limited to the
first twenty.

> Basically, you use dup2() in a child process to replace
> stdin and stdout (and stderr) with the ends of a pipes
> before exec()ing.

This I understand.  DOS doesn't have popen().

> To use the 'mysql' binary for access to MySQL, I thought
> popen2() was needed because the only secure way to pass a
> password to it was through stdin.  I ended up using a
> defaults file to pass the password, and stdin to pass the
> (possibly quite long) query.

I would *assume* (since I've never done this ...) that you
could write directly to stdin from the parent, _if_ the
child inherits open file descriptors.

I'm not sure if that is any more or less secure than a pipe.
The pipe probably hides output from being displayed on the
terminal, but it's contents are probably not encrypted and
present in memory or on disk.

Or, perhaps, you could open an additional file to use as
a private stdin since it should be shared/inherited,
perhaps a tmpfile() which is typically implemented in memory.

You might look for a get character function which doesn't
echo (display) the character on stdout.  E.g., DOS has
DOS specific get character functions which don't echo.
Although, I'm not sure if Linux or POSIX does ...  It might
be available as a terminal control sequence instead.

Do you control the method that the database is accessed to
eliminate the need for the password or change the process?


Rod Pemberton

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Don't be a bit-twiddling monkey "WJ" <w_a_x_man@yahoo.com> - 2015-01-24 01:14 +0000
  Re: Don't be a bit-twiddling monkey "Rod Pemberton" <buzz@notnotnontnooatno.cmm> - 2015-01-23 20:55 -0500
    Re: Don't be a bit-twiddling monkey Jason Damisch <jasondamisch@yahoo.com> - 2015-01-24 07:52 -0800
      Re: Don't be a bit-twiddling monkey Julian Fondren <julian.fondren@gmail.com> - 2015-01-24 08:42 -0800
        Re: Don't be a bit-twiddling monkey Paul Rubin <no.email@nospam.invalid> - 2015-01-24 09:10 -0800
        Re: Don't be a bit-twiddling monkey "Rod Pemberton" <buzz@notnotnontnooatno.cmm> - 2015-01-24 14:57 -0500
          Re: Don't be a bit-twiddling monkey Julian Fondren <julian.fondren@gmail.com> - 2015-01-24 14:32 -0800
            Re: Don't be a bit-twiddling monkey "Rod Pemberton" <buzz@notnotnontnooatno.cmm> - 2015-01-25 01:37 -0500
              Re: Don't be a bit-twiddling monkey Julian Fondren <julian.fondren@gmail.com> - 2015-01-24 23:32 -0800
                Re: Don't be a bit-twiddling monkey Bernd Paysan <bernd.paysan@gmx.de> - 2015-01-25 21:23 +0100
          Re: Don't be a bit-twiddling monkey "Elizabeth D. Rather" <erather@forth.com> - 2015-01-24 21:22 -1000
            Re: Don't be a bit-twiddling monkey empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> - 2015-01-25 17:52 +0000
              Re: Don't be a bit-twiddling monkey anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-01-26 14:15 +0000
                Re: Don't be a bit-twiddling monkey empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> - 2015-01-26 19:59 +0000
                Re: Don't be a bit-twiddling monkey "Rod Pemberton" <buzz@notnotnontnooatno.cmm> - 2015-01-28 22:30 -0500
              Re: Don't be a bit-twiddling monkey albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-01-26 18:24 +0000
                Re: Don't be a bit-twiddling monkey empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> - 2015-01-26 19:58 +0000
                Re: Don't be a bit-twiddling monkey "Elizabeth D. Rather" <erather@forth.com> - 2015-01-26 11:27 -1000
                Re: Don't be a bit-twiddling monkey empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> - 2015-01-26 21:52 +0000
                Re: Don't be a bit-twiddling monkey "Elizabeth D. Rather" <erather@forth.com> - 2015-01-26 18:01 -1000
                Re: Don't be a bit-twiddling monkey empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> - 2015-01-27 10:47 +0000
                Re: Don't be a bit-twiddling monkey foxaudioresearch@gmail.com - 2015-01-27 19:08 -0800
                Re: Don't be a bit-twiddling monkey empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> - 2015-01-28 12:06 +0000
                Re: Don't be a bit-twiddling monkey Lars Brinkhoff <lars.spam@nocrew.org> - 2015-01-28 13:18 +0100
                Re: Don't be a bit-twiddling monkey Michael Barry <barrym95838@yahoo.com> - 2015-01-28 08:14 -0800
                Re: Don't be a bit-twiddling monkey Lars Brinkhoff <lars.spam@nocrew.org> - 2015-01-28 18:53 +0100
                Re: Don't be a bit-twiddling monkey Paul E Bennett <Paul_E.Bennett@topmail.co.uk> - 2015-01-28 22:14 +0000
                Re: Don't be a bit-twiddling monkey Lars Brinkhoff <lars.spam@nocrew.org> - 2015-01-29 08:14 +0100
                Re: Don't be a bit-twiddling monkey empty-buffers <empty.buffersYOU-DONT-WANT-THIS@gmail.NEITHER-THIS.com> - 2015-01-29 00:21 +0000
                Re: Don't be a bit-twiddling monkey "Rod Pemberton" <buzz@notnotnontnooatno.cmm> - 2015-01-28 20:05 -0500
                Re: Don't be a bit-twiddling monkey Coos Haak <chforth@hccnet.nl> - 2015-01-29 03:33 +0100
              Re: Don't be a bit-twiddling monkey Bernd Linsel <bl1@gmx.com> - 2015-05-09 02:15 +0200
            Re: Don't be a bit-twiddling monkey "Rod Pemberton" <buzz@notnotnontnooatno.cmm> - 2015-01-25 17:35 -0500
        Re: Don't be a bit-twiddling monkey Bernd Paysan <bernd.paysan@gmx.de> - 2015-01-25 00:37 +0100
          Re: Don't be a bit-twiddling monkey "Elizabeth D. Rather" <erather@forth.com> - 2015-01-24 21:08 -1000
        Re: Don't be a bit-twiddling monkey anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-01-25 15:36 +0000
      Re: Don't be a bit-twiddling monkey Matthias Koch <matthias.koch@hot.uni-hannover.de> - 2015-01-26 17:24 +0100
  Re: Don't be a bit-twiddling monkey hughaguilar96@gmail.com - 2015-01-23 21:56 -0800

csiph-web