Bash for Windows

2008-08-22 Thread Hector Chu
I've ported bash to Windows and would like my changes to be part of
the main codebase. Would there be any interest in doing this?




Re: Bash for Windows

2008-08-22 Thread Hector Chu
This port uses mingw32 to build, producing a so called native build of
bash. The existing code paths are retained (unlike earlier ports),
increasing maintainability.

Most attempts have difficulty with reconciling the use of fork and
exec in the execute code paths. Windows only has a CreateProcess
function which allows a fresh child process loaded from an executable
to be spawned. The simplest solution I adopted is to copy the data
from the parent bash to the child bash over a pipe. This means
variables, history etc. The location to jump to is also sent across,
so the child can start executing after the 'fork'.

To deal with the possibility of the child exec'ing, the parent shell
waits for the child to do the exec. The child execs by spawning the
new process, piping the PID back to the parent, and then exiting. The
parent now has the real PID and can wait on it if needed.

In terms of code impact, there is a 1800 line new file, and ifdef'ed
code scattered around the other various files. Each change in existing
files is very small, around 1-10 lines in each place. 38 files were
changed. 2 added.

2008/8/23 Chet Ramey <[EMAIL PROTECTED]>:
> Hector Chu wrote:
>>
>> I've ported bash to Windows and would like my changes to be part of
>> the main codebase. Would there be any interest in doing this?
>
> Tell me more.  What makes your port different from the existing ones?
>
> Chet
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>
> Chet Ramey, ITS, CWRU[EMAIL PROTECTED]
> http://cnswww.cns.cwru.edu/~chet/
>




How does the input-line test work?

2008-08-29 Thread Hector Chu
input-line.sh is:

bash ./input-line.sub
this line for input-line.sub

with input-line.sub being:

read line
echo line read by $0 was \`$line\'

The test is run by executing: bash < input-line.sh.

How does input-line.sub manage to read from the correct point in the
input file? Doesn't the parent bash read the whole lot into its
buffer, so that the child bash starts reading from the end of the
file?