From 75a70547f8c07e7ab771145f14f2d0dc4821ead9 Mon Sep 17 00:00:00 2001 From: Bob Burger Date: Tue, 18 Sep 2018 16:42:51 -0400 Subject: [PATCH] use uuid_generate on unix-like systems for S_unique_id original commit: 2fd3db68230d094a0d396348a8140a4d3693b120 --- .travis.yml | 2 + .travis/dobuild.sh | 5 ++- BUILDING | 1 + LOG | 2 + c/Mf-a6le | 2 +- c/Mf-arm32le | 2 +- c/Mf-i3le | 2 +- c/Mf-ppc32le | 2 +- c/Mf-ta6le | 2 +- c/Mf-ti3le | 2 +- c/Mf-tppc32le | 2 +- c/stats.c | 66 ++++++++++---------------------- csug/objects.stex | 6 +-- release_notes/release_notes.stex | 6 +++ 14 files changed, 45 insertions(+), 57 deletions(-) diff --git a/.travis.yml b/.travis.yml index ff99c30e55..8b2af94730 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,10 @@ matrix: env: TARGET_MACHINE=ta6osx - os: linux env: TARGET_MACHINE=i3le + sudo: required - os: linux env: TARGET_MACHINE=ti3le + sudo: required - os: linux env: TARGET_MACHINE=a6le - os: linux diff --git a/.travis/dobuild.sh b/.travis/dobuild.sh index 066ab1611e..569e219f12 100755 --- a/.travis/dobuild.sh +++ b/.travis/dobuild.sh @@ -1,5 +1,8 @@ #!/bin/bash - +case $TARGET_MACHINE in + *i3le) sudo apt-get -yq --no-install-suggests --no-install-recommends install uuid-dev:i386 ;; + *) +esac ./configure -m=$TARGET_MACHINE exitcode=$? if [ $exitcode -ne 0 ] ; then diff --git a/BUILDING b/BUILDING index 5726e343a0..4a8e5294f9 100644 --- a/BUILDING +++ b/BUILDING @@ -42,6 +42,7 @@ Prerequisites: * gcc * Header files and libraries for ncurses * Header files and libraries for X windows +* Header files and libraries for uuid Uninstalling on Unix-like systems is as simple as running: diff --git a/LOG b/LOG index 4d6519bffb..43b282d86c 100644 --- a/LOG +++ b/LOG @@ -1007,3 +1007,5 @@ Makefile.in, Makefile-workarea.in, Mf-install.in - add PDB files for Windows c/*nt, wininstall/*nt.wxs +- use uuid_generate on unix-like systems for S_unique_id + BUILDING, c/Mf-*le, stats.c, objects.stex, release_notes.stex diff --git a/c/Mf-a6le b/c/Mf-a6le index c6b9b93389..49b8d046c7 100644 --- a/c/Mf-a6le +++ b/c/Mf-a6le @@ -16,7 +16,7 @@ m = a6le Cpu = X86_64 -mdclib = -lm -ldl -lncurses -lrt +mdclib = -lm -ldl -lncurses -lrt -luuid C = ${CC} ${CPPFLAGS} -m64 -msse2 -Wpointer-arith -Wall -Wextra -Werror -Wno-implicit-fallthrough -O2 ${CFLAGS} o = o mdsrc = i3le.c diff --git a/c/Mf-arm32le b/c/Mf-arm32le index c4564a5264..a5bb283283 100644 --- a/c/Mf-arm32le +++ b/c/Mf-arm32le @@ -16,7 +16,7 @@ m = arm32le Cpu = ARMV6 -mdclib = -lm -ldl -lncurses -lrt +mdclib = -lm -ldl -lncurses -lrt -luuid C = ${CC} ${CPPFLAGS} -Wpointer-arith -Wextra -Werror -Wno-implicit-fallthrough -O2 ${CFLAGS} o = o mdsrc = arm32le.c diff --git a/c/Mf-i3le b/c/Mf-i3le index 9d3b30db49..e9cf27d766 100644 --- a/c/Mf-i3le +++ b/c/Mf-i3le @@ -16,7 +16,7 @@ m = i3le Cpu = I386 -mdclib = -lm -ldl -lncurses -lrt +mdclib = -lm -ldl -lncurses -lrt -luuid C = ${CC} ${CPPFLAGS} -m32 -msse2 -Wpointer-arith -Wall -Wextra -Werror -Wno-implicit-fallthrough -O2 -fno-stack-protector ${CFLAGS} o = o mdsrc = i3le.c diff --git a/c/Mf-ppc32le b/c/Mf-ppc32le index bf209fb233..844be15128 100644 --- a/c/Mf-ppc32le +++ b/c/Mf-ppc32le @@ -16,7 +16,7 @@ m = ppc32le Cpu = PPC32 -mdclib = -lm -ldl -lncurses -lrt +mdclib = -lm -ldl -lncurses -lrt -luuid C = ${CC} ${CPPFLAGS} -m32 -Wpointer-arith -Wextra -Werror -Wno-implicit-fallthrough -O2 ${CFLAGS} o = o mdsrc = ppc32.c diff --git a/c/Mf-ta6le b/c/Mf-ta6le index 206afc5070..30cc11d629 100644 --- a/c/Mf-ta6le +++ b/c/Mf-ta6le @@ -16,7 +16,7 @@ m = ta6le Cpu = X86_64 -mdclib = -lm -ldl -lncurses -lpthread -lrt +mdclib = -lm -ldl -lncurses -lpthread -lrt -luuid C = ${CC} ${CPPFLAGS} -m64 -msse2 -Wpointer-arith -Wall -Wextra -Werror -Wno-implicit-fallthrough -O2 -D_REENTRANT -pthread ${CFLAGS} o = o mdsrc = i3le.c diff --git a/c/Mf-ti3le b/c/Mf-ti3le index 388360282b..dad6af7c91 100644 --- a/c/Mf-ti3le +++ b/c/Mf-ti3le @@ -16,7 +16,7 @@ m = ti3le Cpu = I386 -mdclib = -lm -ldl -lncurses -lpthread -lrt +mdclib = -lm -ldl -lncurses -lpthread -lrt -luuid C = ${CC} ${CPPFLAGS} -m32 -msse2 -Wpointer-arith -Wall -Wextra -Werror -Wno-implicit-fallthrough -O2 -D_REENTRANT -pthread ${CFLAGS} o = o mdsrc = i3le.c diff --git a/c/Mf-tppc32le b/c/Mf-tppc32le index c888664fe1..a1a66d97e1 100644 --- a/c/Mf-tppc32le +++ b/c/Mf-tppc32le @@ -16,7 +16,7 @@ m = tppc32le Cpu = PPC32 -mdclib = -lm -ldl -lncurses -lpthread -lrt +mdclib = -lm -ldl -lncurses -lpthread -lrt -luuid C = ${CC} ${CPPFLAGS} -m32 -Wpointer-arith -Wextra -Werror -Wno-implicit-fallthrough -O2 -D_REENTRANT -pthread ${CFLAGS} o = o mdsrc = ppc32le.c diff --git a/c/stats.c b/c/stats.c index 4e3ee139b0..ae5640a0df 100644 --- a/c/stats.c +++ b/c/stats.c @@ -53,57 +53,33 @@ static long adjust_time_zone(ptr dtvec, struct tm *tmxp, ptr given_tzoff); #include ptr S_unique_id() { - union {UUID uuid; INT foo[4];} u; - u.foo[0] = 0; - u.foo[1] = 0; - u.foo[2] = 0; - u.foo[3] = 0; - - UuidCreate(&u.uuid); - return S_add(S_ash(Sunsigned(u.foo[0]), Sinteger(8*3*sizeof(INT))), - S_add(S_ash(Sunsigned(u.foo[1]), Sinteger(8*2*sizeof(INT))), - S_add(S_ash(Sunsigned(u.foo[2]), Sinteger(8*sizeof(INT))), - Sunsigned(u.foo[3])))); + union {UUID uuid; U32 foo[4];} u; + u.foo[0] = 0; + u.foo[1] = 0; + u.foo[2] = 0; + u.foo[3] = 0; + UuidCreate(&u.uuid); + return S_add(S_ash(Sunsigned32(u.foo[0]), Sinteger(8*3*sizeof(U32))), + S_add(S_ash(Sunsigned32(u.foo[1]), Sinteger(8*2*sizeof(U32))), + S_add(S_ash(Sunsigned32(u.foo[2]), Sinteger(8*sizeof(U32))), + Sunsigned32(u.foo[3])))); } #else /* WIN32 */ -#include -#include -#include -#include -#include - -static INT gethostip(void) { - char hostname[MAXHOSTNAMELEN+1]; - struct hostent *h; - char **p; - struct in_addr in; - - if (gethostname(hostname, MAXHOSTNAMELEN)) return 0; - if ((h = gethostbyname(hostname)) == NULL) return 0; - p = h->h_addr_list; - if (*p == NULL) return 0; - - memcpy(&in.s_addr, *p, sizeof (in.s_addr)); - return in.s_addr; -} +#include ptr S_unique_id() { - struct timeval tp; - time_t sec; - pid_t pid; - INT ip; - - (void) gettimeofday(&tp,NULL); - - pid = getpid(); - ip = gethostip(); - sec = tp.tv_sec; - - return S_add(S_ash(Sunsigned(pid), Sinteger(8*(sizeof(sec)+sizeof(ip)))), - S_add(S_ash(Sunsigned(ip), Sinteger(8*(sizeof(sec)))), - Sunsigned(sec))); + union {uuid_t uuid; U32 foo[4];} u; + u.foo[0] = 0; + u.foo[1] = 0; + u.foo[2] = 0; + u.foo[3] = 0; + uuid_generate(u.uuid); + return S_add(S_ash(Sunsigned32(u.foo[0]), Sinteger(8*3*sizeof(U32))), + S_add(S_ash(Sunsigned32(u.foo[1]), Sinteger(8*2*sizeof(U32))), + S_add(S_ash(Sunsigned32(u.foo[2]), Sinteger(8*sizeof(U32))), + Sunsigned32(u.foo[3])))); } #endif /* WIN32 */ diff --git a/csug/objects.stex b/csug/objects.stex index a40e855512..ec65e46304 100644 --- a/csug/objects.stex +++ b/csug/objects.stex @@ -1418,10 +1418,8 @@ The pretty name of a gensym is returned by the procedure In both the first and second forms, the unique name is an automatically generated globally unique name. -Globally unique names are constructed (lazily---see below) -from some combination of a unique machine identifier (such as the -network address), the current process identifier (PID), and the -time at which the Scheme session began, along with an internal +Globally unique names are constructed (lazily---see below) from the +combination of a universally unique identifier and an internal counter. In the third form of gensym, the unique name of the new gensym is \var{unique-name}, which must be a string. diff --git a/release_notes/release_notes.stex b/release_notes/release_notes.stex index 0ad6eac72d..7f93595c35 100644 --- a/release_notes/release_notes.stex +++ b/release_notes/release_notes.stex @@ -1592,6 +1592,12 @@ in fasl files does not generally make sense. %----------------------------------------------------------------------------- \section{Bug Fixes}\label{section:bugfixes} +\subsection{Globally unique names on non-Windows systems no longer contain the IP address (9.5.1)} + +The globally unique names of gensyms no longer contain the IP address +on non-Windows systems. Windows systems already used a universally +unique identifier. + \subsection{Invalid memory reference from \protect\scheme{fxvector} calls (9.5)} A compiler bug that could result in an invalid memory reference or