linux-nfc.lists.01.org archive mirror
 help / color / mirror / Atom feed
* [linux-nfc] [neard][PATCH 00/16] neard CI under Github and rouund of fixes
@ 2021-07-10  3:38 Krzysztof Kozlowski
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 01/16] nfctool: fix adapter_compare_idx() cast-function-type Krzysztof Kozlowski
                   ` (16 more replies)
  0 siblings, 17 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-10  3:38 UTC (permalink / raw)
  To: linux-nfc; +Cc: Krzysztof Kozlowski

Hi,

Mark proposed to do some work around neard (the user-space counterpart
of NFC drivers) [1], so here it is.

I made a fork on Github [2] and I add here Continuous Integration via
Github actions. These are pretty easy to set up. For starting only few
builds are done, but I have also more in the queue - just need to fix
32-bit and clang builds.

The neard fails to compile on GCC v10 (earlier maybe as well) in
maintainer moe (so with some warnings enabled) which is fixed here. It
is also first round of fixes around UTF-8 and UTF-16 parsing, although
this is not finished yet.

Further plans:
1. Decide whether official releases should be made from Github or
   kernel.org.
2. Fix for clang.
3. Fix UTF-8 and UTF-16 in ndef.
4. Add more unit tests around ndef and others (help would be here
   appreciated).
5. Add more GCC/clang warnings and fix them.
6. Add some static analysis checks in Github CI.

[1] https://lore.kernel.org/linux-nfc/20210512144319.30852-1-krzysztof.kozlowski@canonical.com/T/#m6a1cdae5f435b295cc7670c361b5bdc1daf30273
[2] https://github.com/krzk/neard

Best regards,
Krzysztof


Krzysztof Kozlowski (16):
  nfctool: fix adapter_compare_idx() cast-function-type
  nfctool: fix nfctool_send_dep_link_up() cast-function-type
  nfctool: fix nfctool_print_and_remove_snl() cast-function-type
  ci: temporarily disable Ubuntu Hirsute
  dbus: fix -Wformat in near_dbus_encode_string()
  bootstrap: parse CROSS_COMPILE and set proper configure option
  ci: add SPDX and copyright notes to ci.yml
  ci: enable back Ubuntu Hirsute
  ci: print executed commands when configuring debian
  ci: no need to print twice compiler version
  unit: pass real UTF-8 for testing text NDEF
  ndef: check UTF-16 text payload length
  ndef: silence clang -Wcast-align warning
  ndef: fix parsing of UTF-16 text payload
  nfctype5: fix returning uninitialized stack value in
    t5_tag_is_ti_pro()
  ci: add clang builds

 .github/workflows/ci.yml | 19 ++++++++++++++--
 bootstrap-configure      |  6 +++++
 ci/debian.sh             | 20 ++++++++++++++---
 plugins/nfctype5.c       |  2 +-
 src/dbus.c               |  2 +-
 src/ndef.c               | 24 +++++++++++++++-----
 tools/nfctool/adapter.c  |  6 +++--
 tools/nfctool/main.c     |  8 +++----
 unit/test-ndef-parse.c   | 47 ++++++++++++++++++++++++++++++++++------
 9 files changed, 108 insertions(+), 26 deletions(-)

-- 
2.27.0
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [linux-nfc] [neard][PATCH 01/16] nfctool: fix adapter_compare_idx() cast-function-type
  2021-07-10  3:38 [linux-nfc] [neard][PATCH 00/16] neard CI under Github and rouund of fixes Krzysztof Kozlowski
@ 2021-07-10  3:38 ` Krzysztof Kozlowski
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 02/16] nfctool: fix nfctool_send_dep_link_up() cast-function-type Krzysztof Kozlowski
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-10  3:38 UTC (permalink / raw)
  To: linux-nfc; +Cc: Krzysztof Kozlowski

Fix on GCC v10:

    tools/nfctool/adapter.c: In function ‘adapter_get’:
    tools/nfctool/adapter.c:155:8: error: cast between incompatible function types from ‘gint (*)(struct nfc_adapter *, guint32)’ {aka ‘int (*)(struct nfc_adapter *, unsigned int)’} to ‘gint (*)(const void *, const void *)’ {aka ‘int (*)(const void *, const void *)’} [-Werror=cast-function-type]
      155 |        (GCompareFunc)adapter_compare_idx);
          |        ^

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 tools/nfctool/adapter.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/nfctool/adapter.c b/tools/nfctool/adapter.c
index 5e3bf41884d1..343c4ab7d0ff 100644
--- a/tools/nfctool/adapter.c
+++ b/tools/nfctool/adapter.c
@@ -139,9 +139,11 @@ void adapter_idx_print_info(guint32 idx)
 		g_slist_foreach(adapters, (GFunc)adapter_print_info, NULL);
 }
 
-static gint adapter_compare_idx(struct nfc_adapter *adapter, guint32 idx)
+static gint adapter_compare_idx(struct nfc_adapter *adapter, gpointer idx_ptr)
 {
-	return (gint)adapter->idx - (gint)idx;
+	gint idx = GPOINTER_TO_INT(idx_ptr);
+
+	return (gint)adapter->idx - idx;
 }
 
 struct nfc_adapter *adapter_get(guint32 idx)
