Am 17.12.2010 um 22:25 schrieb Paolo Bonzini:

On 12/17/2010 10:00 PM, Andreas Färber wrote:
Am 17.12.2010 um 20:54 schrieb Stefan Weil:

Am 17.12.2010 20:33, schrieb Andreas Färber:
Am 17.12.2010 um 20:01 schrieb Stefan Weil:

Am 17.12.2010 14:44, schrieb Paolo Bonzini:
On 12/17/2010 02:34 PM, Andreas Färber wrote:

Fix this by removing any \r at end of line.

Why isn't cygwin (or whatever you're using) removing it?

I believe Cygwin had an option to choose the line ending style once
during setup. By default it uses Unix-style line endings.
If someone edits source files in some Windows editor, the above issue
seems likely.

Hmm, MSYS is more problematic: the manual says "In the MSYS
environment under Windows, `gawk' automatically uses binary mode
for reading and writing files. Thus there is no need to use the
`BINMODE' variable. This can cause problems with other Unix-like
components that have been ported to Windows that expect `gawk' to
do automatic translationof `"\r\n"', since it won't.".

I had the \r problem when using msys. There seem to be several factors:

* git configuration (add CR / don't add CR)
* msys mount options (binmode / textmode)
* (g)awk (read binary)


My awk foo is insufficient to ack the patch but if it doesn't break
Unices it looks reasonable to me.

I'd be worried a bit about Solaris and other proprietary OSes with
prehistoric Unix utilities. Perhaps using \012 instead of \r is
better.

Paolo

I currently have no possibility to run tests with other awk
implementations,
so I cannot tell whether \012 is needed at all (\r is not a new
invention).
Do all awk versions support regular expressions with characters in
octal encoding?.

Perhaps we can wait several days for feedback from users with an old
awk
and apply the patch if there is none.

I have an open bug ticket wrt configure being broken on Solaris 10
due to tracing shell incompatibilities.

If you provide a small self-contained example I can check though.

Andreas


Example (needs bash's echo -e):

# create line with crlf ending:
echo -e 'include xy\r' >file

# returns xy\r:
awk '/^include / {ORS=" "; print $2}' file | od

0000000 074570 020015
0000004

# should return xy:
awk '/^include / {ORS=" "; sub(/\r$/, "", $2); print $2}' file | od

awk: syntax error near line 1
awk: illegal statement near line 1
0000000

Can you try \015 instead of \r?

Same.

Andreas

Reply via email to