[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
BATCH_MODE_ONLY and cygwin shell problem
From: |
Russo, David |
Subject: |
BATCH_MODE_ONLY and cygwin shell problem |
Date: |
Tue, 21 Jun 2011 18:28:32 -0500 |
CYGWIN's default CRLF handling requires that shell scripts avoid Windows \r\n
line termination: http://cygwin.com/ml/cygwin-announce/2006-12/msg00026.html.
Unfortunately, this prevents cygwin shells from being used with BATCH_MODE_ONLY
configurations of GNU make which always creates shell scripts with lines
terminating with \r\n. If a cygwin shell is used with this configuration of
make, the generated shell script will contain embedded \r characters that are
interpreted as additional command characters rather as than line terminators.
Why on earth would I want to use a cygwin shell with a BATCH_MODE_ONLY
configuration of GNU make? Because I need to supply a common build of GNU make
that works with a variety of user supplied shells (some of which require
BATCH_MODE_ONLY).
I've fixed the problem by patching GNU make to only add \r\n line termination
for non unixy shells. This 2-line patch is shown below and seems like a safe
(and generally useful) change. But, I'd prefer to not carry around a custom
version of GNU make. So ...
Is there a better way support cygin ash/dash with BATCH_MODE_ONLY make
configurations? Either with no change to make or some patch that can become
part of the GNU make code base? Any help will be appreciated.
Thanks in advance,
dave
The patch:
Original GNU make 3.81/3.82 job.c:
/* Create a FILE object for the batch file, and write to it the
commands to be executed. Put the batch file in TEXT mode. */
_setmode (temp_fd, _O_TEXT);
batch = _fdopen (temp_fd, "wt");
The following changes "fix" the problem for me:
/* Create a FILE object for the batch file, and write to it the
commands to be executed. If necessary, put the batch file in
TEXT mode. */
_setmode (temp_fd, unixy_shell ? _O_BINARY : _O_TEXT);
batch = _fdopen (temp_fd, unixy_shell ? "wb" : "wt");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- BATCH_MODE_ONLY and cygwin shell problem,
Russo, David <=