-- 
2.27.0
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [linux-nfc] [neard][PATCH 02/16] nfctool: fix nfctool_send_dep_link_up() cast-function-type
  2021-07-10  3:38 [linux-nfc] [neard][PATCH 00/16] neard CI under Github and rouund of fixes Krzysztof Kozlowski
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 01/16] nfctool: fix adapter_compare_idx() cast-function-type Krzysztof Kozlowski
@ 2021-07-10  3:38 ` Krzysztof Kozlowski
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 03/16] nfctool: fix nfctool_print_and_remove_snl() cast-function-type Krzysztof Kozlowski
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-10  3:38 UTC (permalink / raw)
  To: linux-nfc; +Cc: Krzysztof Kozlowski

Fix on GCC v10:

    tools/nfctool/main.c: In function ‘nfctool_targets_found’:
    tools/nfctool/main.c:294:5: error: cast between incompatible function types from ‘void (*)(guint32,  guint32)’ {aka ‘void (*)(unsigned int,  unsigned int)’} to ‘void (*)(void *, void *)’ [-Werror=cast-function-type]
      294 |     (GFunc)nfctool_send_dep_link_up,
          |     ^

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 tools/nfctool/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/nfctool/main.c b/tools/nfctool/main.c
index c48bf0919657..282df519fcc8 100644
--- a/tools/nfctool/main.c
+++ b/tools/nfctool/main.c
@@ -259,9 +259,9 @@ static int nfctool_snl(void)
 	return nfctool_snl_send_request(adapter);
 }
 
-static void nfctool_send_dep_link_up(guint32 target_idx, guint32 adapter_idx)
+static void nfctool_send_dep_link_up(gpointer target_idx, gpointer adapter_idx)
 {
-	nl_send_dep_link_up(adapter_idx, target_idx);
+	nl_send_dep_link_up(GPOINTER_TO_INT(adapter_idx), GPOINTER_TO_INT(target_idx));
 }
 
 static int nfctool_targets_found(guint32 adapter_idx)
-- 
2.27.0
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [linux-nfc] [neard][PATCH 03/16] nfctool: fix nfctool_print_and_remove_snl() cast-function-type
  2021-07-10  3:38 [linux-nfc] [neard][PATCH 00/16] neard CI under Github and rouund of fixes Krzysztof Kozlowski
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 01/16] nfctool: fix adapter_compare_idx() cast-function-type Krzysztof Kozlowski
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 02/16] nfctool: fix nfctool_send_dep_link_up() cast-function-type Krzysztof Kozlowski
@ 2021-07-10  3:38 ` Krzysztof Kozlowski
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 04/16] ci: temporarily disable Ubuntu Hirsute Krzysztof Kozlowski
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-10  3:38 UTC (permalink / raw)
  To: linux-nfc; +Cc: Krzysztof Kozlowski

