Warn about non-portable use of unescaped backslash at end of string,

and treat it as if it were escaped.
* src/tr.c (unquote): Considering that such usage would make GNU tr
from coreutils-5.2.1 and earlier *fail*, the least we can do now is
to warn about it.  Solaris' tr ignores it.
* NEWS: Mention this.
This commit is contained in:
Jim Meyering committed 2007-07-13 18:37:16 +02:00
1 parent d26ba897eb
commit 916fcda554
3 files changed
+14 -2

No files matched your search

+7
View File
@@ -1,5 +1,12 @@
2007-07-13 Jim Meyering <jim@meyering.net>
Warn about non-portable use of unescaped backslash at end of string,
and treat it as if it were escaped.
* src/tr.c (unquote): Considering that such usage would make GNU tr
from coreutils-5.2.1 and earlier *fail*, the least we can do now is
to warn about it. Solaris' tr ignores it.
* NEWS: Mention this.
Use proper backslash-quoting inside backticks.
* configure.ac: Otherwise we run afoul of strict GNU tr:
a string ending in a lone backslash would provoke a failure.
+4
View File
@@ -12,6 +12,10 @@ GNU coreutils NEWS -*- outline -*-
pr -F no longer suppresses the footer or the first two blank lines in
the header. This is for compatibility with BSD and POSIX.
tr now warns about an unescaped backslash at end of string.
The tr from coreutils-5.2.1 and earlier would fail for such usage,
and Solaris' tr ignores that final byte.
** New features
Add SELinux support (FIXME: add details here)
+3 -2
View File
@@ -525,8 +525,9 @@ unquote (char const *s, struct E_string *es)
}
break;
case '\0':
/* POSIX seems to require that a trailing backslash must
stand for itself. Weird. */
error (0, 0, _("warning: an unescaped backslash "
"at end of string is not portable"));
/* POSIX is not clear about this. */
es->escaped[j] = false;
i--;
c = '\\';