[ovs-dev] [PATCH] ovsdb-data: Don't put strings with digits in quotes.

Ilya Maximets i.maximets at samsung.com
Wed Jul 24 17:47:56 UTC 2019


On 24.07.2019 20:08, Ben Pfaff wrote:
> On Wed, Jul 24, 2019 at 07:54:29PM +0300, Ilya Maximets wrote:
>> No need to use quotes for strings like "br0".
>>
>> Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
> 
> One of the goals here is to quote anything that could be mistaken for
> another type.  I think that it rejects digits because strings with
> letters and digits could be UUIDs.  Maybe it should use a more specific
> test for that.

Will this help:

diff --git a/lib/ovsdb-data.c b/lib/ovsdb-data.c
index 3aa39cff8..c9b5f7610 100644
--- a/lib/ovsdb-data.c
+++ b/lib/ovsdb-data.c
@@ -674,6 +674,11 @@ string_needs_quotes(const char *s)
 {
     const char *p = s;
     unsigned char c;
+    struct uuid uuid;
+
+    if (uuid_from_string(&uuid, s)) {
+        return true;
+    }
 
     c = *p++;
     if (!isalpha(c) && c != '_') {
---

?

If so, I could update some tests and prepare v2 with this change tomorrow.

Best regards, Ilya Maximets.


More information about the dev mailing list