Fix on GCC v10:

    tools/nfctool/main.c: In function ‘nfctool_snl_cb’:
    tools/nfctool/main.c:352:30: error: cast between incompatible function types from ‘void (*)(struct nfc_snl *, guint32)’ {aka ‘void (*)(struct nfc_snl *, unsigned int)’} to ‘void (*)(void *, void *)’ [-Werror=cast-function-type]
      352 |  g_slist_foreach(sdres_list, (GFunc)nfctool_print_and_remove_snl,
          |                              ^

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 tools/nfctool/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/nfctool/main.c b/tools/nfctool/main.c
index 282df519fcc8..72a39de3ccbf 100644
--- a/tools/nfctool/main.c
+++ b/tools/nfctool/main.c
@@ -325,13 +325,13 @@ static int nfctool_poll_cb(guint8 cmd, guint32 idx, gpointer data)
 }
 
 static void nfctool_print_and_remove_snl(struct nfc_snl *sdres,
-					 guint32 adapter_idx)
+					 gpointer adapter_idx)
 {
 	GSList *elem;
 
 	printf(" uri: %s - sap: %d\n", sdres->uri, sdres->sap);
 
-	if (adapter_idx == opts.adapter_idx) {
+	if (GPOINTER_TO_UINT(adapter_idx) == opts.adapter_idx) {
 		elem = g_slist_find_custom(opts.snl_list, sdres->uri,
 					   (GCompareFunc)g_strcmp0);
 
-- 
2.27.0
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [linux-nfc] [neard][PATCH 04/16] ci: temporarily disable Ubuntu Hirsute
  2021-07-10  3:38 [linux-nfc] [neard][PATCH 00/16] neard CI under Github and rouund of fixes Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 03/16] nfctool: fix nfctool_print_and_remove_snl() cast-function-type Krzysztof Kozlowski
@ 2021-07-10  3:38 ` Krzysztof Kozlowski
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 05/16] dbus: fix -Wformat in near_dbus_encode_string() Krzysztof Kozlowski
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-10  3:38 UTC (permalink / raw)
  To: linux-nfc; +Cc: Krzysztof Kozlowski

"Install additional packages" hangs on:

    Setting up tzdata (2021a-1ubuntu1) ...
    debconf: unable to initialize frontend: Dialog
    debconf: (TERM is not set, so the dialog frontend is not usable.)
    debconf: falling back to frontend: Readline
    Configuring tzdata
    ------------------

    Please select the geographic area in which you live. Subsequent configuration
    questions will narrow this down by presenting a list of cities, representing
    the time zones in which they are located.

      1. Africa   3. Antarctica  5. Arctic  7. Atlantic  9. Indian    11. US
      2. America  4. Australia   6. Asia    8. Europe    10. Pacific  12. Etc
    Geographic area:

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 .github/workflows/ci.yml | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index bd6892343b4f..fb754ac78038 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -9,9 +9,10 @@ jobs:
       fail-fast: false
       matrix:
         include:
-          - container: "ubuntu:hirsute"
-            env:
-              CC: gcc
+          # Does pass installation - hangs on tzdata configuration
+          # - container: "ubuntu:hirsute"
+          #   env:
+          #     CC: gcc
 
           - container: "ubuntu:focal"
             env:
-- 
2.27.0
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [linux-nfc] [neard][PATCH 05/16] dbus: fix -Wformat in near_dbus_encode_string()
  2021-07-10  3:38 [linux-nfc] [neard][PATCH 00/16] neard CI under Github and rouund of fixes Krzysztof Kozlowski
                   ` (3 preceding siblings ...)
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 04/16] ci: temporarily disable Ubuntu Hirsute Krzysztof Kozlowski
@ 2021-07-10  3:38 ` Krzysztof Kozlowski
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 06/16] bootstrap: parse CROSS_COMPILE and set proper configure option Krzysztof Kozlowski
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-10  3:38 UTC (permalink / raw)
  To: linux-nfc; +Cc: Krzysztof Kozlowski

Fix GCC warning:

    src/dbus.c: In function ‘near_dbus_encode_string’:
    src/dbus.c:71:37: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘int’ [-Werror=format=]
       71 |    g_string_append_printf(str, "_%02x", tmp);
          |                                  ~~~^   ~~~
          |                                     |   |
          |                                     |   int
          |                                     unsigned int
          |                                  %02x

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 src/dbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/dbus.c b/src/dbus.c
index 9c67a9eec89a..ed4570d951ed 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -68,7 +68,7 @@ char *near_dbus_encode_string(const char *value)
 		const char tmp = value[i];
 		if ((tmp < '0' || tmp > '9') && (tmp < 'A' || tmp > 'Z') &&
 						(tmp < 'a' || tmp > 'z'))
-			g_string_append_printf(str, "_%02x", tmp);
+			g_string_append_printf(str, "_%02x", (unsigned int)tmp);
 		else
 			str = g_string_append_c(str, tmp);
 	}
-- 
2.27.0
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [linux-nfc] [neard][PATCH 06/16] bootstrap: parse CROSS_COMPILE and set proper configure option
  2021-07-10  3:38 [linux-nfc] [neard][PATCH 00/16] neard CI under Github and rouund of fixes Krzysztof Kozlowski
                   ` (4 preceding siblings ...)
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 05/16] dbus: fix -Wformat in near_dbus_encode_string() Krzysztof Kozlowski
@ 2021-07-10  3:38 ` Krzysztof Kozlowski
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 07/16] ci: add SPDX and copyright notes to ci.yml Krzysztof Kozlowski
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-10  3:38 UTC (permalink / raw)
  To: linux-nfc; +Cc: Krzysztof Kozlowski

Makes cross compiling in CI easier.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 bootstrap-configure | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/bootstrap-configure b/bootstrap-configure
index 7cb14588f816..0652e3b223b6 100755
--- a/bootstrap-configure
+++ b/bootstrap-configure
@@ -4,6 +4,11 @@ if [ -f config.status ]; then
 	make maintainer-clean
 fi
 
+CONFIGURE_CROSS=""
+if [ "$CROSS_COMPILE" ]; then
+	CONFIGURE_CROSS="--host=${CROSS_COMPILE}"
+fi
+
 ./bootstrap && \
     ./configure --enable-maintainer-mode \
 		--enable-debug \
@@ -11,4 +16,5 @@ fi
 		--prefix=/usr \
 		--enable-ese \
 		--sysconfdir=/etc \
+		"$CONFIGURE_CROSS" \
 		--enable-tools "$@"
-- 
2.27.0
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [linux-nfc] [neard][PATCH 07/16] ci: add SPDX and copyright notes to ci.yml
  2021-07-10  3:38 [linux-nfc] [neard][PATCH 00/16] neard CI under Github and rouund of fixes Krzysztof Kozlowski
                   ` (5 preceding siblings ...)
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 06/16] bootstrap: parse CROSS_COMPILE and set proper configure option Krzysztof Kozlowski
@ 2021-07-10  3:38 ` Krzysztof Kozlowski
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 08/16] ci: enable back Ubuntu Hirsute Krzysztof Kozlowski
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-10  3:38 UTC (permalink / raw)
  To: linux-nfc; +Cc: Krzysztof Kozlowski

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 .github/workflows/ci.yml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index fb754ac78038..266b93ff9895 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,3 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (c) 2021 Canonical Ltd.
+# Author: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+#                             <krzk@kernel.org>
+# Loosely based on https://github.com/linux-test-project/ltp
+#
 name: "CI: docker based builds"
 on: [push, pull_request]
 
-- 
2.27.0
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [linux-nfc] [neard][PATCH 08/16] ci: enable back Ubuntu Hirsute
  2021-07-10  3:38 [linux-nfc] [neard][PATCH 00/16] neard CI under Github and rouund of fixes Krzysztof Kozlowski
                   ` (6 preceding siblings ...)
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 07/16] ci: add SPDX and copyright notes to ci.yml Krzysztof Kozlowski
@ 2021-07-10  3:38 ` Krzysztof Kozlowski
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 09/16] ci: print executed commands when configuring debian Krzysztof Kozlowski
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-10  3:38 UTC (permalink / raw)
  To: linux-nfc; +Cc: Krzysztof Kozlowski

Preseed tzdata so Ubuntu Hirsute could be used for building.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 .github/workflows/ci.yml | 7 +++----
 ci/debian.sh             | 9 +++++++++
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 266b93ff9895..866fa846c7f8 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -16,10 +16,9 @@ jobs:
       fail-fast: false
       matrix:
         include:
-          # Does pass installation - hangs on tzdata configuration
-          # - container: "ubuntu:hirsute"
-          #   env:
-          #     CC: gcc
+          - container: "ubuntu:hirsute"
+            env:
+              CC: gcc
 
           - container: "ubuntu:focal"
             env:
diff --git a/ci/debian.sh b/ci/debian.sh
index b13ffe701ae4..004e7d84ae07 100755
--- a/ci/debian.sh
+++ b/ci/debian.sh
@@ -11,6 +11,15 @@ set -e -E
 
 apt update
 
+# Some distros (e.g. Ubuntu Hirsute) might pull tzdata which asks questions
+export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true
+
+# Choose some random place in Europe
+echo "tzdata tzdata/Areas select Europe
+tzdata tzdata/Zones/Europe select Berlin
+" > /tmp/tzdata-preseed.txt
+debconf-set-selections /tmp/tzdata-preseed.txt
+
 apt install -y --no-install-recommends \
 	autoconf \
 	automake \
-- 
2.27.0
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [linux-nfc] [neard][PATCH 09/16] ci: print executed commands when configuring debian
  2021-07-10  3:38 [linux-nfc] [neard][PATCH 00/16] neard CI under Github and rouund of fixes Krzysztof Kozlowski
                   ` (7 preceding siblings ...)
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 08/16] ci: enable back Ubuntu Hirsute Krzysztof Kozlowski
@ 2021-07-10  3:38 ` Krzysztof Kozlowski
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 10/16] ci: no need to print twice compiler version Krzysztof Kozlowski
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-10  3:38 UTC (permalink / raw)
  To: linux-nfc; +Cc: Krzysztof Kozlowski

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 ci/debian.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ci/debian.sh b/ci/debian.sh
index 004e7d84ae07..35eb3681f059 100755
--- a/ci/debian.sh
+++ b/ci/debian.sh
@@ -7,7 +7,7 @@
 # SPDX-License-Identifier: GPL-2.0
 #
 
-set -e -E
+set -eEx
 
 apt update
 
-- 
2.27.0
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [linux-nfc] [neard][PATCH 10/16] ci: no need to print twice compiler version
  2021-07-10  3:38 [linux-nfc] [neard][PATCH 00/16] neard CI under Github and rouund of fixes Krzysztof Kozlowski
                   ` (8 preceding siblings ...)
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 09/16] ci: print executed commands when configuring debian Krzysztof Kozlowski
@ 2021-07-10  3:38 ` Krzysztof Kozlowski
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 11/16] unit: pass real UTF-8 for testing text NDEF Krzysztof Kozlowski
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-10  3:38 UTC (permalink / raw)
  To: linux-nfc; +Cc: Krzysztof Kozlowski

There is separate step for showing compiler version.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 .github/workflows/ci.yml | 2 --
 1 file changed, 2 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 866fa846c7f8..e746eb67df29 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -60,8 +60,6 @@ jobs:
         lsb_release -a || true
         uname -a
         cat /proc/cmdline
-        gcc --version || true
-        clang --version || true
 
     - name: Configure
       run: ./bootstrap-configure
-- 
2.27.0
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [linux-nfc] [neard][PATCH 11/16] unit: pass real UTF-8 for testing text NDEF
  2021-07-10  3:38 [linux-nfc] [neard][PATCH 00/16] neard CI under Github and rouund of fixes Krzysztof Kozlowski
                   ` (9 preceding siblings ...)
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 10/16] ci: no need to print twice compiler version Krzysztof Kozlowski
@ 2021-07-10  3:38 ` Krzysztof Kozlowski
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 12/16] ndef: check UTF-16 text payload length Krzysztof Kozlowski
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-10  3:38 UTC (permalink / raw)
  To: linux-nfc; +Cc: Krzysztof Kozlowski

Let's polish this UTF-8. :)

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 unit/test-ndef-parse.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/unit/test-ndef-parse.c b/unit/test-ndef-parse.c
index 8cfdc8f2cb9d..d26f4c595d9a 100644
--- a/unit/test-ndef-parse.c
+++ b/unit/test-ndef-parse.c
@@ -145,9 +145,10 @@ struct near_ndef_ac_payload {
 static uint8_t uri[] = {0xd1, 0x1, 0xa, 0x55, 0x1, 0x69, 0x6e, 0x74,
 			0x65, 0x6c, 0x2e, 0x63, 0x6f, 0x6d};
 
-/* 'hello' - UTF-8 - en-US Text NDEF */
-static uint8_t text[] = {0xd1, 0x1, 0xb, 0x54, 0x5,  0x65, 0x6e, 0x2d,
-			 0x55, 0x53, 0x68, 0x65, 0x6c, 0x6c, 0x6f};
+/* 'hello żółw' - UTF-8 - en-US Text NDEF */
+static uint8_t text[] = {0xd1, 0x1, 0x13, 0x54, 0x5, 0x65, 0x6e, 0x2d,
+			 0x55, 0x53, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0xc5,
+			 0xbc, 0xc3, 0xb3, 0xc5, 0x82, 0x77};
 
 /* Smart poster with a http://intel.com URI record */
 static uint8_t single_sp[] = {0xd1, 0x2, 0xe, 0x53, 0x70, 0xd1, 0x1, 0xa,
@@ -234,7 +235,7 @@ static void test_ndef_text(void)
 	g_assert(record->header->me == 1);
 
 	g_assert(record->text);
-	g_assert(strcmp(record->text->data, "hello") == 0);
+	g_assert(strcmp(record->text->data, "hello żółw") == 0);
 	g_assert(strcmp(record->text->encoding, "UTF-8") == 0);
 	g_assert(strcmp(record->text->language_code, "en-US") == 0);
 
-- 
2.27.0
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [linux-nfc] [neard][PATCH 12/16] ndef: check UTF-16 text payload length
  2021-07-10  3:38 [linux-nfc] [neard][PATCH 00/16] neard CI under Github and rouund of fixes Krzysztof Kozlowski
                   ` (10 preceding siblings ...)
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 11/16] unit: pass real UTF-8 for testing text NDEF Krzysztof Kozlowski
@ 2021-07-10  3:38 ` Krzysztof Kozlowski
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 13/16] ndef: silence clang -Wcast-align warning Krzysztof Kozlowski
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-10  3:38 UTC (permalink / raw)
  To: linux-nfc; +Cc: Krzysztof Kozlowski

UTF-16 is supposed to be consisting of 16-bit codes (16-bit or 2x16-bit
per character) and parsing anything else is not safe because of cast to
gunichar2.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 src/ndef.c             |  5 +++++
 unit/test-ndef-parse.c | 19 +++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/src/ndef.c b/src/ndef.c
index 3d8815634d46..fdd44b467027 100644
--- a/src/ndef.c
+++ b/src/ndef.c
@@ -1189,6 +1189,11 @@ parse_text_payload(uint8_t *payload, uint32_t length)
 
 	len = length - lang_length - 1;
 
+	if (status && (len % 2)) {
+		DBG("Payload not valid UTF-16 (length %d does not match)", len);
+		goto fail;
+	}
+
 	if (len > 0) {
 		txt = (char *)(payload + offset);
 
diff --git a/unit/test-ndef-parse.c b/unit/test-ndef-parse.c
index d26f4c595d9a..6c62c7a928c7 100644
--- a/unit/test-ndef-parse.c
+++ b/unit/test-ndef-parse.c
@@ -150,6 +150,15 @@ static uint8_t text[] = {0xd1, 0x1, 0x13, 0x54, 0x5, 0x65, 0x6e, 0x2d,
 			 0x55, 0x53, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0xc5,
 			 0xbc, 0xc3, 0xb3, 0xc5, 0x82, 0x77};
 
+/* 'hello żółw' - UTF-16 - en-US Text NDEF UTF-16 malformed*/
+static uint8_t text_utf16_invalid[] = {0xd1, 0x1, 0x19, 0x54, 0x85,
+			/* en-US */
+			0x65, 0x6e, 0x2d, 0x55, 0x53,
+			/* hello żółw */
+			0x68, 0x00, 0x65, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x6f, 0x00,
+			/* Missing last byte */
+			0x20, 0x00, 0x7c, 0x01, 0xf3, 0x00, 0x42, 0x01, 0x77};
+
 /* Smart poster with a http://intel.com URI record */
 static uint8_t single_sp[] = {0xd1, 0x2, 0xe, 0x53, 0x70, 0xd1, 0x1, 0xa,
 			      0x55, 0x3, 0x69, 0x6e, 0x74, 0x65, 0x6c, 0x2e,
@@ -253,6 +262,15 @@ static void test_ndef_text(void)
 	test_ndef_free_record(record);
 }
 
+static void test_ndef_text_invalid_utf16(void)
+{
+	GList *records;
+
+	records = near_ndef_parse_msg(text_utf16_invalid, sizeof(text_utf16_invalid), NULL);
+
+	g_assert_null(records);
+}
+
 static void test_ndef_single_sp(void)
 {
 	GList *records;
@@ -422,6 +440,7 @@ int main(int argc, char **argv)
 
 	g_test_add_func("/testNDEF-parse/Test URI NDEF", test_ndef_uri);
 	g_test_add_func("/testNDEF-parse/Test Text NDEF", test_ndef_text);
+	g_test_add_func("/testNDEF-parse/Test Text NDEF UTF-16 malformed", test_ndef_text_invalid_utf16);
 	g_test_add_func("/testNDEF-parse/Test Single record SmartPoster NDEF",
 							test_ndef_single_sp);
 	g_test_add_func("/testNDEF-parse/Test Title record SmartPoster NDEF",
-- 
2.27.0
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [linux-nfc] [neard][PATCH 13/16] ndef: silence clang -Wcast-align warning
  2021-07-10  3:38 [linux-nfc] [neard][PATCH 00/16] neard CI under Github and rouund of fixes Krzysztof Kozlowski
                   ` (11 preceding siblings ...)
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 12/16] ndef: check UTF-16 text payload length Krzysztof Kozlowski
@ 2021-07-10  3:38 ` Krzysztof Kozlowski
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 14/16] ndef: fix parsing of UTF-16 text payload Krzysztof Kozlowski
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-10  3:38 UTC (permalink / raw)
  To: linux-nfc; +Cc: Krzysztof Kozlowski

Fix clang warning:

    src/ndef.c:1196:28: error: cast from 'char *' to 'gunichar2 *' (aka 'unsigned short *') increases required alignment from 1 to 2 [-Werror,-Wcast-align]
                            g_str = g_utf16_to_utf8((gunichar2 *)txt, len, NULL,
                                                    ^~~~~~~~~~~~~~~~

The case is safe as length of string is an even number.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 src/ndef.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/ndef.c b/src/ndef.c
index fdd44b467027..13e3356c2c4c 100644
--- a/src/ndef.c
+++ b/src/ndef.c
@@ -1198,7 +1198,8 @@ parse_text_payload(uint8_t *payload, uint32_t length)
 		txt = (char *)(payload + offset);
 
 		if (status)
-			g_str = g_utf16_to_utf8((gunichar2 *)txt, len, NULL,
+			/* Cast to void to silence the 1-to-2 alignment warning */
+			g_str = g_utf16_to_utf8((gunichar2 *)(void *)txt, len, NULL,
 						NULL, NULL);
 		else
 			g_str = txt;
-- 
2.27.0
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [linux-nfc] [neard][PATCH 14/16] ndef: fix parsing of UTF-16 text payload
  2021-07-10  3:38 [linux-nfc] [neard][PATCH 00/16] neard CI under Github and rouund of fixes Krzysztof Kozlowski
                   ` (12 preceding siblings ...)
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 13/16] ndef: silence clang -Wcast-align warning Krzysztof Kozlowski
@ 2021-07-10  3:38 ` Krzysztof Kozlowski
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 15/16] nfctype5: fix returning uninitialized stack value in t5_tag_is_ti_pro() Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-10  3:38 UTC (permalink / raw)
  To: linux-nfc; +Cc: Krzysztof Kozlowski

The string

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 src/ndef.c             | 22 ++++++++++++++--------
 unit/test-ndef-parse.c | 27 ++++++++++++++++++++-------
 2 files changed, 34 insertions(+), 15 deletions(-)

diff --git a/src/ndef.c b/src/ndef.c
index 13e3356c2c4c..093eba910027 100644
--- a/src/ndef.c
+++ b/src/ndef.c
@@ -1150,7 +1150,8 @@ parse_text_payload(uint8_t *payload, uint32_t length)
 {
 	struct near_ndef_text_payload *text_payload = NULL;
 	uint8_t status, lang_length, len;
-	char *g_str, *txt;
+	char *g_str = NULL;
+	char *txt;
 	uint32_t offset;
 	gboolean valid;
 
@@ -1189,9 +1190,12 @@ parse_text_payload(uint8_t *payload, uint32_t length)
 
 	len = length - lang_length - 1;
 
-	if (status && (len % 2)) {
-		DBG("Payload not valid UTF-16 (length %d does not match)", len);
-		goto fail;
+	if (status) {
+		if (len % 2) {
+			DBG("Payload not valid UTF-16 (length %d does not match)", len);
+			goto fail;
+		}
+		len /= 2;
 	}
 
 	if (len > 0) {
@@ -1206,13 +1210,13 @@ parse_text_payload(uint8_t *payload, uint32_t length)
 
 		valid = g_utf8_validate(g_str, len, NULL);
 
-		if (status)
-			g_free(g_str);
-
 		if (!valid)
 			goto fail;
 
-		text_payload->data = g_strndup(txt, len);
+		/* FIXME: this won't parse properly UTF-8 */
+		text_payload->data = g_strndup(g_str, len);
+		if (status)
+			g_free(g_str);
 	} else {
 		text_payload->data = NULL;
 	}
@@ -1227,6 +1231,8 @@ parse_text_payload(uint8_t *payload, uint32_t length)
 	return text_payload;
 
 fail:
+	if (status)
+		g_free(g_str);
 	near_error("text payload parsing failed");
 	free_text_payload(text_payload);
 
diff --git a/unit/test-ndef-parse.c b/unit/test-ndef-parse.c
index 6c62c7a928c7..073b36ac48ff 100644
--- a/unit/test-ndef-parse.c
+++ b/unit/test-ndef-parse.c
@@ -146,9 +146,16 @@ static uint8_t uri[] = {0xd1, 0x1, 0xa, 0x55, 0x1, 0x69, 0x6e, 0x74,
 			0x65, 0x6c, 0x2e, 0x63, 0x6f, 0x6d};
 
 /* 'hello żółw' - UTF-8 - en-US Text NDEF */
-static uint8_t text[] = {0xd1, 0x1, 0x13, 0x54, 0x5, 0x65, 0x6e, 0x2d,
-			 0x55, 0x53, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0xc5,
-			 0xbc, 0xc3, 0xb3, 0xc5, 0x82, 0x77};
+static uint8_t text_utf8[] = {0xd1, 0x1, 0x13, 0x54, 0x5, 0x65, 0x6e, 0x2d,
+			0x55, 0x53, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0xc5,
+			0xbc, 0xc3, 0xb3, 0xc5, 0x82, 0x77};
+
+/* 'hello' - UTF-16 - en-US Text NDEF */
+static uint8_t text_utf16[] = {0xd1, 0x1, 0x10, 0x54, 0x85,
+			/* en-US */
+			0x65, 0x6e, 0x2d, 0x55, 0x53,
+			/* hello żółw */
+			0x68, 0x00, 0x65, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x6f, 0x00};
 
 /* 'hello żółw' - UTF-16 - en-US Text NDEF UTF-16 malformed*/
 static uint8_t text_utf16_invalid[] = {0xd1, 0x1, 0x19, 0x54, 0x85,
@@ -227,12 +234,12 @@ static void test_ndef_uri(void)
 	test_ndef_free_record(record);
 }
 
-static void test_ndef_text(void)
+static void test_ndef_text_encoding(uint8_t *text, size_t len, const char *encoding, const char *expected)
 {
 	GList *records;
 	struct near_ndef_record *record;
 
-	records = near_ndef_parse_msg(text, sizeof(text), NULL);
+	records = near_ndef_parse_msg(text, len, NULL);
 
 	g_assert(records);
 	g_assert(g_list_length(records) == 1);
@@ -244,8 +251,8 @@ static void test_ndef_text(void)
 	g_assert(record->header->me == 1);
 
 	g_assert(record->text);
-	g_assert(strcmp(record->text->data, "hello żółw") == 0);
-	g_assert(strcmp(record->text->encoding, "UTF-8") == 0);
+	g_assert(strcmp(record->text->data, expected) == 0);
+	g_assert(strcmp(record->text->encoding, encoding) == 0);
 	g_assert(strcmp(record->text->language_code, "en-US") == 0);
 
 	if (g_test_verbose()) {
@@ -262,6 +269,12 @@ static void test_ndef_text(void)
 	test_ndef_free_record(record);
 }
 
+static void test_ndef_text(void)
+{
+	test_ndef_text_encoding(text_utf8, sizeof(text_utf8), "UTF-8", "hello żółw");
+	test_ndef_text_encoding(text_utf16, sizeof(text_utf16), "UTF-16", "hello");
+}
+
 static void test_ndef_text_invalid_utf16(void)
 {
 	GList *records;
-- 
2.27.0
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [linux-nfc] [neard][PATCH 15/16] nfctype5: fix returning uninitialized stack value in t5_tag_is_ti_pro()
  2021-07-10  3:38 [linux-nfc] [neard][PATCH 00/16] neard CI under Github and rouund of fixes Krzysztof Kozlowski
                   ` (13 preceding siblings ...)
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 14/16] ndef: fix parsing of UTF-16 text payload Krzysztof Kozlowski
@ 2021-07-10  3:38 ` Krzysztof Kozlowski
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 16/16] ci: add clang builds Krzysztof Kozlowski
  2021-07-19  1:40 ` [linux-nfc] Re: [neard][PATCH 00/16] neard CI under Github and rouund of fixes Mark Greer
  16 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-10  3:38 UTC (permalink / raw)
  To: linux-nfc; +Cc: Krzysztof Kozlowski

The return value was not initialized so if tag was not matching, random
stack value (usually true) was returned instead of false.

This fixes clang warning:

    plugins/nfctype5.c:257:6: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
            if ((uid[5] == 0xc4) || (uid[5] == 0xc5))
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    plugins/nfctype5.c:261:9: note: uninitialized use occurs here
            return ret;
                   ^~~
    plugins/nfctype5.c:257:2: note: remove the 'if' if its condition is always true
            if ((uid[5] == 0xc4) || (uid[5] == 0xc5))
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    plugins/nfctype5.c:248:10: note: initialize the variable 'ret' to silence this warning
            bool ret;
                    ^
                     = false

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 plugins/nfctype5.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/nfctype5.c b/plugins/nfctype5.c
index 3d2cdf030d4f..b7d240e519be 100644
--- a/plugins/nfctype5.c
+++ b/plugins/nfctype5.c
@@ -245,7 +245,7 @@ static bool t5_tag_is_ti_std(struct near_tag *tag)
 static bool t5_tag_is_ti_pro(struct near_tag *tag)
 {
 	uint8_t *uid;
-	bool ret;
+	bool ret = false;
 
 	uid = near_tag_get_iso15693_uid(near_tag_get_adapter_idx(tag),
 					near_tag_get_target_idx(tag));
-- 
2.27.0
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [linux-nfc] [neard][PATCH 16/16] ci: add clang builds
  2021-07-10  3:38 [linux-nfc] [neard][PATCH 00/16] neard CI under Github and rouund of fixes Krzysztof Kozlowski
                   ` (14 preceding siblings ...)
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 15/16] nfctype5: fix returning uninitialized stack value in t5_tag_is_ti_pro() Krzysztof Kozlowski
@ 2021-07-10  3:38 ` Krzysztof Kozlowski
  2021-07-19  1:40 ` [linux-nfc] Re: [neard][PATCH 00/16] neard CI under Github and rouund of fixes Mark Greer
  16 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-10  3:38 UTC (permalink / raw)
  To: linux-nfc; +Cc: Krzysztof Kozlowski

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 .github/workflows/ci.yml | 10 ++++++++++
 ci/debian.sh             |  9 +++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e746eb67df29..fb322381e7f5 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -16,6 +16,7 @@ jobs:
       fail-fast: false
       matrix:
         include:
+          # Ubuntu gcc
           - container: "ubuntu:hirsute"
             env:
               CC: gcc
@@ -32,6 +33,15 @@ jobs:
             env:
               CC: gcc
 
+          # Ubuntu clang
+          - container: "ubuntu:hirsute"
+            env:
+              CC: clang
+
+          - container: "ubuntu:focal"
+            env:
+              CC: clang
+
     container:
       image: ${{ matrix.container }}
       env: ${{ matrix.env }}
diff --git a/ci/debian.sh b/ci/debian.sh
index 35eb3681f059..1d31d8364982 100755
--- a/ci/debian.sh
+++ b/ci/debian.sh
@@ -20,13 +20,18 @@ tzdata tzdata/Zones/Europe select Berlin
 " > /tmp/tzdata-preseed.txt
 debconf-set-selections /tmp/tzdata-preseed.txt
 
+PKGS_CC="build-essential"
+if [ "$CC" == "clang" ]; then
+	PKGS_CC="clang"
+fi
+
+
 apt install -y --no-install-recommends \
 	autoconf \
 	automake \
-	build-essential \
 	libdbus-1-dev \
 	libglib2.0-dev \
 	libnl-3-dev \
 	libnl-genl-3-dev \
 	libtool \
-
+	$PKGS_CC
-- 
2.27.0
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [linux-nfc] Re: [neard][PATCH 00/16] neard CI under Github and rouund of fixes
  2021-07-10  3:38 [linux-nfc] [neard][PATCH 00/16] neard CI under Github and rouund of fixes Krzysztof Kozlowski
                   ` (15 preceding siblings ...)
  2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 16/16] ci: add clang builds Krzysztof Kozlowski
@ 2021-07-19  1:40 ` Mark Greer
  2021-07-19  8:04   ` Krzysztof Kozlowski
  16 siblings, 1 reply; 19+ messages in thread
From: Mark Greer @ 2021-07-19  1:40 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: linux-nfc

On Sat, Jul 10, 2021 at 05:38:43AM +0200, Krzysztof Kozlowski wrote:
> Hi,

Hi Krzysztof

> Mark proposed to do some work around neard (the user-space counterpart
> of NFC drivers) [1], so here it is.
> 
> I made a fork on Github [2] and I add here Continuous Integration via
> Github actions. These are pretty easy to set up. For starting only few
> builds are done, but I have also more in the queue - just need to fix
> 32-bit and clang builds.
> 
> The neard fails to compile on GCC v10 (earlier maybe as well) in
> maintainer moe (so with some warnings enabled) which is fixed here. It
> is also first round of fixes around UTF-8 and UTF-16 parsing, although
> this is not finished yet.
> 
> Further plans:
> 1. Decide whether official releases should be made from Github or
>    kernel.org.
> 2. Fix for clang.
> 3. Fix UTF-8 and UTF-16 in ndef.
> 4. Add more unit tests around ndef and others (help would be here
>    appreciated).
> 5. Add more GCC/clang warnings and fix them.
> 6. Add some static analysis checks in Github CI.
> 
> [1] https://lore.kernel.org/linux-nfc/20210512144319.30852-1-krzysztof.kozlowski@canonical.com/T/#m6a1cdae5f435b295cc7670c361b5bdc1daf30273
> [2] https://github.com/krzk/neard

