Source: linuxtv-dvb-apps
Version: 1.1.1+rev1500-1.2
Severity: important
Tags: patch upstream

linuxtv-dvb-apps fails to build from source with glibc 2.31:

| CC dvbdate
| dvbdate.c: In function ‘set_time’:
| dvbdate.c:312:6: warning: implicit declaration of function ‘stime’; did you 
mean ‘ctime’? [-Wimplicit-function-declaration]
|   312 |  if (stime(new_time)) {
|       |      ^~~~~
|       |      ctime
| /usr/bin/ld: /tmp/cchQDddv.o: in function `set_time':
| ./util/dvbdate/dvbdate.c:312: undefined reference to `stime'
| /usr/bin/ld: ./util/dvbdate/dvbdate.c:312: undefined reference to `stime'
| collect2: error: ld returned 1 exit status
| make[3]: *** [../../Make.rules:82: dvbdate] Error 1
| make[3]: Leaving directory '/<<PKGBUILDDIR>>/util/dvbdate'
| make[2]: *** [Makefile:10: all] Error 2
| make[2]: Leaving directory '/<<PKGBUILDDIR>>/util'
| make[1]: *** [Makefile:14: all] Error 2
| make[1]: Leaving directory '/<<PKGBUILDDIR>>'
| dh_auto_build: error: make -j1 returned exit code 2
| make: *** [debian/rules:4: build] Error 25
| dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2

The full build log is available there:
http://qa-logs.debian.net/2020/06/24/linuxtv-dvb-apps_1.1.1+rev1500-1.2_unstable_glibc-exp.log

The stime function has been marked as obsolete for some time, and since
glibc 2.31 it is no longer available to newly linked binaries. The
clock_settime function should be used instead.

You will find attached a patch fixing that. It would be nice if it can
be fixed relatively soon so that we can start the transition.

Regards,
Aurelien
diff -Nru linuxtv-dvb-apps-1.1.1+rev1500/debian/patches/glibc-stime.patch 
linuxtv-dvb-apps-1.1.1+rev1500/debian/patches/glibc-stime.patch
--- linuxtv-dvb-apps-1.1.1+rev1500/debian/patches/glibc-stime.patch     
1970-01-01 00:00:00.000000000 +0000
+++ linuxtv-dvb-apps-1.1.1+rev1500/debian/patches/glibc-stime.patch     
2020-07-03 20:13:33.000000000 +0000
@@ -0,0 +1,16 @@
+The obsolete function stime is no longer available to newly linked binaries
+since glibc 2.31. Replace it by clock_settime.
+
+--- a/util/dvbdate/dvbdate.c
++++ b/util/dvbdate/dvbdate.c
+@@ -309,7 +309,9 @@ int atsc_scan_date(time_t *rx_time, unsi
+  */
+ int set_time(time_t * new_time)
+ {
+-      if (stime(new_time)) {
++      struct timespec ts = { .tv_sec = new_time };
++
++      if (clock_settime(CLOCK_REALTIME, &ts)) {
+               perror("Unable to set time");
+               return -1;
+       }
diff -Nru linuxtv-dvb-apps-1.1.1+rev1500/debian/patches/series 
linuxtv-dvb-apps-1.1.1+rev1500/debian/patches/series
--- linuxtv-dvb-apps-1.1.1+rev1500/debian/patches/series        2018-01-23 
17:50:35.000000000 +0000
+++ linuxtv-dvb-apps-1.1.1+rev1500/debian/patches/series        2020-07-03 
20:13:33.000000000 +0000
@@ -9,3 +9,4 @@
 use-ldflags.patch
 fix-build-libpng16.patch
 dst_test-no-set-id.patch
+glibc-stime.patch

Reply via email to