[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: tr now warns about unescaped backslash at end of string
From: |
Jim Meyering |
Subject: |
FYI: tr now warns about unescaped backslash at end of string |
Date: |
Fri, 13 Jul 2007 18:38:25 +0200 |
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.
diff --git a/NEWS b/NEWS
index 25fa3e9..dc60e88 100644
--- a/NEWS
+++ b/NEWS
@@ -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)
diff --git a/src/tr.c b/src/tr.c
index 28eeac3..871542a 100644
--- a/src/tr.c
+++ b/src/tr.c
@@ -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 = '\\';
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: tr now warns about unescaped backslash at end of string,
Jim Meyering <=