Re: [atlas] RIPE Atlas Software Probes and Ubuntu 20.04 / glibc 2.31

2020-06-22 Thread Philip Homburg
On 2020/05/24 13:04 , Bernd Strehhuber wrote:
> with newer Linux Dists / glibc Versions (tested on Ubuntu 20.04 LTS)
> stime() has been deprecated and replaced with clock_settime().
> Busybox got the following commit back in 11/2019:
> 
> https://git.busybox.net/busybox/commit/?id=d3539be8f27b8cbfdfee460fe08299158f08bcd9
> 
> Compiling on the latest Ubuntu version I applied the attached diff
> to get things working again.

I put a version in the devel branch of the software probe that refers to
a newer version of busybox code, which no longer uses stime. Could you
please try that version and see if it works on Ubuntu?

Philip



[atlas] RIPE Atlas Software Probes and Ubuntu 20.04 / glibc 2.31

2020-06-22 Thread Bernd Strehhuber
Hi Philip,

with newer Linux Dists / glibc Versions (tested on Ubuntu 20.04 LTS)
stime() has been deprecated and replaced with clock_settime().
Busybox got the following commit back in 11/2019:

https://git.busybox.net/busybox/commit/?id=d3539be8f27b8cbfdfee460fe08299158f08bcd9

Compiling on the latest Ubuntu version I applied the attached diff
to get things working again.

Bye
Bernd
-- 
plan b. solutions GmbH
Baumeisterstrasse 50, 76137 Karlsruhe, Germany
phone: +49 721 388582, fax: +49 721 388581, mailto: i...@planb.de
CEO: Bernd Strehhuber, registration court: AG Mannheim HRB 701718
diff --git a/coreutils/date.c b/coreutils/date.c
index b016656..99b7578 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -269,6 +269,9 @@ int date_main(int argc UNUSED_PARAM, char **argv)
time(_sec);
 #endif
}
+#if !ENABLE_FEATURE_DATE_NANO
+   ts.tv_nsec = 0;
+#endif
localtime_r(_sec, _time);
 
/* If date string is given, update tm_time, and maybe set date */
@@ -305,12 +308,13 @@ int date_main(int argc UNUSED_PARAM, char **argv)
if (date_str[0] != '@')
tm_time.tm_isdst = -1;
ts.tv_sec = validate_tm_time(date_str, _time);
+   ts.tv_nsec = 0;
 
maybe_set_utc(opt);
}
 
/* if setting time, set it */
-   if ((opt & OPT_SET) && stime(_sec) < 0) {
+   if ((opt & OPT_SET) && clock_settime(CLOCK_REALTIME, ) < 0) {
bb_perror_msg("can't set date");
}
}
diff --git a/libbb/missing_syscalls.c b/libbb/missing_syscalls.c
index 0934128..65709ed 100644
--- a/libbb/missing_syscalls.c
+++ b/libbb/missing_syscalls.c
@@ -16,14 +16,6 @@ pid_t getsid(pid_t pid)
return syscall(__NR_getsid, pid);
 }
 
-int stime(const time_t *t)
-{
-   struct timeval tv;
-   tv.tv_sec = *t;
-   tv.tv_usec = 0;
-   return settimeofday(, NULL);
-}
-
 int sethostname(const char *name, size_t len)
 {
return syscall(__NR_sethostname, name, len);
diff --git a/networking/httpget.c b/networking/httpget.c
index 74889ea..3221dbd 100644
--- a/networking/httpget.c
+++ b/networking/httpget.c
@@ -975,7 +975,7 @@ static int eat_headers(FILE *tcp_file, int *chunked, int 
*content_length,
"setting time, time difference is %d\n",
(int)(tim-now));
}
-   stime();
+   clock_settime(CLOCK_REALTIME,);
}
}
 
diff --git a/networking/httppost.c b/networking/httppost.c
index 93ccfb1..cb4179e 100644
--- a/networking/httppost.c
+++ b/networking/httppost.c
@@ -493,7 +493,7 @@ int httppost_main(int argc, char *argv[])
fprintf(stderr,
"setting time, time difference is %ld\n",
(long)server_time-now.tv_sec);
-   stime(_time);
+   clock_settime(CLOCK_REALTIME,_time);
if (atlas_id)
{
printf(
diff --git a/util-linux/rdate.c b/util-linux/rdate.c
index 8dd784d..d38f676 100644
--- a/util-linux/rdate.c
+++ b/util-linux/rdate.c
@@ -79,9 +79,13 @@ int rdate_main(int argc UNUSED_PARAM, char **argv)
time(_time);
if (current_time == remote_time)
bb_error_msg("current time matches remote time");
-   else
-   if (stime(_time) < 0)
+   else {
+   struct timespec ts;
+   ts.tv_sec = remote_time;
+   ts.tv_nsec = 0;
+   if (clock_settime(CLOCK_REALTIME, ) < 0)
bb_perror_msg_and_die("can't set time of day");
+   }
}
 
if (flags != 1) /* not lone -s */


Re: [atlas] RIPE Atlas Software Probes and Ubuntu 20.04 / glibc 2.31

2020-06-02 Thread Philip Homburg
Hi Bernd,

On 2020/05/24 13:04 , Bernd Strehhuber wrote:
> with newer Linux Dists / glibc Versions (tested on Ubuntu 20.04 LTS)
> stime() has been deprecated and replaced with clock_settime().
> Busybox got the following commit back in 11/2019:
> 
> https://git.busybox.net/busybox/commit/?id=d3539be8f27b8cbfdfee460fe08299158f08bcd9
> 
> Compiling on the latest Ubuntu version I applied the attached diff
> to get things working again.

I was working on removing busybox code that is not used by the Atlas
measurement code. That makes it unnecessary to patch the busybox code.

Replacing an stime call directly with clock_settime is not going to work
(that code never runs on software probes, so I understand why it works
for you). I'll work on a better patch. In any case, thanks.

Philip