Hello community, here is the log from the commit of package telemetrics-client for openSUSE:Factory checked in at 2019-12-27 13:48:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/telemetrics-client (Old) and /work/SRC/openSUSE:Factory/.telemetrics-client.new.6675 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "telemetrics-client" Fri Dec 27 13:48:58 2019 rev:7 rq:759198 version:2.3.2+git20191217.8ca2993 Changes: -------- --- /work/SRC/openSUSE:Factory/telemetrics-client/telemetrics-client.changes 2019-12-09 21:37:15.290050152 +0100 +++ /work/SRC/openSUSE:Factory/.telemetrics-client.new.6675/telemetrics-client.changes 2019-12-27 13:49:04.644475814 +0100 @@ -1,0 +2,14 @@ +Wed Dec 18 11:59:21 UTC 2019 - [email protected] + +- Update to version 2.3.2+git20191217.8ca2993: + * configure.ac: bump version + * klog_scanner.c: truncate payload if needed + * Merge BERT probe with klogscanner + * configure.ac: bump version to v2.3.1 + * bertprobe: fix failures and logging + * configure.ac: bump version to v2.3.0 + * telemctl.c: validate privileges + * Add github actions CI. + * Require explicit telemctl opt-in + +------------------------------------------------------------------- Old: ---- telemetrics-client-2.2.3+git20191008.4119bde.tar.xz New: ---- telemetrics-client-2.3.2+git20191217.8ca2993.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ telemetrics-client.spec ++++++ --- /var/tmp/diff_new_pack.4pvEht/_old 2019-12-27 13:49:05.376476334 +0100 +++ /var/tmp/diff_new_pack.4pvEht/_new 2019-12-27 13:49:05.380476337 +0100 @@ -17,7 +17,7 @@ Name: telemetrics-client -Version: 2.2.3+git20191008.4119bde +Version: 2.3.2+git20191217.8ca2993 Release: 0 Summary: Telemetrics solution License: LGPL-2.1-or-later @@ -103,7 +103,7 @@ %{_prefix}/lib/telemetrics-probes %{_sysusersdir}/telemetrics-users.conf %{_tmpfilesdir}/telemetrics-dirs.conf -%{_libdir}/libtelemetry.so.3* +%{_libdir}/libtelemetry.so.4* %dir %{_datadir}/defaults %dir %{_datadir}/defaults/telemetrics %{_datadir}/defaults/telemetrics/telemetrics.conf ++++++ _service ++++++ --- /var/tmp/diff_new_pack.4pvEht/_old 2019-12-27 13:49:05.400476351 +0100 +++ /var/tmp/diff_new_pack.4pvEht/_new 2019-12-27 13:49:05.400476351 +0100 @@ -1,7 +1,7 @@ <services> <service name="tar_scm" mode="disabled"> - <param name="version">2.2.3</param> - <param name="versionformat">2.2.3+git%cd.%h</param> + <param name="version">2.3.2</param> + <param name="versionformat">2.3.2+git%cd.%h</param> <param name="url">git://github.com/clearlinux/telemetrics-client.git</param> <param name="scm">git</param> <param name="changesgenerate">enable</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.4pvEht/_old 2019-12-27 13:49:05.412476360 +0100 +++ /var/tmp/diff_new_pack.4pvEht/_new 2019-12-27 13:49:05.412476360 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/clearlinux/telemetrics-client.git</param> - <param name="changesrevision">4119bdea338d5221559d087ebc38c540d341db2b</param> + <param name="changesrevision">8ca299314c04aea61b5185d775965d834e4e87e5</param> </service> </servicedata> \ No newline at end of file ++++++ install-paths.diff ++++++ --- /var/tmp/diff_new_pack.4pvEht/_old 2019-12-27 13:49:05.416476363 +0100 +++ /var/tmp/diff_new_pack.4pvEht/_new 2019-12-27 13:49:05.420476366 +0100 @@ -1,5 +1,5 @@ diff --git a/configure.ac b/configure.ac -index d5b9bdf..6fe2dc1 100644 +index ef5cbcc..4f36390 100644 --- a/configure.ac +++ b/configure.ac @@ -157,7 +157,9 @@ telemetrics-client $VERSION @@ -19,25 +19,12 @@ @@ -1 +1 @@ -kernel.core_pattern = |@bindir@/crashprobe -p %e -E %E -s %s +kernel.core_pattern = |@libexecdir@/crashprobe -p %e -E %E -s %s -diff --git a/src/data/bert-probe.service.in b/src/data/bert-probe.service.in -index 9bd4f91..08b0bb3 100644 ---- a/src/data/bert-probe.service.in -+++ b/src/data/bert-probe.service.in -@@ -6,7 +6,7 @@ ConditionPathExists=!/etc/telemetrics/opt-out - ConditionPathExists=/sys/firmware/acpi/tables/data/BERT - - [Service] --ExecStart=@bindir@/bertprobe -+ExecStart=@libexecdir@/bertprobe - User=telemetry - - [Install] diff --git a/src/data/hprobe.service.in b/src/data/hprobe.service.in -index 41574cf..d110026 100644 +index 353f2f5..1826f42 100644 --- a/src/data/hprobe.service.in +++ b/src/data/hprobe.service.in @@ -5,7 +5,7 @@ After=telemprobd.socket - ConditionPathExists=!/etc/telemetrics/opt-out + ConditionPathExists=/etc/telemetrics/opt-in [Service] -ExecStart=@bindir@/hprobe -Hlu @@ -46,11 +33,11 @@ [Install] diff --git a/src/data/journal-probe-tail.service.in b/src/data/journal-probe-tail.service.in -index c65b812..a7f1541 100644 +index 7b78056..cebc0f5 100644 --- a/src/data/journal-probe-tail.service.in +++ b/src/data/journal-probe-tail.service.in @@ -5,7 +5,7 @@ After=telemprobd.socket - ConditionPathExists=!/etc/telemetrics/opt-out + ConditionPathExists=/etc/telemetrics/opt-in [Service] -ExecStart=@bindir@/journalprobe -t @@ -59,11 +46,11 @@ [Install] diff --git a/src/data/journal-probe.service.in b/src/data/journal-probe.service.in -index d81b2c7..08a9b58 100644 +index 9ae0bcb..3a9d4d3 100644 --- a/src/data/journal-probe.service.in +++ b/src/data/journal-probe.service.in @@ -5,7 +5,7 @@ After=telemprobd.socket - ConditionPathExists=!/etc/telemetrics/opt-out + ConditionPathExists=/etc/telemetrics/opt-in [Service] -ExecStart=@bindir@/journalprobe @@ -85,7 +72,7 @@ [Install] WantedBy=multi-user.target diff --git a/src/data/local.mk b/src/data/local.mk -index a418afb..8bcd203 100644 +index ef99737..a08eaaa 100644 --- a/src/data/local.mk +++ b/src/data/local.mk @@ -2,6 +2,8 @@ pathfix = @sed \ @@ -111,11 +98,11 @@ [Install] WantedBy=multi-user.target diff --git a/src/data/pstore-probe.service.in b/src/data/pstore-probe.service.in -index 8eace15..4bab2db 100644 +index b6ba1ec..cff3e94 100644 --- a/src/data/pstore-probe.service.in +++ b/src/data/pstore-probe.service.in -@@ -4,7 +4,7 @@ Requires=telemprobd.socket - After=telemprobd.socket +@@ -5,7 +5,7 @@ After=telemprobd.socket + ConditionPathExists=/etc/telemetrics/opt-in [Service] -ExecStart=@bindir@/pstoreprobe @@ -124,11 +111,11 @@ [Install] diff --git a/src/data/telempostd.service.in b/src/data/telempostd.service.in -index b0dfb73..f63e5f6 100644 +index d2d2137..c320763 100644 --- a/src/data/telempostd.service.in +++ b/src/data/telempostd.service.in @@ -3,7 +3,7 @@ Description=Telemetrics Post Daemon - ConditionPathExists=!/etc/telemetrics/opt-out + ConditionPathExists=/etc/telemetrics/opt-in [Service] -ExecStart=@bindir@/telempostd @@ -137,11 +124,11 @@ User=telemetry diff --git a/src/data/telemprobd.service.in b/src/data/telemprobd.service.in -index 71e5fbd..946645f 100644 +index aec1650..06ccb27 100644 --- a/src/data/telemprobd.service.in +++ b/src/data/telemprobd.service.in @@ -3,7 +3,7 @@ Description=Telemetrics Daemon - ConditionPathExists=!/etc/telemetrics/opt-out + ConditionPathExists=/etc/telemetrics/opt-in [Service] -ExecStart=@bindir@/telemprobd @@ -160,7 +147,7 @@ %C%_telem_journal_SOURCES = %D%/cli.c \ diff --git a/src/local.mk b/src/local.mk -index 9b155f2..997480f 100644 +index c3a5114..147462a 100644 --- a/src/local.mk +++ b/src/local.mk @@ -1,4 +1,4 @@ @@ -188,7 +175,7 @@ %C%_telempostd_LDFLAGS = \ $(AM_LDFLAGS) \ diff --git a/src/probes/local.mk b/src/probes/local.mk -index 28a0518..880a4c6 100644 +index f1e09f0..7213249 100644 --- a/src/probes/local.mk +++ b/src/probes/local.mk @@ -1,7 +1,8 @@ @@ -201,8 +188,8 @@ - %D%/telem-record-gen \ %D%/klogscanner \ %D%/pstoreprobe \ - %D%/pstoreclean \ -@@ -156,7 +157,7 @@ endif + %D%/pstoreclean +@@ -125,7 +126,7 @@ endif if HAVE_SYSTEMD_JOURNAL if HAVE_SYSTEMD_ID128 ++++++ telemctl-enable-disable.diff ++++++ --- /var/tmp/diff_new_pack.4pvEht/_old 2019-12-27 13:49:05.424476369 +0100 +++ /var/tmp/diff_new_pack.4pvEht/_new 2019-12-27 13:49:05.424476369 +0100 @@ -1,5 +1,5 @@ diff --git a/docs/man/telemctl.1.rst b/docs/man/telemctl.1.rst -index 2aef720..0ab7017 100644 +index c4c7eed..8127f33 100644 --- a/docs/man/telemctl.1.rst +++ b/docs/man/telemctl.1.rst @@ -31,6 +31,9 @@ OPTIONS @@ -10,13 +10,13 @@ + Enables or disables all telemetry services. + * ``opt-in``: - Opts in to telemetry, and starts telemetry services. The opt-out file - ``/etc/telemetrics/opt-out`` is removed. + Opts in to telemetry and the opt-in file ``/etc/telemetrics/opt-in`` + is created. Note: this is a one time required operation before diff --git a/src/telemctl.c b/src/telemctl.c -index 4df8dbb..ade3659 100644 +index 599b74e..2c46cd4 100644 --- a/src/telemctl.c +++ b/src/telemctl.c -@@ -64,6 +64,8 @@ static char *SERVICES[] = { +@@ -63,6 +63,8 @@ static char *SERVICES[] = { static int telemctl_start(void); static int telemctl_stop(void); static int telemctl_restart(void); @@ -25,16 +25,16 @@ static int telemctl_is_active(void); static int telemctl_opt_out(void); static int telemctl_opt_in(void); -@@ -82,6 +84,8 @@ static struct telemcmd commands[] = { - {"stop", {.f1=telemctl_stop}, "Stops all running telemetry services" }, - {"start", {.f1=telemctl_start}, "Starts all telemetry services" }, - {"restart", {.f1=telemctl_restart}, "Restarts all telemetry services" }, -+ {"enable", {.f1=telemctl_enable}, "Enable telemetry services" }, -+ {"disable", {.f1=telemctl_disable}, "Disable telemetry services" }, - {"is-active", {.f1=telemctl_is_active},"Checks if telemprobd and telempostd are active" }, - {"opt-in", {.f1=telemctl_opt_in}, "Opts in to telemetry, and starts telemetry services" }, - {"opt-out", {.f1=telemctl_opt_out}, "Opts out of telemetry, and stops telemetry services" }, -@@ -216,6 +220,38 @@ static int telemctl_restart(void) +@@ -83,6 +85,8 @@ static struct telemcmd commands[] = { + {true, "start", {.f1=telemctl_start}, "Starts all telemetry services" }, + {true, "restart", {.f1=telemctl_restart}, "Restarts all telemetry services" }, + {false, "is-active", {.f1=telemctl_is_active},"Checks if telemprobd and telempostd are active" }, ++ {true, "enable", {.f1=telemctl_enable}, "Enable telemetry services" }, ++ {true, "disable", {.f1=telemctl_disable}, "Disable telemetry services" }, + {true, "opt-in", {.f1=telemctl_opt_in}, "Opts in to telemetry, and starts telemetry services" }, + {true, "opt-out", {.f1=telemctl_opt_out}, "Opts out of telemetry, and stops telemetry services" }, + {true, "journal", {.f2=telemctl_journal}, "Prints telemetry journal contents. Use -h argument with\n command for more options"} +@@ -218,6 +222,38 @@ static int telemctl_restart(void) /* Script code: ++++++ telemetrics-client-2.2.3+git20191008.4119bde.tar.xz -> telemetrics-client-2.3.2+git20191217.8ca2993.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/.github/workflows/ccpp.yml new/telemetrics-client-2.3.2+git20191217.8ca2993/.github/workflows/ccpp.yml --- old/telemetrics-client-2.2.3+git20191008.4119bde/.github/workflows/ccpp.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/.github/workflows/ccpp.yml 2019-12-18 03:39:20.000000000 +0100 @@ -0,0 +1,29 @@ +name: C/C++ CI + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: install dependencies + run: sudo apt-get install libcurl4-gnutls-dev valgrind libelf-dev libdw-dev + - name: install check + run: wget https://github.com/libcheck/check/releases/download/0.12.0/check-0.12.0.tar.gz && + tar xf check-0.12.0.tar.gz && + pushd check-0.12.0 && + ./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu && + make -j8 && sudo make install && popd + - name: autogen + run: sh autogen.sh + - name: configure + run: ./configure + - name: make + run: make -j8 + - name: check + run: make check + - name: make distcheck + run: make distcheck diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/README.md new/telemetrics-client-2.3.2+git20191217.8ca2993/README.md --- old/telemetrics-client-2.2.3+git20191008.4119bde/README.md 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/README.md 2019-12-18 03:39:20.000000000 +0100 @@ -67,38 +67,47 @@ Starting the client --------------------- +To use the telemetrics client a one time explicit ```opt-in``` is required (this is +also true when the contents of the directory ```/etc/telemetrics/``` are removed). +To opt-in to telemetrics-client use the command: + +```{r, engine='bash', count_lines} + telemctl opt-in +``` + +**Note** this is a change from previous versions, before 2.3.0 installation of +telemetrics client was enough to enable the client and if needed the client could +be disabled with ```telemctl opt-out```. This command in previous versions created +```/etc/telemetrics/opt-out``` file (after telemetrics-client version 2.3.0 this +file can be safely removed). If the client was compiled with systemd support the respective activation units should be already in place (after a ```make install``` invocation). In this case the client wil start automatically when data is made available to it. i.e. when -executing an ```/usr/bin/hprobe``` command. - -Method 1 (recommended): +executing an ```/usr/bin/hprobe``` command. Otherwise use the following command: ```{r, engine='bash', count_lines} telemctl start ``` - Note: the above invocation technically readies the service for both socket and -path activation, so you may not see an "active" status. - -Method 2: +path activation, so you may not see an "active" status. To check the status of +telemetrics-client use: ```{r, engine='bash', count_lines} -systemctl start telemprobd.service -systemctl start telempostd.service + telemctl is-active + telemprobd : active + telempostd : active ``` -Method 3: - -```{r, engine='bash', count_lines} -telemprobd & -telempostd & -``` +Starting individual service units ```telempostd.service``` or ```telemeprobd.service``` +is discouraged. Configure the client to autostart at boot --------------------- +As longs as the first time ```opt-in``` was performed, the following methods are valid: + + Method 1 (recommended): Enable the socket-activated service and path unit: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/configure.ac new/telemetrics-client-2.3.2+git20191217.8ca2993/configure.ac --- old/telemetrics-client-2.2.3+git20191008.4119bde/configure.ac 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/configure.ac 2019-12-18 03:39:20.000000000 +0100 @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT([telemetrics-client], [2.2.3], [https://clearlinux.org/]) +AC_INIT([telemetrics-client], [2.3.2], [https://clearlinux.org/]) AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([1.14 -Wall -Werror -Wno-extra-portability foreign subdir-objects]) AM_SILENT_RULES([yes]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/docs/man/telemctl.1 new/telemetrics-client-2.3.2+git20191217.8ca2993/docs/man/telemctl.1 --- old/telemetrics-client-2.2.3+git20191008.4119bde/docs/man/telemctl.1 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/docs/man/telemctl.1 2019-12-18 03:39:20.000000000 +0100 @@ -34,7 +34,7 @@ .sp \fBtelemctl\fP .sp -\fB/etc/telemetrics/opt\-out\fP +\fB/etc/telemetrics/opt\-in\fP .SH DESCRIPTION .sp Control actions for telemetry services. The command can be used to start, @@ -48,12 +48,13 @@ Starts, stops or restarts all running telemetry services. .IP \(bu 2 \fBopt\-in\fP: -Opts in to telemetry, and starts telemetry services. The opt\-out file -\fB/etc/telemetrics/opt\-out\fP is removed. +Opts in to telemetry and the opt\-in file \fB/etc/telemetrics/opt\-in\fP +is created. Note: this is a one time required operation before +telemetry can be used the first time. .IP \(bu 2 \fBopt\-out\fP: -Opts out of telemetry, and stops telemetry services. The opt\-out file -\fB/etc/telemetrics/opt\-out\fP is created. +Opts out of telemetry, and stops telemetry services. The opt\-in file +\fB/etc/telemetrics/opt\-in\fP is deleted. .IP \(bu 2 \fBis\-active\fP: Checks if telemetry client daemons are active (telemprobd and telempostd). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/docs/man/telemctl.1.rst new/telemetrics-client-2.3.2+git20191217.8ca2993/docs/man/telemctl.1.rst --- old/telemetrics-client-2.2.3+git20191008.4119bde/docs/man/telemctl.1.rst 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/docs/man/telemctl.1.rst 2019-12-18 03:39:20.000000000 +0100 @@ -15,7 +15,7 @@ ``telemctl`` -``/etc/telemetrics/opt-out`` +``/etc/telemetrics/opt-in`` DESCRIPTION @@ -32,12 +32,13 @@ Starts, stops or restarts all running telemetry services. * ``opt-in``: - Opts in to telemetry, and starts telemetry services. The opt-out file - ``/etc/telemetrics/opt-out`` is removed. + Opts in to telemetry and the opt-in file ``/etc/telemetrics/opt-in`` + is created. Note: this is a one time required operation before + telemetry can be used the first time. * ``opt-out``: - Opts out of telemetry, and stops telemetry services. The opt-out file - ``/etc/telemetrics/opt-out`` is created. + Opts out of telemetry, and stops telemetry services. The opt-in file + ``/etc/telemetrics/opt-in`` is deleted. * ``is-active``: Checks if telemetry client daemons are active (telemprobd and telempostd). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/docs/man/telemetry.3 new/telemetrics-client-2.3.2+git20191217.8ca2993/docs/man/telemetry.3 --- old/telemetrics-client-2.2.3+git20191008.4119bde/docs/man/telemetry.3 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/docs/man/telemetry.3 2019-12-18 03:39:20.000000000 +0100 @@ -45,6 +45,8 @@ \fBvoid tm_free_record(struct telem_ref *t_ref)\fP .sp \fBint tm_set_config_file(const char *c_file)\fP +.sp +\fBint tm_is_opted_in(void)\fP .SH DESCRIPTION .sp The functions in the telemetry library facilitate the delivery of @@ -64,11 +66,15 @@ .sp The function \fBtm_set_config_file()\fP can be used to provide an alternate configuration path to the telemetry library. +.sp +\fBtm_is_opted_in\fP is a utility provided to check if the one time opt\-in +has been performed. .SH RETURN VALUES .sp All these functions return \fB0\fP on success, or a non\-zero return value if an error occurred. The function \fBtm_free_record()\fP does not return -any value. +any value. \fBtm_is_opted_in\fP returns \fB1\fP when telemetry is opted\-in +otherwise \fB0\fP\&. .SH SEE ALSO .INDENT 0.0 .IP \(bu 2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/docs/man/telemetry.3.rst new/telemetrics-client-2.3.2+git20191217.8ca2993/docs/man/telemetry.3.rst --- old/telemetrics-client-2.2.3+git20191008.4119bde/docs/man/telemetry.3.rst 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/docs/man/telemetry.3.rst 2019-12-18 03:39:20.000000000 +0100 @@ -27,6 +27,8 @@ ``int tm_set_config_file(const char *c_file)`` +``int tm_is_opted_in(void)`` + DESCRIPTION =========== @@ -49,13 +51,16 @@ The function ``tm_set_config_file()`` can be used to provide an alternate configuration path to the telemetry library. +``tm_is_opted_in`` is a utility provided to check if the one time opt-in +has been performed. RETURN VALUES ============= All these functions return ``0`` on success, or a non-zero return value if an error occurred. The function ``tm_free_record()`` does not return -any value. +any value. ``tm_is_opted_in`` returns ``1`` when telemetry is opted-in +otherwise ``0``. SEE ALSO diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/common.h new/telemetrics-client-2.3.2+git20191217.8ca2993/src/common.h --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/common.h 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/common.h 2019-12-18 03:39:20.000000000 +0100 @@ -75,7 +75,7 @@ #define TM_SITE_VERSION_FILE "/etc/os-release" #define TM_DIST_VERSION_FILE "/usr/lib/os-release" -#define TM_OPT_OUT_FILE "/etc/telemetrics/opt-out" +#define TM_OPT_IN_FILE "/etc/telemetrics/opt-in" /* Currently max supported payload size is 8kb */ #define MAX_PAYLOAD_LENGTH 8192 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/bert-probe.service.in new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/bert-probe.service.in --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/bert-probe.service.in 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/bert-probe.service.in 1970-01-01 01:00:00.000000000 +0100 @@ -1,13 +0,0 @@ -[Unit] -Description=Telemetrics BERT Probe -Requires=telemprobd.socket -After=telemprobd.socket -ConditionPathExists=!/etc/telemetrics/opt-out -ConditionPathExists=/sys/firmware/acpi/tables/data/BERT - -[Service] -ExecStart=@bindir@/bertprobe -User=telemetry - -[Install] -WantedBy=multi-user.target diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/hprobe.service.in new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/hprobe.service.in --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/hprobe.service.in 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/hprobe.service.in 2019-12-18 03:39:20.000000000 +0100 @@ -2,7 +2,7 @@ Description=Telemetrics Heartbeat Probe Requires=telemprobd.socket After=telemprobd.socket -ConditionPathExists=!/etc/telemetrics/opt-out +ConditionPathExists=/etc/telemetrics/opt-in [Service] ExecStart=@bindir@/hprobe -Hlu diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/hprobe.timer new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/hprobe.timer --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/hprobe.timer 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/hprobe.timer 2019-12-18 03:39:20.000000000 +0100 @@ -1,6 +1,6 @@ [Unit] Description=Daily Heartbeat for Telemetrics -ConditionPathExists=!/etc/telemetrics/opt-out +ConditionPathExists=/etc/telemetrics/opt-in [Timer] OnCalendar=daily diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/journal-probe-tail.service.in new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/journal-probe-tail.service.in --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/journal-probe-tail.service.in 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/journal-probe-tail.service.in 2019-12-18 03:39:20.000000000 +0100 @@ -2,7 +2,7 @@ Description=Telemetrics Systemd Journal Probe Requires=telemprobd.socket After=telemprobd.socket -ConditionPathExists=!/etc/telemetrics/opt-out +ConditionPathExists=/etc/telemetrics/opt-in [Service] ExecStart=@bindir@/journalprobe -t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/journal-probe.service.in new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/journal-probe.service.in --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/journal-probe.service.in 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/journal-probe.service.in 2019-12-18 03:39:20.000000000 +0100 @@ -2,7 +2,7 @@ Description=Telemetrics Systemd Journal Probe Requires=telemprobd.socket After=telemprobd.socket -ConditionPathExists=!/etc/telemetrics/opt-out +ConditionPathExists=/etc/telemetrics/opt-in [Service] ExecStart=@bindir@/journalprobe diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/local.mk new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/local.mk --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/local.mk 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/local.mk 2019-12-18 03:39:20.000000000 +0100 @@ -16,7 +16,6 @@ %D%/example.2.conf \ %D%/hprobe.service.in \ %D%/hprobe.timer \ - %D%/bert-probe.service.in \ %D%/journal-probe.service.in \ %D%/journal-probe-tail.service.in \ %D%/pstore-probe.service.in \ @@ -53,7 +52,6 @@ systemdunit_DATA = \ %D%/hprobe.service \ %D%/hprobe.timer \ - %D%/bert-probe.service \ %D%/journal-probe.service \ %D%/journal-probe-tail.service \ %D%/pstore-probe.service \ @@ -68,9 +66,6 @@ %D%/hprobe.service: %D%/hprobe.service.in $(pathfix) < $< > $@ -%D%/bert-probe.service: %D%/bert-probe.service.in - $(pathfix) < $< > $@ - %D%/journal-probe.service: %D%/journal-probe.service.in $(pathfix) < $< > $@ @@ -126,5 +121,4 @@ %D%/klogscanner.service \ %D%/pstore-clean.service \ %D%/hprobe.service \ - %D%/bert-probe.service \ %D%/.dirstamp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/pstore-probe.service.in new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/pstore-probe.service.in --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/pstore-probe.service.in 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/pstore-probe.service.in 2019-12-18 03:39:20.000000000 +0100 @@ -2,6 +2,7 @@ Description=Telemetrics Pstore Probe Requires=telemprobd.socket After=telemprobd.socket +ConditionPathExists=/etc/telemetrics/opt-in [Service] ExecStart=@bindir@/pstoreprobe diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/telempostd.path.in new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/telempostd.path.in --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/telempostd.path.in 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/telempostd.path.in 2019-12-18 03:39:20.000000000 +0100 @@ -1,6 +1,6 @@ [Unit] Description=Telemetry Post Daemon staging -ConditionPathExists=!/etc/telemetrics/opt-out +ConditionPathExists=/etc/telemetrics/opt-in [Path] DirectoryNotEmpty=@localstatedir@/spool/telemetry diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/telempostd.service.in new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/telempostd.service.in --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/telempostd.service.in 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/telempostd.service.in 2019-12-18 03:39:20.000000000 +0100 @@ -1,6 +1,6 @@ [Unit] Description=Telemetrics Post Daemon -ConditionPathExists=!/etc/telemetrics/opt-out +ConditionPathExists=/etc/telemetrics/opt-in [Service] ExecStart=@bindir@/telempostd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/telemprobd.service.in new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/telemprobd.service.in --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/telemprobd.service.in 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/telemprobd.service.in 2019-12-18 03:39:20.000000000 +0100 @@ -1,6 +1,6 @@ [Unit] Description=Telemetrics Daemon -ConditionPathExists=!/etc/telemetrics/opt-out +ConditionPathExists=/etc/telemetrics/opt-in [Service] ExecStart=@bindir@/telemprobd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/telemprobd.socket.in new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/telemprobd.socket.in --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/data/telemprobd.socket.in 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/telemprobd.socket.in 2019-12-18 03:39:20.000000000 +0100 @@ -1,6 +1,6 @@ [Unit] Description=Telemetrics Daemon -ConditionPathExists=!/etc/telemetrics/opt-out +ConditionPathExists=/etc/telemetrics/opt-in [Socket] ListenStream=@SOCKETDIR@/telem-0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/local.mk new/telemetrics-client-2.3.2+git20191217.8ca2993/src/local.mk --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/local.mk 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/local.mk 2019-12-18 03:39:20.000000000 +0100 @@ -90,8 +90,8 @@ # set library version info SHAREDLIB_CURRENT=4 -SHAREDLIB_REVISION=0 -SHAREDLIB_AGE=1 +SHAREDLIB_REVISION=1 +SHAREDLIB_AGE=0 noinst_LTLIBRARIES = %D%/libtelem-shared.la @@ -101,7 +101,6 @@ %D%/configuration.c \ %D%/nica/inifile.c \ %D%/nica/hashmap.c \ - %D%/nica/b64enc.c \ %D%/configuration.h \ %D%/common.c \ %D%/common.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/nica/b64enc.c new/telemetrics-client-2.3.2+git20191217.8ca2993/src/nica/b64enc.c --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/nica/b64enc.c 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/nica/b64enc.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,154 +0,0 @@ -/* - * This file is part of libnica. - * - * Copyright © 2017 Intel Corporation - * - * libnica is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. - */ - -#define _GNU_SOURCE - -#include <stdio.h> -#include <stdint.h> -#include "b64enc.h" - -#define B64_LINE_LEN 76 - -static int padding[] = {0, 2, 1, 0}; -static char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - - -/* - * base 64 encoding of 3 bytes to 4 printable characters - * (https://tools.ietf.org/html/rfc4648). - * - * i.e. (Reference: https://en.wikipedia.org/wiki/Base64) - * - * [ M ] [ a ] [ n ] - * bin 01001101 01100001 01101110 - * - * b64 01001101 01100001 01101110 >> 18 & 0x3F -> 010011 -> ( 19 dec) T - * ------ - * - * b64 01001101 01100001 01101110 >> 12 & 0x3F -> 010110 -> ( 22 dec) W - * ------- - * - * b64 01001101 01100001 01101110 >> 6 & 0x3F -> 000101 -> ( 5 dec) F - * ------- - * - * b64 01001101 01100001 01101110 >> 0 & 0x3F -> 101110 -> (117 dec) u - * ------ - * - */ -static void b64_3b(char bin[3], char *out) { - - uint32_t x = (((uint32_t) bin[0] << 16) & 0xFF0000) | - (((uint32_t) bin[1] << 8) & 0xFF00) | - (((uint32_t) bin[2]) & 0xFF); - - out[3] = table[x & 0x3F]; - out[2] = table[x >> 6 & 0x3F]; - out[1] = table[x >> 12 & 0x3F]; - out[0] = table[x >> 18 & 0x3F]; - -} - - -/* - * Provide padding to already initialized b64 output - */ -static void b64_padding(char *out, int pad_size) { - - if (pad_size > 0) { - *out++ = '='; - } - - if (pad_size > 1) { - *out++ = '='; - } - - *out = '\0'; -} - - -/* - * Encode file contents as b64 string - */ -int nc_b64enc_file(FILE *fh, char *buff, size_t buff_size) { - - int ret_val = 1; - int out_count = 0; - int pad_size = 0; - char *buff_ptr = buff; - char bin[3] = {0, 0, 0}; - size_t len = 0; - - while ((len = fread(bin, 1, 3, fh)) > 0) { - b64_3b(bin, buff_ptr); - /* - Reset 2nd and 3rd bytes in case only one byte was read. If these - bytes are not clean b64 output will be corrupted with old bits. - */ - bin[1] = bin[2] = 0; - /* - Advance pointer to the next free position of the b64 encoded - buffer. This happens to be len + 1 (as longs as len >= 1 and len <= 3) - - len = 1 byte -> b64 -> 2 bytes (or len + 1) - len = 2 bytes -> b64 -> 3 bytes (or len + 1) - len = 3 bytes -> b64 -> 4 bytes (or len + 1) - */ - buff_ptr += (len + 1); - /* - Line break every 76 characters - */ - out_count += (int) (len + 1); - if (out_count % B64_LINE_LEN == 0) { - *buff_ptr++ = '\n'; - } - pad_size = padding[len]; - /* - Check not to overflow buffer - - buffer size <= b64 characters + padding length + null termination - */ - if (buff_size <= (size_t) (buff_ptr - buff) + (size_t) pad_size + 1) { - ret_val = 0; - goto end_b64_enc; - } - } - - b64_padding(buff_ptr, pad_size); - -end_b64_enc: - - return ret_val; -} - - -int nc_b64enc_filename(const char *filename, char *buff, size_t buff_size) { - - int ret = 0; - FILE *fh = NULL; - - fh = fopen(filename, "rb"); - - if (fh == NULL) { - goto nc_b64_clean; - } - - ret = nc_b64enc_file(fh, buff, buff_size); - -nc_b64_clean: - - if (fh) { - fclose(fh); - } - - return ret; -} - -/* vi: set ts=8 sw=8 sts=4 et tw=80 cino=(0: */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/nica/b64enc.h new/telemetrics-client-2.3.2+git20191217.8ca2993/src/nica/b64enc.h --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/nica/b64enc.h 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/nica/b64enc.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,42 +0,0 @@ -/* - * This file is part of libnica. - * - * Copyright © 2017 Intel Corporation - * - * libnica is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. - * - * This is a chained base64 encode implementation. - */ - -#pragma once - -#define _GNU_SOURCE - -#include "macros.h" - -/* - * Encodes contents of file handler in base64 - * - * @param fh File handler to encode as base64 - * @param buff Output buffer where the base64 output should be written - * @param buff_size Size of the output buffer - * - * @returns 1 in success and 0 in failure - */ -_nica_public_ int nc_b64enc_file(FILE *fh, char *buff, size_t buff_size); - - -/* - * Encodes contents of file (filename) in base64 - * - * @param filename File to encode as base64 - * @param buff Output buffer where the base64 output should be written - * @param buff_size Size of the output buffer - * - * @returns 1 in success and 0 in failure - */ -_nica_public_ int nc_b64enc_filename(const char *filename, char *buff, size_t buff_size); - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/probes/README.md new/telemetrics-client-2.3.2+git20191217.8ca2993/src/probes/README.md --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/probes/README.md 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/probes/README.md 2019-12-18 03:39:20.000000000 +0100 @@ -2,9 +2,6 @@ The default probes provided along the telemetry client code are: -* bertprobe: this probe reports on the Boot Error Region Table if such - entry is found in ```/sys/firmware/acpi/tables/BERT```. - * crashprobe: This probe processes core dump files. It can be registered as the kernel core file handler in /proc/sys/kernel/core_pattern. @@ -15,7 +12,7 @@ from failed services. * klogscanner: a probe to collect 'oops messages' when the kernel detects a - problem. + problem. Also reports errors in the Boot Error Region Table if detected. * pstoreprobe: probe to collect messages left on pstore filesystem. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/probes/bert_probe.c new/telemetrics-client-2.3.2+git20191217.8ca2993/src/probes/bert_probe.c --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/probes/bert_probe.c 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/probes/bert_probe.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,117 +0,0 @@ -/* - * This program is part of the Clear Linux Project - * - * Copyright 2018 Intel Corporation - * - * This program is free software; you can redistribute it and/or modify it under - * the terms and conditions of the GNU Lesser General Public License, as - * published by the Free Software Foundation; either version 2.1 of the License, - * or (at your option) any later version. - * - * This program is distributed in the hope it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more - * details. - */ - -#define _GNU_SOURCE -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <sys/stat.h> -#include <getopt.h> -#include "common.h" -#include "telemetry.h" -#include "nica/b64enc.h" - -#include "config.h" -#include "log.h" - -static const char bert_record_file[] = "/sys/firmware/acpi/tables/data/BERT"; -static const char telem_record_class[] = "org.clearlinux/bert/debug"; -static uint32_t severity = 2; -static uint32_t payload_version = 1; - -void print_usage(char *prog) -{ - printf("%s: Usage\n", prog); - printf(" -f, --config_file Specify a configuration file other than default\n"); - printf(" -h, --help Display this help message\n"); - printf(" -V, --version Print the program version\n"); -} - -int main(int argc, char **argv) -{ - struct telem_ref *tm_handle = NULL; - char *classification = (char *)telem_record_class; - char *payload; - int ret; - - // Following vars are for arg parsing. - int c; - int opt_index = 0; - struct option opts[] = { - { "config_file", 1, NULL, 'f' }, - { "help", 0, NULL, 'h' }, - { "version", 0, NULL, 'V' }, - { NULL, 0, NULL, 0 } - }; - - while ((c = getopt_long(argc, argv, "f:hV", opts, &opt_index)) != -1) { - switch (c) { - case 'f': - if (tm_set_config_file(optarg) != 0) { - telem_log(LOG_ERR, "Configuration file" - " path not valid\n"); - exit(EXIT_FAILURE); - } - break; - case 'h': - print_usage(argv[0]); - exit(EXIT_SUCCESS); - case 'V': - printf(PACKAGE_VERSION "\n"); - exit(EXIT_SUCCESS); - case '?': - exit(EXIT_FAILURE); - } - } - - payload = calloc(sizeof(char), MAX_PAYLOAD_LENGTH); - if (!payload) { - printf("Unable to allocate more memory.\n"); - return -ENOMEM; - } - - if (!(ret = nc_b64enc_filename(bert_record_file, payload, MAX_PAYLOAD_LENGTH))) { - printf("Failed to read payload from: %s\n", bert_record_file); - ret = EXIT_FAILURE; - goto done; - } - - if ((ret = tm_create_record(&tm_handle, severity, classification, - payload_version)) < 0) { - printf("Failed to create record: %s\n", strerror(-ret)); - goto done; - } - - if ((ret = tm_set_payload(tm_handle, payload)) < 0) { - printf("Failed to set record payload: %s\n", strerror(-ret)); - goto done; - } - - if ((ret = tm_send_record(tm_handle)) < 0) { - printf("Failed to send record to daemon: %s\n", strerror(-ret)); - goto done; - } - - ret = EXIT_SUCCESS; -done: - free(payload); - tm_free_record(tm_handle); - tm_handle = NULL; - - return ret; -} - -/* vi: set ts=8 sw=8 sts=4 et tw=80 cino=(0: */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/probes/klog_scanner.c new/telemetrics-client-2.3.2+git20191217.8ca2993/src/probes/klog_scanner.c --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/probes/klog_scanner.c 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/probes/klog_scanner.c 2019-12-18 03:39:20.000000000 +0100 @@ -23,6 +23,7 @@ #include <unistd.h> #include <sys/stat.h> +#include "common.h" #include "log.h" #include "oops_parser.h" #include "klog_scanner.h" @@ -44,6 +45,11 @@ return false; } + /* Truncate payload if necessary, otherwise nothing will be sent */ + if (strlen(backtrace) > MAX_PAYLOAD_LENGTH) { + backtrace[MAX_PAYLOAD_LENGTH-1] = 0; + } + if ((ret = tm_set_payload(handle, backtrace)) < 0) { telem_log(LOG_ERR, "Failed to set payload: %s", strerror(-ret)); tm_free_record(handle); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/probes/local.mk new/telemetrics-client-2.3.2+git20191217.8ca2993/src/probes/local.mk --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/probes/local.mk 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/probes/local.mk 2019-12-18 03:39:20.000000000 +0100 @@ -4,8 +4,7 @@ %D%/telem-record-gen \ %D%/klogscanner \ %D%/pstoreprobe \ - %D%/pstoreclean \ - %D%/bertprobe + %D%/pstoreclean %C%_hprobe_SOURCES = %D%/hello.c %C%_hprobe_LDADD = $(top_builddir)/src/libtelemetry.la @@ -21,21 +20,6 @@ endif endif -%C%_bertprobe_SOURCES = %D%/bert_probe.c \ - src/nica/b64enc.c -%C%_bertprobe_CFLAGS = $(AM_CFLAGS) -%C%_bertprobe_LDADD = $(top_builddir)/src/libtelemetry.la -%C%_bertprobe_LDFLAGS = \ - $(AM_LDFLAGS) \ - -pie - -if LOG_SYSTEMD -if HAVE_SYSTEMD_JOURNAL -%C%_bertprobe_CFLAGS += $(SYSTEMD_JOURNAL_CFLAGS) -%C%_bertprobe_LDADD += $(SYSTEMD_JOURNAL_LIBS) -endif -endif - %C%_telem_record_gen_SOURCES = %D%/telem_record_gen.c %C%_telem_record_gen_CFLAGS = \ $(AM_CFLAGS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/probes/oops_parser.c new/telemetrics-client-2.3.2+git20191217.8ca2993/src/probes/oops_parser.c --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/probes/oops_parser.c 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/probes/oops_parser.c 2019-12-18 03:39:20.000000000 +0100 @@ -162,6 +162,12 @@ TM_CRITICAL, false, }, + { + "BERT: Error records from previous boot:", + "org.clearlinux/bert/debug", + TM_MEDIUM, + false, + }, }; static int oops_patterns_cnt = sizeof(oops_patterns_arr) / sizeof(struct oops_pattern); @@ -334,6 +340,7 @@ static struct oops_log_msg oops_msg; static bool in_stack_dump = false; +static bool in_bert_dump = false; static oops_handler_t oops_handler; @@ -357,6 +364,19 @@ free_pattern_regex(); } +/* + * +[ 1.609112] BERT: Error records from previous boot: +[ 1.609113] [Hardware Error]: event severity: fatal +[ 1.609115] [Hardware Error]: Error 0, type: fatal +[ 1.609116] [Hardware Error]: section type: unknown, 81212a96-09ed-4996-9471-8d729c8e69ed +[ 1.609117] [Hardware Error]: section length: 0xc10 +[ 1.609119] [Hardware Error]: 00000000: 00000001 00000000 00000000 01001002 ................ +[ 1.609120] [Hardware Error]: 00000010: 01001002 00000001 c71f0d2f 00000003 ......../....... +[ 1.609122] [Hardware Error]: 00000020: 00000001 0000004f 0c070048 800001ff ....O...H....... +[ 1.609123] [Hardware Error]: 00000030: 02002080 7e15fe03 00000001 00000000 . .....~...... + ... + */ void parse_single_line(char *line, size_t size) { char *start; @@ -376,28 +396,30 @@ continue; } telem_log(LOG_DEBUG, "Oops start has been detected\n"); - oops_msg.pattern = pattern; oops_msg.lines[oops_msg.length] = strndup(start, (size_t)(line_end - start)); if (oops_msg.lines[oops_msg.length] == NULL) { //telem_perror("Failed to copy string"); exit(EXIT_FAILURE); return; - } else { - oops_msg.length++; } + + oops_msg.length++; in_stack_dump = false; - break; + in_bert_dump = false; + if (strstr(oops_msg.pattern->begin_line, "BERT:")) { + in_bert_dump = true; + } + return; } } else { // If in the middle of oops if (oops_msg.length >= MAX_LINES) { + fprintf(stderr,"*** MAX_LINES!!\n"); end_found = true; - // } else if (oops_msg.end_line && strstr(start, oops_msg.end_line)) { - // end_found = false; } else if (strstr(start, "[ end trace")) { end_found = true; - } else if (!in_stack_dump) { + } else if (!in_stack_dump && !in_bert_dump) { // This line indicates the beginning of a stack trace; // the next line is most likely the topmost frame. if (starts_with(start, line_end, "Call Trace:")) { @@ -414,6 +436,10 @@ in_stack_dump = false; end_found = true; } + } else if (in_bert_dump) { + if (!strstr(start, "[Hardware Error]:")) { + end_found = true; + } } /* if a new oops starts, this one has ended */ @@ -847,15 +873,28 @@ return backtrace; } +static void append_payload(nc_string *payload, struct oops_log_msg *msg) +{ + for (int i = 1; i < msg->length; i++) { + nc_string_cat(payload,msg->lines[i]); + nc_string_cat(payload,"\n"); + } +} + nc_string *parse_payload(struct oops_log_msg *msg) { nc_string *payload, *backtrace; payload = nc_string_dup("Crash Report:\n"); nc_string_append_printf(payload, "Reason: %s\n", msg->lines[0]); - backtrace = parse_backtrace(msg); - nc_string_cat(payload, backtrace->str); - nc_string_free(backtrace); + if (strstr(msg->lines[0], "BERT:")) { + append_payload(payload, msg); + } else { + backtrace = parse_backtrace(msg); + nc_string_cat(payload, backtrace->str); + nc_string_free(backtrace); + } + return payload; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/telemctl.c new/telemetrics-client-2.3.2+git20191217.8ca2993/src/telemctl.c --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/telemctl.c 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/telemctl.c 2019-12-18 03:39:20.000000000 +0100 @@ -31,7 +31,7 @@ #include <errno.h> #define TELEM_DIR "/etc/telemetrics" -#define TM_OPT_OUT TELEM_DIR"/opt-out" +#define TM_OPT_IN TELEM_DIR"/opt-in" #define TELEM_WRK_DIRS_CONF "/usr/lib/tmpfiles.d/telemetrics-dirs.conf" @@ -69,6 +69,7 @@ static int telemctl_journal(char *); struct telemcmd { + bool root; char *cmd; union { int (*f1)(void); @@ -78,13 +79,13 @@ }; static struct telemcmd commands[] = { - {"stop", {.f1=telemctl_stop}, "Stops all running telemetry services" }, - {"start", {.f1=telemctl_start}, "Starts all telemetry services" }, - {"restart", {.f1=telemctl_restart}, "Restarts all telemetry services" }, - {"is-active", {.f1=telemctl_is_active},"Checks if telemprobd and telempostd are active" }, - {"opt-in", {.f1=telemctl_opt_in}, "Opts in to telemetry, and starts telemetry services" }, - {"opt-out", {.f1=telemctl_opt_out}, "Opts out of telemetry, and stops telemetry services" }, - {"journal", {.f2=telemctl_journal}, "Prints telemetry journal contents. Use -h argument with\n command for more options"} + {true, "stop", {.f1=telemctl_stop}, "Stops all running telemetry services" }, + {true, "start", {.f1=telemctl_start}, "Starts all telemetry services" }, + {true, "restart", {.f1=telemctl_restart}, "Restarts all telemetry services" }, + {false, "is-active", {.f1=telemctl_is_active},"Checks if telemprobd and telempostd are active" }, + {true, "opt-in", {.f1=telemctl_opt_in}, "Opts in to telemetry, and starts telemetry services" }, + {true, "opt-out", {.f1=telemctl_opt_out}, "Opts out of telemetry, and stops telemetry services" }, + {true, "journal", {.f2=telemctl_journal}, "Prints telemetry journal contents. Use -h argument with\n command for more options"} }; static int syscmd(char *cmd, char *buff, int bufflen) @@ -151,14 +152,16 @@ create_work_dirs for_each_service "start" ${SPECIAL_UNITS[@]} } + +Modified to add explicit opt-in */ static int telemctl_start(void) { char buff[512]; int status, ret; - if (access(TM_OPT_OUT, F_OK) == 0) { - fprintf(stderr, "Opt out is enabled. Cannot start services.\n"); + if (access(TM_OPT_IN, F_OK) != 0) { + fprintf(stderr, "Opt in to telemetry first.\n"); return 1; } @@ -386,28 +389,21 @@ */ static int telemctl_opt_out(void) { - /* Ensure TELEM_DIR exists */ - if (mk_telem_dir() != 0) { - fprintf(stderr, "Failed to create %s\n", TELEM_DIR); - return 1; - } + int ret; - /* Create a brand new file TM_OPT_OUT, we mai fail because the file exists already. - * In that case we are already opted out and we are done here. */ - int fd = open(TM_OPT_OUT, O_CREAT|O_EXCL|O_WRONLY, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); - if (fd == -1) { - if (errno == EEXIST) { + /* Remove TM_OPT_IN file */ + if (unlink(TM_OPT_IN) != 0) { + if (errno == ENOENT) { fprintf(stderr, "Already opted out. Nothing to do.\n"); return 0; - } else { - fprintf(stderr, "Failed to create %s.\n", TM_OPT_OUT); - return 1; } - } else { - telemctl_stop(); - close(fd); - return telemctl_remove_work_dirs(); + fprintf(stderr, "Failed to remove %s.\n", TM_OPT_IN); + return 1; } + + ret = telemctl_stop(); + ret |= telemctl_remove_work_dirs(); + return ret; } /* @@ -418,20 +414,33 @@ rm -f $OPT_OUT_FILE || exit_err "Failed to remove ${OPT_OUT_FILE}." telem_start } + +Modified to add explicit opt-in */ static int telemctl_opt_in(void) { - /* Delete the TM_OPT_OUT file */ - if (unlink(TM_OPT_OUT) == -1) { - if (errno == ENOENT) { + + /* Ensure TELEM_DIR exists */ + if (mk_telem_dir() != 0) { + fprintf(stderr, "Failed to create %s\n", TELEM_DIR); + return 1; + } + + /* Create a brand new file TM_OPT_IN, we may fail because the file exists already. + * In that case we are already opted in and we are done here. */ + int fd = open(TM_OPT_IN, O_CREAT|O_EXCL|O_WRONLY, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); + if (fd == -1) { + if (errno == EEXIST) { fprintf(stderr, "Already opted in. Nothing to do.\n"); return 0; + } else { + fprintf(stderr, "Failed to create %s.\n", TM_OPT_IN); + return 1; } - fprintf(stderr, "Failed to remove %s.\n", TM_OPT_OUT); - return 1; } + close(fd); - return telemctl_start(); + return 0; } @@ -513,7 +522,7 @@ for (i = 0; i < sizeof(commands)/sizeof(commands[0]); i++) { if (strcmp(commands[i].cmd, argv[1]) == 0) { - if (!is_root) { + if (commands[i].root == true && is_root == false) { fprintf(stderr, "Must be root to run this command. Exiting...\n"); exit(1); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/telemetry.c new/telemetrics-client-2.3.2+git20191217.8ca2993/src/telemetry.c --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/telemetry.c 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/telemetry.c 2019-12-18 03:39:20.000000000 +0100 @@ -1199,6 +1199,17 @@ return ret; } +int tm_is_opted_in(void) +{ + struct stat unused; + + if (stat(TM_OPT_IN_FILE, &unused) == -1) { + return 0; + } + + return 1; +} + int tm_send_record(struct telem_ref *t_ref) { int i; @@ -1208,14 +1219,11 @@ char *data = NULL; size_t offset = 0; int ret = 0; - int k = 0; - struct stat unused; size_t cfg_file_name_size = 0; const char *cfg_file_name = NULL; - k = stat(TM_OPT_OUT_FILE, &unused); - if (k == 0) { - // Bail early if opt-out is enabled + if (tm_is_opted_in() == 0) { + // Bail early if opt-in is not existent return -ECONNREFUSED; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/telemetry.h new/telemetrics-client-2.3.2+git20191217.8ca2993/src/telemetry.h --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/telemetry.h 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/telemetry.h 2019-12-18 03:39:20.000000000 +0100 @@ -121,6 +121,13 @@ int tm_send_record(struct telem_ref *t_ref); /** + * Checks if telemetry was opted in + * + * @return 1 when opt-in, or 0 when opt-out + */ +int tm_is_opted_in(void); + +/** * Release the memory allocated to a telemetrics record. * * @param t_ref A handle created by a call to diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/src/telemetry.sym new/telemetrics-client-2.3.2+git20191217.8ca2993/src/telemetry.sym --- old/telemetrics-client-2.2.3+git20191008.4119bde/src/telemetry.sym 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/src/telemetry.sym 2019-12-18 03:39:20.000000000 +0100 @@ -21,3 +21,8 @@ global: tm_set_event_id; } TM_3_0_0; + +TM_4_1_0 { + global: + tm_is_opted_in; +} TM_4_0_0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/tests/check_libtelemetry.c new/telemetrics-client-2.3.2+git20191217.8ca2993/tests/check_libtelemetry.c --- old/telemetrics-client-2.2.3+git20191008.4119bde/tests/check_libtelemetry.c 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/tests/check_libtelemetry.c 2019-12-18 03:39:20.000000000 +0100 @@ -41,7 +41,7 @@ * with the libcheck API... */ ck_assert_msg(ret != -ECONNREFUSED, - "Opt-out enabled. Opt in to run these tests"); + "First time opt-in required to run test"); } START_TEST(record_create_non_null) @@ -98,12 +98,22 @@ } } +START_TEST(is_opt_in) +{ + int ret; + ret = tm_is_opted_in(); + /* Smoke testing function */ + ck_assert_msg(ret == 0 || ret == 1, + "Something wrong with opt-in check"); +} +END_TEST + START_TEST(record_create_invalid_class1) { int ret; ret = tm_create_record(&ref, 1, "t/t", 2000); ck_assert_msg(ret != -ECONNREFUSED, - "Opt-out enabled. Opt in to run this test"); + "First time opt-in required to run test"); ck_assert(ret == -EINVAL); } END_TEST @@ -113,7 +123,7 @@ int ret; ret = tm_create_record(&ref, 1, "t/t/t/t", 2000); ck_assert_msg(ret != -ECONNREFUSED, - "Opt-out enabled. Opt in to run this test"); + "First time opt-in required to run test"); ck_assert(ret == -EINVAL); } END_TEST @@ -126,7 +136,7 @@ // Severity of 0 is too low; raise it to 1, the minimum ret = tm_create_record(&ref, 0, "a/a/a", 2000); ck_assert_msg(ret != -ECONNREFUSED, - "Opt-out enabled. Opt in to run this test"); + "First time opt-in required to run test"); if (asprintf(&result, "%s: %u\n", TM_SEVERITY_STR, 1) < 0) { return; @@ -146,7 +156,7 @@ // Severity of 5 is too high; lower it to 4, the maximum ret = tm_create_record(&ref, 5, "b/b/b", 2000); ck_assert_msg(ret != -ECONNREFUSED, - "Opt-out enabled. Opt in to run this test"); + "First time opt-in required to run test"); if (asprintf(&result, "%s: %u\n", TM_SEVERITY_STR, 4) < 0) { return; @@ -172,7 +182,7 @@ return; } ck_assert_msg(ret != -ECONNREFUSED, - "Opt-out enabled. Opt in to run this test"); + "First time opt-in required to run test"); } START_TEST(record_set_event_id) @@ -252,6 +262,10 @@ tcase_add_test(t, record_create_version); suite_add_tcase(s, t); + t = tcase_create("Opt-in"); + tcase_add_test(t, is_opt_in); + suite_add_tcase(s, t); + t = tcase_create("invalid classification"); tcase_add_test(t, record_create_invalid_class1); tcase_add_test(t, record_create_invalid_class2); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/tests/check_ncb64.c new/telemetrics-client-2.3.2+git20191217.8ca2993/tests/check_ncb64.c --- old/telemetrics-client-2.2.3+git20191008.4119bde/tests/check_ncb64.c 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/tests/check_ncb64.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,192 +0,0 @@ -/* - * This program is part of the Clear Linux Project - * - * Copyright 2017 Intel Corporation - * - * This program is free software; you can redistribute it and/or modify it under - * the terms and conditions of the GNU Lesser General Public License, as - * published by the Free Software Foundation; either version 2.1 of the License, - * or (at your option) any later version. - * - * This program is distributed in the hope it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more - * details. - */ - -#define OUT_MAX_LEN 100 - -#include <stdio.h> -#include <check.h> -#include "nica/b64enc.h" - -START_TEST(check_nc_b64_no_overflow) -{ - size_t n = 2; - char out[OUT_MAX_LEN]; - const char *filename = TOPSRCDIR "/tests/nc_b64enc_test_files/foobar"; - - ck_assert_msg(!nc_b64enc_filename(filename, &out[0], n), "Should quit since buffer smaller than content"); -} -END_TEST - -START_TEST(check_nc_b64_enc_n_file_empty) -{ - size_t n = OUT_MAX_LEN; - char out[OUT_MAX_LEN]; - char *result = "\0"; - const char *filename = TOPSRCDIR "/tests/nc_b64enc_test_files/empty"; - - ck_assert_msg(nc_b64enc_filename(filename, &out[0], n), "Error opening file"); - ck_assert_str_eq(out, result); -} -END_TEST - -START_TEST(check_nc_b64_enc_n_file_fo) -{ - size_t n = OUT_MAX_LEN; - char out[OUT_MAX_LEN]; - char *result = "Zm8="; - const char *filename = TOPSRCDIR "/tests/nc_b64enc_test_files/fo"; - - ck_assert_msg(nc_b64enc_filename(filename, &out[0], n), "Error opening file"); - ck_assert_str_eq(out, result); -} -END_TEST - -START_TEST(check_nc_b64_enc_n_file_foob) -{ - size_t n = OUT_MAX_LEN; - char out[OUT_MAX_LEN]; - char *result = "Zm9vYg=="; - const char *filename = TOPSRCDIR "/tests/nc_b64enc_test_files/foob"; - - ck_assert_msg(nc_b64enc_filename(filename, &out[0], n), "Error opening file"); - ck_assert_str_eq(out, result); -} -END_TEST - -START_TEST(check_nc_b64_enc_n_file_foobar) -{ - size_t n = OUT_MAX_LEN; - char out[OUT_MAX_LEN]; - char *result = "Zm9vYmFyZm9vYmFy"; - const char *filename = TOPSRCDIR "/tests/nc_b64enc_test_files/foobar"; - - ck_assert_msg(nc_b64enc_filename(filename, &out[0], n), "Error opening file"); - ck_assert_str_eq(out, result); -} -END_TEST - -START_TEST(check_nc_b64_enc_n_file_long_text) -{ - size_t out_len = 8000; - char out[out_len]; - const char *expected_out = \ - "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIG5vbnVtbXkgdml0YWUsIGluIHZpdmFtdXMgc3Vz\n" - "cGVuZGlzc2UgYWMuIFNlbXBlciBzZWQgcGhhcmV0cmEgc2NlbGVyaXNxdWUuIEVnZXQgZWxlaWZl\n" - "bmQgYW1ldCB2ZWwgbnVuYyB2b2x1dHBhdCBjdXJzdXMsIGF1Y3RvciBwbGF0ZWEgcHJldGl1bSwg\n" - "bWF0dGlzIHJpc3VzIGZhY2lsaXNpcyBmYXVjaWJ1cywgc3VzcGVuZGlzc2UgZGlhbSwgbGVjdHVz\n" - "IG1ldHVzIG51bGxhLiBOdW5jIGp1c3RvIGZhY2lsaXNpIG5hbSBmZWxpcyB2ZWwgbGFvcmVldCwg\n" - "bmliaCBsZW8gbWFzc2Egc3VzcGVuZGlzc2UgYWNjdW1zYW4gY29udmFsbGlzLCBzZWQgcXVpcyBw\n" - "ZWxsZW50ZXNxdWUgZWdlc3RhcywgbG9yZW0gYW50ZSBtb3JiaSBtYXR0aXMgdml0YWUuIFByYWVz\n" - "ZW50IGluIHJ1dHJ1bSBlZ2V0IGFjLCB2aXZhbXVzIHBlZGUgc3VzcGVuZGlzc2UgbGVjdHVzIG51\n" - "bGxhbSwgZXQgcGVkZSBldSBvZGlvIHBlZGUsIGV0aWFtIGxlbyBlZ2VzdGFzIGluLCBub251bW15\n" - "IHNlbXBlci4gQSBhY2N1bXNhbiBkdWksIHZlc3RpYnVsdW0gcmlkaWN1bHVzIGV0IGluLCBqdXN0\n" - "byBldCBwbGFjZXJhdCBkdWlzIHV0IHZpdmFtdXMgbGliZXJvLiBWZXN0aWJ1bHVtIGVnZXQgdXQg\n" - "bW9sbGlzLCBudW5jIGEgc29sbGljaXR1ZGluLCBmcmluZ2lsbGEgZXJvcyBwb3N1ZXJlIG1vbGxp\n" - "cyBhYyBuYXRvcXVlIHBlZGUsIHJpc3VzIG51bGxhIHJ1dHJ1bSB0dXJwaXMgYSB2aXRhZSBpZC4g\n" - "SW5jZXB0b3MgdGluY2lkdW50IHF1aWRlbSBhcmN1IHR1cnBpcyBudW5jIHNvbGxpY2l0dWRpbi4g\n" - "UGhhc2VsbHVzIG1ldHVzIGVyYXQgcGxhY2VyYXQsIGluIGVyYXQgbG9yZW0gbWF1cmlzIG51bGxh\n" - "LCBhdCBsaWJlcm8gZXJhdCBzdXNwZW5kaXNzZSBzYXBpZW4gbW9udGVzIHJob25jdXMsIG1hZ25h\n" - "IHF1YW0uIEp1c3RvIHByYWVzZW50IGxhY3VzIG1hc3NhLCByZXByZWhlbmRlcml0IG51bmMsIHJp\n" - "c3VzIGRpZ25pc3NpbSBmZWxpcyBub24sIGRpZ25pc3NpbSBvZGlvIHRlbGx1cyBhbGlxdWFtLCBl\n" - "bmltIHNvZGFsZXMgdGVtcG9yIHF1aXNxdWUgc29kYWxlcyBtYWduaXMgcG9ydHRpdG9yLiBMaWd1\n" - "bGEgc2VkIHJpc3VzLCBldSBlc3QgcXVpc3F1ZSwgY2xhc3Mgbm9uIGF1dGUgZXUsIHBsYXRlYSBz\n" - "Y2VsZXJpc3F1ZSBpZCBpbnRlZ2VyIGRpZ25pc3NpbW9zIGludGVnZXIgc3VzY2lwaXQuClZlaGlj\n" - "dWxhIGVpdXMgbmVjLCBjb252YWxsaXMgbWFlY2VuYXMgbGVjdHVzIHB1cnVzIHF1aXNxdWUgYWxp\n" - "cXVhbSwgZXQgZXQsIGxhY2luaWEgZGlzIGRpZ25pc3NpbSBsb3JlbS4gVm9sdXB0YXRlbSB1dCwg\n" - "dml2ZXJyYSBhZW5lYW4gcGhhc2VsbHVzIGZlbGlzLCBmZXJtZW50dW0gbGlndWxhIGVnZXQgdWxs\n" - "YW1jb3JwZXIgYW1ldCwgbWF1cmlzIGxlbyBsdWN0dXMuIEV0IGV0aWFtIHNlbXBlciBwaGFyZXRy\n" - "YSBuaWJoIG1pIG1hdXJpcy4gSGVuZHJlcml0IHNlZCBhbGlxdWFtLCBlZ2V0IGlkIHRlbGx1cyBt\n" - "YWduYSwgc2VkIGxhb3JlZXQgdWx0cmljZXMgZW5pbSwgbW9sbGlzIHN1c3BlbmRpc3NlIGluLiBF\n" - "dSBudWxsYW0gbG9yZW0gc2l0IGV0aWFtLCBvcmNpIGluIGxpYmVyby4gTnVuYyBpcHN1bSBtYXVy\n" - "aXMgZXQgc2VtIGhhYy4gRGljdHVtIGZhdWNpYnVzIGRpcyB2aXRhZSBpbiB2b2x1dHBhdCBtb3Ji\n" - "aSwgYSBkaWN0dW0sIHF1aXNxdWUgbWF1cmlzLCBhdWN0b3IgbmVjIHZlbCBwZWxsZW50ZXNxdWUg\n" - "dWxsYW1jb3JwZXIgZXRpYW0uIEN1bSBsaWJlcm8gd2lzaSBhY2N1bXNhbiBhbGlxdWFtIGNvbnNl\n" - "Y3RldHVlciB0ZWxsdXMsIHBoYXNlbGx1cyBjdXJhZSwgYXQgaWxsdW0gYW50ZSBwcmV0aXVtIG5p\n" - "YmggbW9yYmkuIFNlZCBibGFuZGl0IHB1bHZpbmFyIHB1bHZpbmFyLiBEaWN0dW0gZXN0IG51bmMg\n" - "ZWxlaWZlbmQsIHZlbGl0IHZlbGl0IHRlbXBvciBhY2N1bXNhbiBsb2JvcnRpcyBsYW9yZWV0IGNv\n" - "bmd1ZS4gU2l0IGFtZXQsIHNlZCBuaWJoIHBvcnJvIG5lcXVlIGF1Y3RvciBoeW1lbmFlb3MgcG9z\n" - "dWVyZSwgb2RpbyBudWxsYSBibGFuZGl0IGNvbmd1ZSBlbGl0LiBJZCBmYXVjaWJ1cyBldCB0ZW1w\n" - "dXMgbWFsZXN1YWRhIHBsYXRlYS4="; - const char *filename = TOPSRCDIR "/tests/nc_b64enc_test_files/long_text"; - - ck_assert_msg(nc_b64enc_filename(filename, &out[0], out_len), "Error opening file"); - ck_assert_str_eq(out, expected_out); -} -END_TEST - -START_TEST(check_nc_b64_enc_n_filehandler_foobar) -{ - size_t n = OUT_MAX_LEN; - char out[OUT_MAX_LEN]; - char *result = "Zm9vYmFyZm9vYmFy"; - const char *filename = TOPSRCDIR "/tests/nc_b64enc_test_files/foobar"; - FILE *fh = NULL; - - fh = fopen(filename, "rb"); - - if (fh == NULL) { - ck_abort_msg("Unable to open foobar file"); - } - - ck_assert_msg(nc_b64enc_file(fh, &out[0], n), "Result does not match"); - ck_assert_str_eq(out, result); -} -END_TEST - -Suite *config_suite(void) -{ - // A suite is comprised of test cases, defined below - Suite *s = suite_create("nc_b64enc"); - - // Individual unit tests are added to "test cases" - TCase *t = tcase_create("nc_b64enc"); - tcase_add_test(t, check_nc_b64_no_overflow); - tcase_add_test(t, check_nc_b64_enc_n_file_empty); - tcase_add_test(t, check_nc_b64_enc_n_file_fo); - tcase_add_test(t, check_nc_b64_enc_n_file_foob); - tcase_add_test(t, check_nc_b64_enc_n_file_foobar); - tcase_add_test(t, check_nc_b64_enc_n_file_long_text); - tcase_add_test(t, check_nc_b64_enc_n_filehandler_foobar); - - suite_add_tcase(s, t); - - return s; -} - -int main(void) -{ - Suite *s; - SRunner *sr; - - s = config_suite(); - sr = srunner_create(s); - - // Use the TAP driver for now, so that each - // unit test will PASS/FAIL in the log output. - srunner_set_log(sr, NULL); - srunner_set_tap(sr, "-"); - - srunner_run_all(sr, CK_SILENT); - // failed = srunner_ntests_failed(sr); - srunner_free(sr); - - // if you want the TAP driver to report a hard error based - // on certain conditions (e.g. number of failed tests, etc.), - // return non-zero here instead. - return 0; -} - -/* vi: set ts=8 sw=8 sts=4 et tw=80 cino=(0: */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.2.3+git20191008.4119bde/tests/local.mk new/telemetrics-client-2.3.2+git20191217.8ca2993/tests/local.mk --- old/telemetrics-client-2.2.3+git20191008.4119bde/tests/local.mk 2019-10-08 18:53:02.000000000 +0200 +++ new/telemetrics-client-2.3.2+git20191217.8ca2993/tests/local.mk 2019-12-18 03:39:20.000000000 +0100 @@ -15,7 +15,6 @@ %D%/check_probd \ %D%/check_postd \ %D%/check_probes \ - %D%/check_ncb64 \ %D%/check_journal \ %D%/check_libtelemetry @@ -155,25 +154,6 @@ endif endif -%C%_check_ncb64_SOURCES = \ - %D%/check_ncb64.c \ - src/nica/b64enc.h \ - src/nica/b64enc.c - -%C%_check_ncb64_CFLAGS = \ - $(AM_CFLAGS) \ - @CHECK_CFLAGS@ - -%C%_check_ncb64_LDADD = \ - @CHECK_LIBS@ - -EXTRA_DIST += \ - %D%/nc_b64enc_test_files/empty \ - %D%/nc_b64enc_test_files/fo \ - %D%/nc_b64enc_test_files/foob \ - %D%/nc_b64enc_test_files/foobar \ - %D%/nc_b64enc_test_files/long_text - %C%_check_journal_SOURCES = \ %D%/check_journal.c \ src/journal/journal.c \
