Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

mksh (ENOMEM, ENOCARE) (Miscellaneous)

posted by Rugxulo(R) Homepage, Usono, 23.12.2011, 08:10


> Rugxulo: "13:47 < Rugxulo> disable job control (MKSH_UNEMPLOYED, maybe
> MKSH_NOPROSPECTOFWORK ?? I did that part manually) and it builds"
> I did it a month ago on native DJGPP. ;-)

I'm honestly not sure why I even bothered. Sometimes I think, "I wonder if xyz will work" and run off to compile it. I was probably just buoyed by my own success at Ruby and (re)discovering that damn NUL bug in DOSEMU (actually, FreeDOS). DJGPP's Bash (2.04 or 2.05b) is just too old and buggy, so I sometimes wonder if something simpler could ever replace it.

Oh, and BTW, I wouldn't have publicly mentioned it at all except they (he?) seems "almost" sympathetic to DOS (also see JUPP 2.8's DOS version):


DJGPP?s bash.exe fails to run, thus this is currently not supported. (We tried!)

Future Plans

Build and actually work on more platforms ? DJGPP, PW32, Plan 9, Syllable ? debug these

I just used Ozkan's cross compiler (3.4.6) atop PuppyLinux (for once, for simplicity).

> --- Log opened Tue Nov 22 00:00:15 2011
> 08:55 < RT|work> Just found that DJGPP's fork() doesn't working. How can I
> make mksh working without fork() call?

It returns -1 and ENOMEM, I think. I don't know if DJ thought that would trigger a fallback in most people's code or not. It's kinda sad, IMO, that people can't live without it in their code.

> 18:36 < mira|AO> it?s impossible to make a full POSIX shell without fork()

I don't know if that's true. Bash doesn't use fork() at all, and it works. Granted, you basically doing everything sequentially, but it (more or less) works, at least for our primary usage, to run ./configure.

I'm not knowledgeable about fork/exec at all, but I did (weakly) patch m2c recently to not need it so that it would work in DOS with DJGPP.

> 18:39 < mira|AO> mh, wow. bash segfaulted for me.

That's no surprise, but it would be VERY nice to know what Bash version and DOS-based environment he ran it in.

> 18:40 < mira|AO> but without a working fork, you have almost no chance
> 18:40 < mira|AO> I think the fork emulation puts all global variables into
> a struct, uses a pointer to access it and threads, or somesuch
> 18:40 < mira|AO> that won't work on DOS either

At worst, it "could" work in DR-DOS, RDOS, or some such. At best, it would work everywhere. We do have various threading packages (cooperative, mostly) that work, if that's the case, but I doubt it would help here.

> 18:40 < RT|Chatzilla> Yes. I wonder which ksh will work on DJGPP.
> 18:46 < mira|AO> without fork, you cannot get one.

There were some old shells (semi)"ported" to DOS + OS/2 via EMX used by OS/2 Perl. That was pdksh too, IIRC, which mksh is based upon. Now, they didn't work very well for me (probably due to my inexperience), so I never used them much, but they do exist. (Yes, the OS/2 Perl was at one time suggested for DOS too.)

> 18:48 < mira|AO> think: (foo | (BAR=baz blah; blub) | meow) |& while read
> -p line; do ?
> 18:48 < mira|AO> you cannot do all that with spawn()

Unless you "need" two things to happen at the same time, then it doesn't matter. Just because you want two different programs to run independently doesn't mean they have to be concurrent.

> 18:49 < RT|Chatzilla> so DJGPP users have to use DJGPP's bash. IIRC DJGPP
> gawk uses temporary files for the subprocess pipes.

Yes, popen() and friends (IIRC) do indeed use temporary files. There's probably a better way (DPMI 1.0 0x508 ??), but so far nobody's cared to mess with it.

> 18:49 < mira|AO> at the moment, i'd say so
> 18:49 < mira|AO> but once we integrate most of the winapi port, someone can
> have a look at djgpp again

Right, because Windows doesn't exactly have fork() either, so Cygwin has to fake it. And if Cygwin can fake it, so can we (I presume)! ;-)

> 18:54 < RT|Chatzilla> <mira|AO> mh, wow. bash segfaulted for me. # from my
> testing, DJGPP bash 2.04b/2.05b can run (under Windows XP, I
> haven't test it under Real DOS)
> 18:55 < mira|AO> i don't remember where i tested
> 18:56 < mira|AO> probably under win2k
> 18:56 < mira|AO> possibly real dos, too
> 18:56 < mira|AO> might have been both

Real DOS has issues sometimes, e.g. ./configure (at least for me) doesn't always work. Emulated environments (NTVDM, DOSEMU) seem better for compiling in such circumstances.


Complete thread:

Back to the forum
Board view  Mix view
15317 Postings in 1383 Threads, 254 registered users, 18 users online (0 registered, 18 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum