Re: [Jprogramming] task to ssh interactive

2018-03-08 Thread Chris Double
On Thu, Mar 8, 2018 at 4:21 AM, Eric Iverson wrote: > I recently and independently became aware of the problems with 2!:2. This > is a serious issue and we'll be working on it for this beta cycle. Any > input or suggestions your provide will be welcome. I've created a pull request with a descript

Re: [Jprogramming] task to ssh interactive

2018-03-07 Thread Chris Double
On Thu, Mar 8, 2018 at 5:01 AM, Danil Osipchuk wrote: > The issue with 2!:2 certainly is(was) not only with the memory management. > If I remember correctly, there is a table (may be the 1!:20) which tracks > files in use and their descriptors ( FDs or FILE*s - again not sure now) > and the suppor

Re: [Jprogramming] task to ssh interactive

2018-03-07 Thread Chris Double
On Thu, Mar 8, 2018 at 5:01 AM, Chris Double wrote: > I assume 'fa' does some sort of recursive freeing of memory. instead > of removing the 'fa' call, Is a 'ras(c)' needed to increment some > reference count? Something like: This change also fixes 1!:20: 2!:2 '/bin/ls' 14825 94258605368592 94

Re: [Jprogramming] task to ssh interactive

2018-03-07 Thread Chris Double
I assume 'fa' does some sort of recursive freeing of memory. instead of removing the 'fa' call, Is a 'ras(c)' needed to increment some reference count? Something like: B jtadd2(J jt,F f1,F f2,C*cmd){A c,x; if(f1==NULL) {jt->fopn+=2;R 1;}; GATV(c,LIT,1+strlen(cmd),1,0);MC(CAV(c)+1,cmd,AN(c)-1);cm

Re: [Jprogramming] task to ssh interactive

2018-03-07 Thread Danil Osipchuk
The issue with 2!:2 certainly is(was) not only with the memory management. If I remember correctly, there is a table (may be the 1!:20) which tracks files in use and their descriptors ( FDs or FILE*s - again not sure now) and the supporting 2!:2 implementation is inconsistent when filling it http:

Re: [Jprogramming] task to ssh interactive

2018-03-07 Thread Chris Double
If I comment out the call to "fa(c)" in 'jtadd2' then the segfault goes away. Is there some memory management issue related to the allocation and freeing of the cmd string that is going on? On Thu, Mar 8, 2018 at 4:31 AM, Raul Miller wrote: > Huh... > > I wonder if there's something uninitialized

Re: [Jprogramming] task to ssh interactive

2018-03-07 Thread Raul Miller
Huh... I wonder if there's something uninitialized in libedit (or perhaps some other supporting library) that needs to be initialized? -- Raul On Wed, Mar 7, 2018 at 10:26 AM, Chris Double wrote: > On Thu, Mar 8, 2018 at 3:29 AM, Chris Double > wrote: >> I will investigate more though why t

Re: [Jprogramming] task to ssh interactive

2018-03-07 Thread Chris Double
On Thu, Mar 8, 2018 at 3:29 AM, Chris Double wrote: > I will investigate more though why the instability occurs. On closer debugging, it seems to be the add2 call, not the 'fdopen'. With no changes this errors: 2!:2 '/bin/ls' 10554 93976423924960 93976423925520 1 2 Segmentation fault (cor

Re: [Jprogramming] task to ssh interactive

2018-03-07 Thread Raul Miller
I can reproduce this segmentation fault. I have also been able to reproduce your "ill-formed number" problem. Very odd.. Thanks, -- Raul On Wed, Mar 7, 2018 at 9:29 AM, Chris Double wrote: > I'll have to investigate more to work out why the instability happens. > Just a note on: > >> It's t

Re: [Jprogramming] task to ssh interactive

2018-03-07 Thread Eric Iverson
Chris Double, I recently and independently became aware of the problems with 2!:2. This is a serious issue and we'll be working on it for this beta cycle. Any input or suggestions your provide will be welcome. On Wed, Mar 7, 2018 at 9:29 AM, Chris Double wrote: > I'll have to investigate more

Re: [Jprogramming] task to ssh interactive

2018-03-07 Thread Chris Double
I'll have to investigate more to work out why the instability happens. Just a note on: > It's the pipe that's used to communicate between the processes, the > fdopen creates buffers which do need to be independent. The fdopen calls are used to get a FILE* for the integer file handle which are onl

Re: [Jprogramming] task to ssh interactive

2018-03-07 Thread Raul Miller
After some reflection: your observations about the fdopen placement are not invalid. But it shouldn't be the case that J needs to change here: It's the pipe that's used to communicate between the processes, the fdopen creates buffers which do need to be independent. Still, if the buffers in the p

Re: [Jprogramming] task to ssh interactive

2018-03-07 Thread Raul Miller
I tried the current j807 beta on an ubuntu machine, and did not encounter the instability. However, since memory corruption does not produce reliable behaviors, I'm not sure that that matters. That said, the purpose of that fdopen is to communicate between the two forked processes, and moving it a

Re: [Jprogramming] task to ssh interactive

2018-03-07 Thread Chris Double
I took a quick look at the 2!:2 code and it's mostly ok in that the file descriptors returned in the array are usable. Unfortunately using it causes spurious errors crashes: $ jconsole a=: (2!:2) '/bin/ls -l' a 28836 94660922311904 94660922312464 b =: mema 1024 |ill-formed number .

Re: [Jprogramming] task to ssh interactive

2018-03-05 Thread Raul Miller
If it's broken... The top level definition for 2!:2 is at https://github.com/jsoftware/jsource/blob/master/jsrc/x.c#L90 (And, remember, line 4 of those .c files identifies the purpose of the file. And, in the current versions, if you can't find a function definition, try pasting a "jt" at the fro

Re: [Jprogramming] task to ssh interactive

2018-03-05 Thread bill lam
Last time check, those foreign conjunctions did not work under linux. It was a long standing bug but not fixed. On Mon, Mar 5, 2018, 5:16 PM Nick S wrote: > ssh can be run without pty allocation, the remote command can just be run > under pipes, for openssh, the option is -T if I read the manual

Re: [Jprogramming] task to ssh interactive

2018-03-05 Thread Nick S
ssh can be run without pty allocation, the remote command can just be run under pipes, for openssh, the option is -T if I read the manual pages correctly. The real question is whether the program you want to run remotely needs a pty (Or the signal processing changes you can get from the pry). Cert

Re: [Jprogramming] task to ssh interactive

2018-03-03 Thread Raul Miller
You are correct. There is a lot of OS specific code needed for PTYs, and most everyone has other higher priorities than working through all those issues. Thanks, -- Raul On Sat, Mar 3, 2018 at 6:30 AM, Omar Passos Torres de Almeida wrote: > Thanks! > I know those technics, but i was thinking

Re: [Jprogramming] task to ssh interactive

2018-03-03 Thread Omar Passos Torres de Almeida
Thanks! I know those technics, but i was thinking in something coded in pure J or some addon. I think not exists something like those in J. Omar On 03/02/2018 11:25 PM, Raul Miller wrote: Working with ptys is kind of tricky, you'll want a program that specializes in that, like expect or mayb

Re: [Jprogramming] task to ssh interactive

2018-03-02 Thread Raul Miller
Working with ptys is kind of tricky, you'll want a program that specializes in that, like expect or maybe even something like tmux. https://en.wikipedia.org/wiki/Expect https://en.wikipedia.org/wiki/Tmux If you're working with tmux, for example, you can use tmux send-keys to "type" things into y

[Jprogramming] task to ssh interactive

2018-03-02 Thread Omar Passos Torres de Almeida
Hi How can i interact with a task like ssh using task.ijs (spawn or shell)? eg. load 'task' password=. 'mypassword' process=. shell 'ssh [email protected]' How to send the password? and then interact with the pty? login@host$ ls -la Is there some way to do that? Thanks in advance, Omar