I'm inclined to lay the blame for this one on the OS. The defect in J is that there's no good way of getting at errno.
http://www.openbsd.org/cgi-bin/man.cgi?query=system&apropos=0&sektion=3&manpath=OpenBSD+Current&arch=i386&format=html I imagine that 2!:13 should return the value of errno. For now, though, I think I know how to get at that value. I spent way too much time grovelling through disassembled code and register dumps in gdb last night - there's something about the way libc is implemented that I do not understand (and the i386 architecture is a pain to work with, at least for me), but I think I know how to get at the underlying fault, the next time this happens. I should be a lot better at this, but the focus of my work at usatoday has spoiled me for this kind of thing, and in many ways I feel like I'm a beginner again, on a variety of technical fronts. On the positive side, though, I imagine that people can learn from my posts here. (Only those that are interested, of course - people's interests vary over quite a wide range.) Thanks, -- Raul On Thu, Mar 13, 2014 at 8:10 AM, Joe Bogner <[email protected]> wrote: > Not sure if it helps, but I ran this for 3 hours this morning and > didn't have any errrors: > > go=: 3 : 0 > for_i. i. 1e7 do. > 2!:0 'date' > 2!:0 'sleep .1' > 2!:0 'date >/tmp/f1;:' > end. > ) > > go'' > > JVERSION > Engine: j701/2011-01-10/11:25 > Library: 7.01.088 > Platform: Linux 64 > Installer: j701a_linux64.sh > InstallPath: /home/joebo/j64-701 > > > On Wed, Mar 12, 2014 at 10:08 PM, Raul Miller <[email protected]> > wrote: > > I'm not sure why that ' > ' is five characters instead of three. > Probably > > it was specified as 3 characters with spaces surrounding the '>' but that > > got interpreted as three spaces followed by '> '. > > > > In any event, it's just: command string followed by ' > ' followed by > > temporary file name. > > > > Meanwhile, it would have been more useful if it had been > '>',tmpfilename,' > > ',command -- that way if the command had a redirect in it, it would just > > work. As it is, one must do something a little extra to redirect to a > file > > > > Anyways, here's an example of the problem in action: > > > > |interface error: spawn > > |spawn[:0] > > 2!:0 'date >/tmp/f1;:' > > |interface error > > | 2!:0'date >/tmp/f1;:' > > ^D > > real 121m42.418s > > user 71m39.468s > > sys 12m58.545s > > ~$ ls -lart /tmp > > total 8 > > drwxr-xr-x 23 root root 4096 Mar 9 14:12 .. > > drwxrwxrwt 2 root root 4096 Mar 13 01:19 . > > > > And, here's an example of successfully redirecting to a file: > > > > 2!:0 'date >/tmp/f2;:' > > > > The ;: at the end of the command string terminates the command with the > > redirect and follows it with an empty command which does nothing. The > > redirect then takes effect on that command (thus 2!:0 returns nothing). > > > > ~$ cat /tmp/f2 > > Thu Mar 13 02:04:09 UTC 2014 > > > > Anyways, I've got jconsole running under gdb, and I'll see if the C > > debugger can tell me anything about the problem. > > > > Thanks, > > > > -- > > Raul > > > > > > > > On Wed, Mar 12, 2014 at 9:27 PM, Joe Bogner <[email protected]> wrote: > > > >> On Wed, Mar 12, 2014 at 9:16 PM, Joe Bogner <[email protected]> > wrote: > >> > I can't figure out by looking at it how the tmpnam gets > >> > added to the system command. I'm used to seeing popen > >> > > >> > > >> > https://github.com/openj/core/blob/18fd23bbdc2f50770eb3047e978cd5e4e3b47039/xh.c#L39 > >> > > >> > >> Scratch that, I figured out how it gets added. It's appending it to > >> the end of the pointer. The number 5 still has me confused and the " > > >> ". Anyways, I don't think this is helping unless it has something to > >> do with 5 and exceeding the number of temporary files or something > >> like that. Probably a false trail of thought > >> ---------------------------------------------------------------------- > >> For information about J forums see http://www.jsoftware.com/forums.htm > >> > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