[This pertains to all of your patch sets that you've submitted.]

I started looking at these today but this patch series does not apply on
top of the current neard master branch.  Also, there are CI patches
intermingled with code-changing patches (and at least one patch that
changes both (12th patch of second patch series).  Looking at your
neard repository, there seems to be some patches in there that haven't
been submitted via email.  Would you mind separating out CI patches from
code patches (i.e., separate patch sets and email threads), ensuring
that all patches are included, then re-submitting?

In the meantime, I will continue to get my NFC hardware running which
has been its own adventure.

Thanks,

Mark
--
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [linux-nfc] Re: [neard][PATCH 00/16] neard CI under Github and rouund of fixes
  2021-07-19  1:40 ` [linux-nfc] Re: [neard][PATCH 00/16] neard CI under Github and rouund of fixes Mark Greer
@ 2021-07-19  8:04   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-19  8:04 UTC (permalink / raw)
  To: Mark Greer; +Cc: linux-nfc

On 19/07/2021 03:40, Mark Greer wrote:
> On Sat, Jul 10, 2021 at 05:38:43AM +0200, Krzysztof Kozlowski wrote:
>> Hi,
> 
> Hi Krzysztof
> 
>> Mark proposed to do some work around neard (the user-space counterpart
>> of NFC drivers) [1], so here it is.
>>
>> I made a fork on Github [2] and I add here Continuous Integration via
>> Github actions. These are pretty easy to set up. For starting only few
>> builds are done, but I have also more in the queue - just need to fix
>> 32-bit and clang builds.
>>
>> The neard fails to compile on GCC v10 (earlier maybe as well) in
>> maintainer moe (so with some warnings enabled) which is fixed here. It
>> is also first round of fixes around UTF-8 and UTF-16 parsing, although
>> this is not finished yet.
>>
>> Further plans:
>> 1. Decide whether official releases should be made from Github or
>>    kernel.org.
>> 2. Fix for clang.
>> 3. Fix UTF-8 and UTF-16 in ndef.
>> 4. Add more unit tests around ndef and others (help would be here
>>    appreciated).
>> 5. Add more GCC/clang warnings and fix them.
>> 6. Add some static analysis checks in Github CI.
>>
>> [1] https://lore.kernel.org/linux-nfc/20210512144319.30852-1-krzysztof.kozlowski@canonical.com/T/#m6a1cdae5f435b295cc7670c361b5bdc1daf30273
>> [2] https://github.com/krzk/neard
> 
> [This pertains to all of your patch sets that you've submitted.]
> 
> I started looking at these today but this patch series does not apply on
> top of the current neard master branch.  Also, there are CI patches
> intermingled with code-changing patches (and at least one patch that
> changes both (12th patch of second patch series).  Looking at your
> neard repository, there seems to be some patches in there that haven't
> been submitted via email.  Would you mind separating out CI patches from
> code patches (i.e., separate patch sets and email threads), ensuring
> that all patches are included, then re-submitting?

Sure, good point!


Best regards,
Krzysztof
_______________________________________________
Linux-nfc mailing list -- linux-nfc@lists.01.org
To unsubscribe send an email to linux-nfc-leave@lists.01.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2021-07-19  8:04 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-10  3:38 [linux-nfc] [neard][PATCH 00/16] neard CI under Github and rouund of fixes Krzysztof Kozlowski
2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 01/16] nfctool: fix adapter_compare_idx() cast-function-type Krzysztof Kozlowski
2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 02/16] nfctool: fix nfctool_send_dep_link_up() cast-function-type Krzysztof Kozlowski
2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 03/16] nfctool: fix nfctool_print_and_remove_snl() cast-function-type Krzysztof Kozlowski
2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 04/16] ci: temporarily disable Ubuntu Hirsute Krzysztof Kozlowski
2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 05/16] dbus: fix -Wformat in near_dbus_encode_string() Krzysztof Kozlowski
2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 06/16] bootstrap: parse CROSS_COMPILE and set proper configure option Krzysztof Kozlowski
2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 07/16] ci: add SPDX and copyright notes to ci.yml Krzysztof Kozlowski
2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 08/16] ci: enable back Ubuntu Hirsute Krzysztof Kozlowski
2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 09/16] ci: print executed commands when configuring debian Krzysztof Kozlowski
2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 10/16] ci: no need to print twice compiler version Krzysztof Kozlowski
2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 11/16] unit: pass real UTF-8 for testing text NDEF Krzysztof Kozlowski
2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 12/16] ndef: check UTF-16 text payload length Krzysztof Kozlowski
2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 13/16] ndef: silence clang -Wcast-align warning Krzysztof Kozlowski
2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 14/16] ndef: fix parsing of UTF-16 text payload Krzysztof Kozlowski
2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 15/16] nfctype5: fix returning uninitialized stack value in t5_tag_is_ti_pro() Krzysztof Kozlowski
2021-07-10  3:38 ` [linux-nfc] [neard][PATCH 16/16] ci: add clang builds Krzysztof Kozlowski
2021-07-19  1:40 ` [linux-nfc] Re: [neard][PATCH 00/16] neard CI under Github and rouund of fixes Mark Greer
2021-07-19  8:04   ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).