[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Change of behavior: 3.80 vs 3.81beta3 WRT line continuation
From: |
Steve James |
Subject: |
Change of behavior: 3.80 vs 3.81beta3 WRT line continuation |
Date: |
Mon, 15 Aug 2005 16:02:20 +0100 |
User-agent: |
KMail/1.7.2 |
AFAICT the behavior of line continuation escapes has changed within
single-quoted strings. What's really confusing me is that this seems to be
deliberate.
Here's the simple example make script
all:
@echo 'line1\
line2'
Version 3.80 prints this (as I would expect):
line1line2
But Version 3.80beta3 prints this:
line1\
line2
There's some background to this change concerning POSIX (Savannah bug # 1332).
Revision 1.166 of job.c is concerned. Here's the relevant code section:
/* Inside a string, just copy any char except a closing quote
or a backslash-newline combination. */
if (*p == instring)
{
instring = 0;
if (ap == new_argv[0] || *(ap-1) == '\0')
last_argument_was_empty = 1;
}
else if (*p == '\\' && p[1] == '\n')
{
/* Backslash-newline is handled differently depending on what
kind of string we're in: inside single-quoted strings you
keep them; in double-quoted strings they disappear. */
if (instring == '"')
++p;
else
{
*(ap++) = *(p++);
*(ap++) = *p;
}
/* If there's a TAB here, skip it. */
if (p[1] == '\t')
++p;
}
See, entirely deliberate. What's more the regression tests in
tests/scripts/misc/general3 verify this behavior. But this all looks broken
to me.
So what's up? Is this
1. A new bug in the beta,
2. A deliberate non-backward compatibility
3. Something else that's confusing me?
Thanks,
Steve.
Linux ivybridge.beachsolutions.plus.com 2.6.11-12mdk #1 Mon Jun 27 23:18:37
MDT2005 i686 Intel(R) Pentium(R) 4 CPU 2.50GHz unknown GNU/Linux
--
"If you lived today as if it were your last, you'd buy up a box of rockets and
fire them all off, wouldn't you?"
-- Garrison Keillor
- Change of behavior: 3.80 vs 3.81beta3 WRT line continuation,
Steve James <=