Issue 67806 - dmake's internal echo command omits/looses spaces in output
Summary: dmake's internal echo command omits/looses spaces in output
Status: CLOSED FIXED
Alias: None
Product: Build Tools
Classification: Code
Component: dmake (show other issues)
Version: current
Hardware: All Windows, all
: P3 Trivial (vote)
Target Milestone: ---
Assignee: hjs
QA Contact: issues@tools
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-26 19:15 UTC by quetschke
Modified: 2013-08-07 15:34 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Patch for dmake (3.39 KB, patch)
2006-07-27 01:56 UTC, quetschke
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description quetschke 2006-07-26 19:15:54 UTC
First of all only the native Windows dmake version knows of the undocumented
internal echo and noop commands. They only work in recipe lines that are not
executed in a shell (no '+' or shellmetas involved)

I'm currently including them for the *nix version of dmake but I found that echo
is slightly broken in the native Windows version.

Example:

--- makefile.mk ---
SHELL:=cmd.exe 
SHELLFLAGS:=/C

all :
	echo "AAA  BBB"
--- makefile.mk ---

$ ./dmake/dmake.exe -r
echo "AAA  BBB"
"AAABBB"

Not surprisingly the " quotes are not handled, and I wouldn't change that, but
the whitespace between the "parameters" is removed. There is a bug in the
runargv function and it would be easy to restore one space between the
parameters but I would prefer that everything behind a leading
  "echo [-n ]"
is printed literally.

@ause: Is the current broken functionality used somewhere in the OOo build?
Comment 1 quetschke 2006-07-27 01:56:58 UTC
Created attachment 38058 [details]
Patch for dmake
Comment 2 quetschke 2006-07-27 02:12:41 UTC
The previous patch changes the internal echo command to
  echo [-n] expression
that prints expression with all leading whitespaces removed but otherwise
unchanged to stdout. The patch also moves the global variable Packed_shell
to msdos/runargv.c and msdos/spawn.c as it is used nowhere else.

Committed to dmake46.
Comment 3 quetschke 2006-07-28 22:49:21 UTC
Tested with the following makefile:

--- makefile.mk ---
SHELL:=cmd.exe 
SHELLFLAGS:=/C

all :
# Print ABC  D
	@echo -n AB
	@echo C  D
	@echo
	echo "AAA   BBB"
# Test empty line
	$(NULL)
# Test empty line in shell
	+$(NULL)
	+echo 1234
	+$(NULL)
	+echo asdf
# Test noop
	echo
	+echo test noop
	@noop bla bla $(assign AA:=ABC)
	@echo $(AA)
--- makefile.mk ---

`dmake -r` seems to work as expected.

@ause: Please verify.
Comment 4 hjs 2006-09-14 16:22:06 UTC
created followup #i69536#
Comment 5 hjs 2007-01-03 12:03:47 UTC
.