* nap() name space clash
@ 2020-02-04 5:34 Tim Rice
2020-02-04 10:47 ` Bruno Haible
0 siblings, 1 reply; 7+ messages in thread
From: Tim Rice @ 2020-02-04 5:34 UTC (permalink / raw)
To: bug-gnulib
While attempting to test my UnixWare port of sed-4.8 I discoverd a
name space clash with nap() in some gnulib files
tests/test-lutimens.h
tests/test-utime.c
tests/test-chown.h
tests/nap.h
tests/test-utimens.h
tests/test-stat-time.c
tests/test-futimens.h
tests/test-lchown.h
http://uw714doc.xinuos.com/en/man/html.3C/nap.3C.html
What would be the prefered replacement name? gnulib_nap?
How do I find out if I have filled out copyright assignment papers
for the gnulib project?
Thanks.
--
Tim Rice Multitalents
tim@multitalents.net
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: nap() name space clash
2020-02-04 5:34 nap() name space clash Tim Rice
@ 2020-02-04 10:47 ` Bruno Haible
2020-02-04 17:02 ` Tim Rice
0 siblings, 1 reply; 7+ messages in thread
From: Bruno Haible @ 2020-02-04 10:47 UTC (permalink / raw)
To: bug-gnulib; +Cc: Tim Rice
> I discoverd a name space clash with nap()
In which .h file is this function declared on UnixWare?
And in which .so file is it defined?
> How do I find out if I have filled out copyright assignment papers
> for the gnulib project?
The file fencepost.gnu.org:/gd/gnuorg/copyright.list lists you for
some packages, but not for Gnulib (so far).
Bruno
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: nap() name space clash
2020-02-04 10:47 ` Bruno Haible
@ 2020-02-04 17:02 ` Tim Rice
2020-02-05 2:03 ` Bruno Haible
0 siblings, 1 reply; 7+ messages in thread
From: Tim Rice @ 2020-02-04 17:02 UTC (permalink / raw)
To: Bruno Haible; +Cc: bug-gnulib
Hi Bruno,
On Tue, 4 Feb 2020, Bruno Haible wrote:
> > I discoverd a name space clash with nap()
>
> In which .h file is this function declared on UnixWare?
unistd.h
> And in which .so file is it defined?
libc
>
> > How do I find out if I have filled out copyright assignment papers
> > for the gnulib project?
>
> The file fencepost.gnu.org:/gd/gnuorg/copyright.list lists you for
> some packages, but not for Gnulib (so far).
OK, I wil need to do that for gnulib. I have been siting on a bunch of
patches way too long.
Hmm, not all that ewasy to find the right assignent papers and who to send
them to.
>
> Bruno
>
>
--
Tim Rice Multitalents
tim@multitalents.net
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: nap() name space clash
2020-02-04 17:02 ` Tim Rice
@ 2020-02-05 2:03 ` Bruno Haible
2020-02-06 23:37 ` Tim Rice
0 siblings, 1 reply; 7+ messages in thread
From: Bruno Haible @ 2020-02-05 2:03 UTC (permalink / raw)
To: bug-gnulib
Hi Tim,
> > > I discoverd a name space clash with nap()
> >
> > In which .h file is this function declared on UnixWare?
>
> unistd.h
Can you find out whether defining some preprocessor symbol will make
the declaration disappear? You need to peek into the .h file, make a
guess, and then process the file
#include <unistd.h>
int nap;
with "gcc -E ... | grep nap".
> > > How do I find out if I have filled out copyright assignment papers
> > > for the gnulib project?
>
> OK, I wil need to do that for gnulib. I have been siting on a bunch of
> patches way too long.
> Hmm, not all that ewasy to find the right assignent papers and who to send
> them to.
The right form should be doc/Copyright/request-assign.future (in the gnulib
repository).
Bruno
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: nap() name space clash
2020-02-05 2:03 ` Bruno Haible
@ 2020-02-06 23:37 ` Tim Rice
2020-09-24 5:33 ` Tim Rice
0 siblings, 1 reply; 7+ messages in thread
From: Tim Rice @ 2020-02-06 23:37 UTC (permalink / raw)
To: Bruno Haible; +Cc: bug-gnulib
On Wed, 5 Feb 2020, Bruno Haible wrote:
} Hi Tim,
}
} > > > I discoverd a name space clash with nap()
} > >
} > > In which .h file is this function declared on UnixWare?
} >
} > unistd.h
}
} Can you find out whether defining some preprocessor symbol will make
} the declaration disappear?
There are 3. Any one of them would make the declaration disappear
but also disappear 27 other declarations and 5 defines.
Not really a viable option.
Since the usage of nap() is in the gnulib test framework I would think the
chances of other consumers of nap() would be very small so renaming that
function in gnulib would have minimal impact. (the 8 files mentioned before)
Now if we choose to rename map.h, these additional files would need changes.
tests/test-utimens-common.h
modules/chown-tests
modules/futimens-tests
modules/utime-tests
modules/lchown-tests
modules/utimens-tests
modules/fdutimensat-tests
modules/utimensat-tests
modules/fchownat-tests
modules/stat-time-tests
} The right form should be doc/Copyright/request-assign.future (in the gnulib
} repository).
Filled out and e-mailed in.
}
} Bruno
}
--
Tim Rice Multitalents
tim@multitalents.net
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: nap() name space clash
2020-02-06 23:37 ` Tim Rice
@ 2020-09-24 5:33 ` Tim Rice
2020-10-11 18:55 ` Bruno Haible
0 siblings, 1 reply; 7+ messages in thread
From: Tim Rice @ 2020-09-24 5:33 UTC (permalink / raw)
To: Bruno Haible; +Cc: bug-gnulib
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1929 bytes --]
[reviving an old thread that started here
https://lists.gnu.org/archive/html/bug-gnulib/2020-02/msg00025.html]
Hi Bruno,
On Thu, 6 Feb 2020, Tim Rice wrote:
> On Wed, 5 Feb 2020, Bruno Haible wrote:
>
> } Hi Tim,
> }
> } > > > I discoverd a name space clash with nap()
> } > >
> } > > In which .h file is this function declared on UnixWare?
> } >
> } > unistd.h
> }
> } Can you find out whether defining some preprocessor symbol will make
> } the declaration disappear?
>
> There are 3. Any one of them would make the declaration disappear
> but also disappear 27 other declarations and 5 defines.
> Not really a viable option.
>
> Since the usage of nap() is in the gnulib test framework I would think the
> chances of other consumers of nap() would be very small so renaming that
> function in gnulib would have minimal impact. (the 8 files mentioned before)
> Now if we choose to rename map.h, these additional files would need changes.
> tests/test-utimens-common.h
> modules/chown-tests
> modules/futimens-tests
> modules/utime-tests
> modules/lchown-tests
> modules/utimens-tests
> modules/fdutimensat-tests
> modules/utimensat-tests
> modules/fchownat-tests
> modules/stat-time-tests
>
> } The right form should be doc/Copyright/request-assign.future (in the gnulib
> } repository).
>
> Filled out and e-mailed in.
>
> }
> } Bruno
> }
Now with copyright papers in place and some time to get back to this,
I've prepared 2 patch options for your consideration.
The attached nap2gnulib_nap.patch renames nap to gnulib_nap and leaves
the tests/nap.h name alone.
The attached nap2gnulib_nap_with_nap_h_rename.patch assumes a
"git mv tests/nap.h tests/gnulib_nap.h"
I did a little digging ad discovered that nap() in libc goes back to
at least Xenix 286 as discussed in this article.
http://wdb1.sco.com/kb/showta?taid=100218
Thanks for your consideration.
--
Tim Rice Multitalents
tim@multitalents.net
[-- Attachment #2: nap2gnulib_nap.patch --]
[-- Type: TEXT/PLAIN, Size: 9781 bytes --]
diff --git a/ChangeLog b/ChangeLog
index 188bb8f2f..92527224c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2020-09-23 Tim Rice <tim@multitalents.net>
+
+ * tests/nap.h: avoid name space clash with UniWare's libc.
+ nap() dates back to Xenix 286. First discussed here
+ <https://lists.gnu.org/archive/html/bug-gnulib/2020-02/msg00025.html>
+ * tests/test-chown.h: Likewise
+ * tests/test-futimens.h: Likewise
+ * tests/test-lchown.h: Likewise
+ * tests/test-lutimens.h: Likewise
+ * tests/test-stat-time.c: Likewise
+ * tests/test-utime.c: Likewise
+ * tests/test-utimens.h: Likewise
+
2020-09-20 Norihiro Tanaka <noritnk@kcn.ne.jp>
dfa: make dfasupported a global function
diff --git a/tests/nap.h b/tests/nap.h
index 5dd264f6d..784c22f07 100644
--- a/tests/nap.h
+++ b/tests/nap.h
@@ -25,7 +25,7 @@
# include <intprops.h>
/* Name of the witness file. */
-#define TEMPFILE BASE "nap.tmp"
+#define TEMPFILE BASE "gnulib_nap.tmp"
/* File descriptor used for the witness file. */
static int nap_fd = -1;
@@ -114,7 +114,7 @@ clear_temp_file (void)
Assumes that BASE is defined, and requires that the test module
depends on nanosleep. */
static void
-nap (void)
+gnulib_nap (void)
{
struct stat old_st;
static int delay = 1;
diff --git a/tests/test-chown.h b/tests/test-chown.h
index eb068f0b8..79ca4d2ef 100644
--- a/tests/test-chown.h
+++ b/tests/test-chown.h
@@ -98,7 +98,7 @@ test_chown (int (*func) (char const *, uid_t, gid_t), bool print)
/* Even if the values aren't changing, ctime is required to change
if at least one argument is not -1. */
- nap ();
+ gnulib_nap ();
ASSERT (func (BASE "dir/file", st1.st_uid, st1.st_gid) == 0);
ASSERT (stat (BASE "dir/file", &st2) == 0);
ASSERT (st1.st_ctime < st2.st_ctime
@@ -172,7 +172,7 @@ test_chown (int (*func) (char const *, uid_t, gid_t), bool print)
ASSERT (lstat (BASE "dir/link", &l1) == 0);
ASSERT (lstat (BASE "dir/link2", &l2) == 0);
- nap ();
+ gnulib_nap ();
errno = 0;
ASSERT (func (BASE "dir/link2/", -1, st1.st_gid) == -1);
ASSERT (errno == ENOTDIR);
diff --git a/tests/test-futimens.h b/tests/test-futimens.h
index b5645e6d1..bbac0db04 100644
--- a/tests/test-futimens.h
+++ b/tests/test-futimens.h
@@ -32,7 +32,7 @@ test_futimens (int (*func) (int, struct timespec const *),
/* Sanity check. */
ASSERT (fstat (fd, &st1) == 0);
- nap ();
+ gnulib_nap ();
errno = 0;
result = func (fd, NULL);
if (result == -1 && errno == ENOSYS)
@@ -68,7 +68,7 @@ test_futimens (int (*func) (int, struct timespec const *),
ts[1] = ts[0];
ASSERT (func (fd, ts) == 0);
ASSERT (fstat (fd, &st1) == 0);
- nap ();
+ gnulib_nap ();
}
/* Invalid arguments. */
@@ -148,7 +148,7 @@ test_futimens (int (*func) (int, struct timespec const *),
ts[0].tv_nsec = UTIME_OMIT;
ts[1].tv_sec = 0;
ts[1].tv_nsec = UTIME_NOW;
- nap ();
+ gnulib_nap ();
ASSERT (func (fd, ts) == 0);
ASSERT (fstat (fd, &st3) == 0);
ASSERT (st3.st_atime == Y2K);
@@ -157,7 +157,7 @@ test_futimens (int (*func) (int, struct timespec const *),
ASSERT (utimecmp (BASE "file", &st1, &st3, 0) <= 0);
if (check_ctime)
ASSERT (ctime_compare (&st2, &st3) < 0);
- nap ();
+ gnulib_nap ();
ts[0].tv_nsec = 0;
ts[1].tv_nsec = UTIME_OMIT;
ASSERT (func (fd, ts) == 0);
diff --git a/tests/test-lchown.h b/tests/test-lchown.h
index cf29e29c4..e4bedd9e7 100644
--- a/tests/test-lchown.h
+++ b/tests/test-lchown.h
@@ -106,7 +106,7 @@ test_lchown (int (*func) (char const *, uid_t, gid_t), bool print)
/* Even if the values aren't changing, ctime is required to change
if at least one argument is not -1. */
- nap ();
+ gnulib_nap ();
ASSERT (func (BASE "dir/file", st1.st_uid, st1.st_gid) == 0);
ASSERT (stat (BASE "dir/file", &st2) == 0);
ASSERT (st1.st_ctime < st2.st_ctime
@@ -208,7 +208,7 @@ test_lchown (int (*func) (char const *, uid_t, gid_t), bool print)
ASSERT (lstat (BASE "dir/link", &l1) == 0);
ASSERT (lstat (BASE "dir/link2", &l2) == 0);
- nap ();
+ gnulib_nap ();
errno = 0;
ASSERT (func (BASE "dir/link2/", -1, st1.st_gid) == -1);
ASSERT (errno == ENOTDIR);
@@ -237,7 +237,7 @@ test_lchown (int (*func) (char const *, uid_t, gid_t), bool print)
/* Trailing slash follows through to directory. */
ASSERT (lstat (BASE "dir/sub", &st1) == 0);
ASSERT (lstat (BASE "dir/link3", &l1) == 0);
- nap ();
+ gnulib_nap ();
ASSERT (func (BASE "dir/link3/", -1, st1.st_gid) == 0);
ASSERT (lstat (BASE "dir/link3", &st2) == 0);
ASSERT (l1.st_ctime == st2.st_ctime);
diff --git a/tests/test-lutimens.h b/tests/test-lutimens.h
index 90aa5141b..22e469ef0 100644
--- a/tests/test-lutimens.h
+++ b/tests/test-lutimens.h
@@ -60,7 +60,7 @@ test_lutimens (int (*func) (char const *, struct timespec const *), bool print)
ts[0].tv_sec = Y2K;
ts[0].tv_nsec = 0;
ts[1] = ts[0];
- nap ();
+ gnulib_nap ();
ASSERT (func (BASE "file", ts) == 0);
}
ASSERT (stat (BASE "file", &st2) == 0);
@@ -102,7 +102,7 @@ test_lutimens (int (*func) (char const *, struct timespec const *), bool print)
ASSERT (lstat (BASE "link", &st1) == 0);
/* On cygwin, lstat() changes atime of symlinks, so that lutimens
can only effectively modify mtime. */
- nap ();
+ gnulib_nap ();
ASSERT (lstat (BASE "link", &st2) == 0);
if (st1.st_atime != st2.st_atime
|| get_stat_atime_ns (&st1) != get_stat_atime_ns (&st2))
@@ -146,7 +146,7 @@ test_lutimens (int (*func) (char const *, struct timespec const *), bool print)
ts[0].tv_nsec = BILLION / 2 - 1;
ts[1].tv_sec = Y2K;
ts[1].tv_nsec = BILLION - 1;
- nap ();
+ gnulib_nap ();
ASSERT (func (BASE "link", ts) == 0);
ASSERT (lstat (BASE "link", &st2) == 0);
if (atime_supported)
@@ -170,7 +170,7 @@ test_lutimens (int (*func) (char const *, struct timespec const *), bool print)
ts[0].tv_nsec = UTIME_OMIT;
ts[1].tv_sec = 0;
ts[1].tv_nsec = UTIME_NOW;
- nap ();
+ gnulib_nap ();
ASSERT (func (BASE "link", ts) == 0);
ASSERT (lstat (BASE "link", &st3) == 0);
if (atime_supported)
@@ -182,7 +182,7 @@ test_lutimens (int (*func) (char const *, struct timespec const *), bool print)
ASSERT (utimecmp (BASE "link", &st1, &st3, 0) <= 0);
if (check_ctime)
ASSERT (ctime_compare (&st2, &st3) < 0);
- nap ();
+ gnulib_nap ();
ts[0].tv_nsec = 0;
ts[1].tv_nsec = UTIME_OMIT;
ASSERT (func (BASE "link", ts) == 0);
diff --git a/tests/test-stat-time.c b/tests/test-stat-time.c
index 86d4346d9..c79ed6c0e 100644
--- a/tests/test-stat-time.c
+++ b/tests/test-stat-time.c
@@ -110,13 +110,13 @@ prepare_test (struct stat *statinfo, struct timespec *modtimes)
int i;
create_file (filename_stamp1);
- nap ();
+ gnulib_nap ();
create_file (filename_testfile);
- nap ();
+ gnulib_nap ();
create_file (filename_stamp2);
- nap ();
+ gnulib_nap ();
ASSERT (chmod (filename_testfile, 0400) == 0);
- nap ();
+ gnulib_nap ();
create_file (filename_stamp3);
do_stat (filename_stamp1, &statinfo[0]);
diff --git a/tests/test-utime.c b/tests/test-utime.c
index 4cf583606..1ee3de6eb 100644
--- a/tests/test-utime.c
+++ b/tests/test-utime.c
@@ -38,7 +38,7 @@ test_utime (bool print)
ASSERT (close (creat (BASE "file", 0600)) == 0);
ASSERT (stat (BASE "file", &st1) == 0);
- nap ();
+ gnulib_nap ();
ASSERT (utime (BASE "file", NULL) == 0);
ASSERT (stat (BASE "file", &st2) == 0);
ASSERT (0 <= utimecmp (BASE "file", &st2, &st1, UTIMECMP_TRUNCATE_SOURCE));
@@ -56,7 +56,7 @@ test_utime (bool print)
ts.actime = ts.modtime = time (NULL);
ASSERT (utime (BASE "file", &ts) == 0);
ASSERT (stat (BASE "file", &st1) == 0);
- nap ();
+ gnulib_nap ();
}
/* Invalid arguments. */
diff --git a/tests/test-utimens.h b/tests/test-utimens.h
index a05b232a8..10aef0892 100644
--- a/tests/test-utimens.h
+++ b/tests/test-utimens.h
@@ -33,7 +33,7 @@ test_utimens (int (*func) (char const *, struct timespec const *), bool print)
UTIMECMP_TRUNCATE_SOURCE to compensate, with st1 as the
source. */
ASSERT (stat (BASE "file", &st1) == 0);
- nap ();
+ gnulib_nap ();
ASSERT (func (BASE "file", NULL) == 0);
ASSERT (stat (BASE "file", &st2) == 0);
ASSERT (0 <= utimecmp (BASE "file", &st2, &st1, UTIMECMP_TRUNCATE_SOURCE));
@@ -52,7 +52,7 @@ test_utimens (int (*func) (char const *, struct timespec const *), bool print)
ts[1] = ts[0];
ASSERT (func (BASE "file", ts) == 0);
ASSERT (stat (BASE "file", &st1) == 0);
- nap ();
+ gnulib_nap ();
}
/* Invalid arguments. */
@@ -126,7 +126,7 @@ test_utimens (int (*func) (char const *, struct timespec const *), bool print)
ts[0].tv_nsec = UTIME_OMIT;
ts[1].tv_sec = 0;
ts[1].tv_nsec = UTIME_NOW;
- nap ();
+ gnulib_nap ();
ASSERT (func (BASE "file", ts) == 0);
ASSERT (stat (BASE "file", &st3) == 0);
ASSERT (st3.st_atime == Y2K);
@@ -136,7 +136,7 @@ test_utimens (int (*func) (char const *, struct timespec const *), bool print)
ASSERT (0 <= utimecmp (BASE "file", &st3, &st1, UTIMECMP_TRUNCATE_SOURCE));
if (check_ctime)
ASSERT (ctime_compare (&st2, &st3) < 0);
- nap ();
+ gnulib_nap ();
ts[0].tv_nsec = 0;
ts[1].tv_nsec = UTIME_OMIT;
ASSERT (func (BASE "file", ts) == 0);
[-- Attachment #3: nap2gnulib_nap_with_nap_h_rename.patch --]
[-- Type: TEXT/PLAIN, Size: 13708 bytes --]
diff --git a/ChangeLog b/ChangeLog
index 188bb8f2f..69d41bf1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2020-09-23 Tim Rice <tim@multitalents.net>
+
+ * tests/nap.h: rename to tests/gnulib_nap.h
+ * tests/gnulib_nap.h: avoid name space clash with UniWare's libc.
+ rename nap() to gnulib_nap(). nap() dates back to Xenix 286.
+ First discussed here
+ <https://lists.gnu.org/archive/html/bug-gnulib/2020-02/msg00025.html>
+ * modules/chown-tests: Likewise
+ * modules/fchownat-tests: Likewise
+ * modules/fdutimensat-tests: Likewise
+ * modules/futimens-tests: Likewise
+ * modules/lchown-tests: Likewise
+ * modules/stat-time-tests: Likewise
+ * modules/utime-tests: Likewise
+ * modules/utimens-tests: Likewise
+ * modules/utimensat-tests: Likewise
+ * tests/test-chown.h: Likewise
+ * tests/test-futimens.h: Likewise
+ * tests/test-lchown.h: Likewise
+ * tests/test-lutimens.h: Likewise
+ * tests/test-stat-time.c: Likewise
+ * tests/test-utime.c: Likewise
+ * tests/test-utimens.h: Likewise
+ * tests/test-utimens-common.h
+
2020-09-20 Norihiro Tanaka <noritnk@kcn.ne.jp>
dfa: make dfasupported a global function
diff --git a/modules/chown-tests b/modules/chown-tests
index 13138f438..33f730daa 100644
--- a/modules/chown-tests
+++ b/modules/chown-tests
@@ -1,5 +1,5 @@
Files:
-tests/nap.h
+tests/gnulib_nap.h
tests/test-chown.h
tests/test-chown.c
tests/signature.h
diff --git a/modules/fchownat-tests b/modules/fchownat-tests
index e5fb7833f..62f6f4a1d 100644
--- a/modules/fchownat-tests
+++ b/modules/fchownat-tests
@@ -1,5 +1,5 @@
Files:
-tests/nap.h
+tests/gnulib_nap.h
tests/test-chown.h
tests/test-lchown.h
tests/test-fchownat.c
diff --git a/modules/fdutimensat-tests b/modules/fdutimensat-tests
index 37f70c652..0ee034a9b 100644
--- a/modules/fdutimensat-tests
+++ b/modules/fdutimensat-tests
@@ -1,5 +1,5 @@
Files:
-tests/nap.h
+tests/gnulib_nap.h
tests/test-futimens.h
tests/test-lutimens.h
tests/test-utimens.h
diff --git a/modules/futimens-tests b/modules/futimens-tests
index 519141300..2116246d9 100644
--- a/modules/futimens-tests
+++ b/modules/futimens-tests
@@ -1,5 +1,5 @@
Files:
-tests/nap.h
+tests/gnulib_nap.h
tests/test-futimens.h
tests/test-utimens-common.h
tests/test-futimens.c
diff --git a/modules/lchown-tests b/modules/lchown-tests
index 42b946014..004cda60f 100644
--- a/modules/lchown-tests
+++ b/modules/lchown-tests
@@ -1,5 +1,5 @@
Files:
-tests/nap.h
+tests/gnulib_nap.h
tests/test-lchown.h
tests/test-lchown.c
tests/signature.h
diff --git a/modules/stat-time-tests b/modules/stat-time-tests
index c512eca76..3c14de2f9 100644
--- a/modules/stat-time-tests
+++ b/modules/stat-time-tests
@@ -1,7 +1,7 @@
Files:
tests/test-stat-time.c
tests/macros.h
-tests/nap.h
+tests/gnulib_nap.h
Depends-on:
intprops
diff --git a/modules/utime-tests b/modules/utime-tests
index a64d0a006..a01546cdc 100644
--- a/modules/utime-tests
+++ b/modules/utime-tests
@@ -1,6 +1,6 @@
Files:
tests/test-utime.c
-tests/nap.h
+tests/gnulib_nap.h
tests/test-utimens-common.h
tests/macros.h
diff --git a/modules/utimens-tests b/modules/utimens-tests
index 2a95346a0..28ebadae3 100644
--- a/modules/utimens-tests
+++ b/modules/utimens-tests
@@ -1,5 +1,5 @@
Files:
-tests/nap.h
+tests/gnulib_nap.h
tests/test-futimens.h
tests/test-lutimens.h
tests/test-utimens.h
diff --git a/modules/utimensat-tests b/modules/utimensat-tests
index 15c79407e..86d2ac2de 100644
--- a/modules/utimensat-tests
+++ b/modules/utimensat-tests
@@ -1,5 +1,5 @@
Files:
-tests/nap.h
+tests/gnulib_nap.h
tests/test-lutimens.h
tests/test-utimens.h
tests/test-utimens-common.h
diff --git a/tests/gnulib_nap.h b/tests/gnulib_nap.h
index 5dd264f6d..784c22f07 100644
--- a/tests/gnulib_nap.h
+++ b/tests/gnulib_nap.h
@@ -25,7 +25,7 @@
# include <intprops.h>
/* Name of the witness file. */
-#define TEMPFILE BASE "nap.tmp"
+#define TEMPFILE BASE "gnulib_nap.tmp"
/* File descriptor used for the witness file. */
static int nap_fd = -1;
@@ -114,7 +114,7 @@ clear_temp_file (void)
Assumes that BASE is defined, and requires that the test module
depends on nanosleep. */
static void
-nap (void)
+gnulib_nap (void)
{
struct stat old_st;
static int delay = 1;
diff --git a/tests/test-chown.h b/tests/test-chown.h
index eb068f0b8..5863dfea3 100644
--- a/tests/test-chown.h
+++ b/tests/test-chown.h
@@ -16,7 +16,7 @@
/* Written by Eric Blake <ebb9@byu.net>, 2009. */
-#include "nap.h"
+#include "gnulib_nap.h"
#if !HAVE_GETEGID
# define getegid() ((gid_t) -1)
@@ -98,7 +98,7 @@ test_chown (int (*func) (char const *, uid_t, gid_t), bool print)
/* Even if the values aren't changing, ctime is required to change
if at least one argument is not -1. */
- nap ();
+ gnulib_nap ();
ASSERT (func (BASE "dir/file", st1.st_uid, st1.st_gid) == 0);
ASSERT (stat (BASE "dir/file", &st2) == 0);
ASSERT (st1.st_ctime < st2.st_ctime
@@ -172,7 +172,7 @@ test_chown (int (*func) (char const *, uid_t, gid_t), bool print)
ASSERT (lstat (BASE "dir/link", &l1) == 0);
ASSERT (lstat (BASE "dir/link2", &l2) == 0);
- nap ();
+ gnulib_nap ();
errno = 0;
ASSERT (func (BASE "dir/link2/", -1, st1.st_gid) == -1);
ASSERT (errno == ENOTDIR);
diff --git a/tests/test-futimens.h b/tests/test-futimens.h
index b5645e6d1..bbac0db04 100644
--- a/tests/test-futimens.h
+++ b/tests/test-futimens.h
@@ -32,7 +32,7 @@ test_futimens (int (*func) (int, struct timespec const *),
/* Sanity check. */
ASSERT (fstat (fd, &st1) == 0);
- nap ();
+ gnulib_nap ();
errno = 0;
result = func (fd, NULL);
if (result == -1 && errno == ENOSYS)
@@ -68,7 +68,7 @@ test_futimens (int (*func) (int, struct timespec const *),
ts[1] = ts[0];
ASSERT (func (fd, ts) == 0);
ASSERT (fstat (fd, &st1) == 0);
- nap ();
+ gnulib_nap ();
}
/* Invalid arguments. */
@@ -148,7 +148,7 @@ test_futimens (int (*func) (int, struct timespec const *),
ts[0].tv_nsec = UTIME_OMIT;
ts[1].tv_sec = 0;
ts[1].tv_nsec = UTIME_NOW;
- nap ();
+ gnulib_nap ();
ASSERT (func (fd, ts) == 0);
ASSERT (fstat (fd, &st3) == 0);
ASSERT (st3.st_atime == Y2K);
@@ -157,7 +157,7 @@ test_futimens (int (*func) (int, struct timespec const *),
ASSERT (utimecmp (BASE "file", &st1, &st3, 0) <= 0);
if (check_ctime)
ASSERT (ctime_compare (&st2, &st3) < 0);
- nap ();
+ gnulib_nap ();
ts[0].tv_nsec = 0;
ts[1].tv_nsec = UTIME_OMIT;
ASSERT (func (fd, ts) == 0);
diff --git a/tests/test-lchown.h b/tests/test-lchown.h
index cf29e29c4..bcbe182f0 100644
--- a/tests/test-lchown.h
+++ b/tests/test-lchown.h
@@ -16,7 +16,7 @@
/* Written by Eric Blake <ebb9@byu.net>, 2009. */
-#include "nap.h"
+#include "gnulib_nap.h"
#if !HAVE_GETEGID
# define getegid() ((gid_t) -1)
@@ -106,7 +106,7 @@ test_lchown (int (*func) (char const *, uid_t, gid_t), bool print)
/* Even if the values aren't changing, ctime is required to change
if at least one argument is not -1. */
- nap ();
+ gnulib_nap ();
ASSERT (func (BASE "dir/file", st1.st_uid, st1.st_gid) == 0);
ASSERT (stat (BASE "dir/file", &st2) == 0);
ASSERT (st1.st_ctime < st2.st_ctime
@@ -208,7 +208,7 @@ test_lchown (int (*func) (char const *, uid_t, gid_t), bool print)
ASSERT (lstat (BASE "dir/link", &l1) == 0);
ASSERT (lstat (BASE "dir/link2", &l2) == 0);
- nap ();
+ gnulib_nap ();
errno = 0;
ASSERT (func (BASE "dir/link2/", -1, st1.st_gid) == -1);
ASSERT (errno == ENOTDIR);
@@ -237,7 +237,7 @@ test_lchown (int (*func) (char const *, uid_t, gid_t), bool print)
/* Trailing slash follows through to directory. */
ASSERT (lstat (BASE "dir/sub", &st1) == 0);
ASSERT (lstat (BASE "dir/link3", &l1) == 0);
- nap ();
+ gnulib_nap ();
ASSERT (func (BASE "dir/link3/", -1, st1.st_gid) == 0);
ASSERT (lstat (BASE "dir/link3", &st2) == 0);
ASSERT (l1.st_ctime == st2.st_ctime);
diff --git a/tests/test-lutimens.h b/tests/test-lutimens.h
index 90aa5141b..22e469ef0 100644
--- a/tests/test-lutimens.h
+++ b/tests/test-lutimens.h
@@ -60,7 +60,7 @@ test_lutimens (int (*func) (char const *, struct timespec const *), bool print)
ts[0].tv_sec = Y2K;
ts[0].tv_nsec = 0;
ts[1] = ts[0];
- nap ();
+ gnulib_nap ();
ASSERT (func (BASE "file", ts) == 0);
}
ASSERT (stat (BASE "file", &st2) == 0);
@@ -102,7 +102,7 @@ test_lutimens (int (*func) (char const *, struct timespec const *), bool print)
ASSERT (lstat (BASE "link", &st1) == 0);
/* On cygwin, lstat() changes atime of symlinks, so that lutimens
can only effectively modify mtime. */
- nap ();
+ gnulib_nap ();
ASSERT (lstat (BASE "link", &st2) == 0);
if (st1.st_atime != st2.st_atime
|| get_stat_atime_ns (&st1) != get_stat_atime_ns (&st2))
@@ -146,7 +146,7 @@ test_lutimens (int (*func) (char const *, struct timespec const *), bool print)
ts[0].tv_nsec = BILLION / 2 - 1;
ts[1].tv_sec = Y2K;
ts[1].tv_nsec = BILLION - 1;
- nap ();
+ gnulib_nap ();
ASSERT (func (BASE "link", ts) == 0);
ASSERT (lstat (BASE "link", &st2) == 0);
if (atime_supported)
@@ -170,7 +170,7 @@ test_lutimens (int (*func) (char const *, struct timespec const *), bool print)
ts[0].tv_nsec = UTIME_OMIT;
ts[1].tv_sec = 0;
ts[1].tv_nsec = UTIME_NOW;
- nap ();
+ gnulib_nap ();
ASSERT (func (BASE "link", ts) == 0);
ASSERT (lstat (BASE "link", &st3) == 0);
if (atime_supported)
@@ -182,7 +182,7 @@ test_lutimens (int (*func) (char const *, struct timespec const *), bool print)
ASSERT (utimecmp (BASE "link", &st1, &st3, 0) <= 0);
if (check_ctime)
ASSERT (ctime_compare (&st2, &st3) < 0);
- nap ();
+ gnulib_nap ();
ts[0].tv_nsec = 0;
ts[1].tv_nsec = UTIME_OMIT;
ASSERT (func (BASE "link", ts) == 0);
diff --git a/tests/test-stat-time.c b/tests/test-stat-time.c
index 86d4346d9..09a3d0bb1 100644
--- a/tests/test-stat-time.c
+++ b/tests/test-stat-time.c
@@ -30,7 +30,7 @@
#include "macros.h"
#define BASE "test-stat-time.t"
-#include "nap.h"
+#include "gnulib_nap.h"
enum { NFILES = 4 };
@@ -110,13 +110,13 @@ prepare_test (struct stat *statinfo, struct timespec *modtimes)
int i;
create_file (filename_stamp1);
- nap ();
+ gnulib_nap ();
create_file (filename_testfile);
- nap ();
+ gnulib_nap ();
create_file (filename_stamp2);
- nap ();
+ gnulib_nap ();
ASSERT (chmod (filename_testfile, 0400) == 0);
- nap ();
+ gnulib_nap ();
create_file (filename_stamp3);
do_stat (filename_stamp1, &statinfo[0]);
diff --git a/tests/test-utime.c b/tests/test-utime.c
index 4cf583606..1ee3de6eb 100644
--- a/tests/test-utime.c
+++ b/tests/test-utime.c
@@ -38,7 +38,7 @@ test_utime (bool print)
ASSERT (close (creat (BASE "file", 0600)) == 0);
ASSERT (stat (BASE "file", &st1) == 0);
- nap ();
+ gnulib_nap ();
ASSERT (utime (BASE "file", NULL) == 0);
ASSERT (stat (BASE "file", &st2) == 0);
ASSERT (0 <= utimecmp (BASE "file", &st2, &st1, UTIMECMP_TRUNCATE_SOURCE));
@@ -56,7 +56,7 @@ test_utime (bool print)
ts.actime = ts.modtime = time (NULL);
ASSERT (utime (BASE "file", &ts) == 0);
ASSERT (stat (BASE "file", &st1) == 0);
- nap ();
+ gnulib_nap ();
}
/* Invalid arguments. */
diff --git a/tests/test-utimens-common.h b/tests/test-utimens-common.h
index e92362085..1df1fe7b7 100644
--- a/tests/test-utimens-common.h
+++ b/tests/test-utimens-common.h
@@ -31,7 +31,7 @@
# include "utimecmp.h"
/* Gnulib test header. */
-# include "nap.h"
+# include "gnulib_nap.h"
enum {
BILLION = 1000 * 1000 * 1000,
diff --git a/tests/test-utimens.h b/tests/test-utimens.h
index a05b232a8..10aef0892 100644
--- a/tests/test-utimens.h
+++ b/tests/test-utimens.h
@@ -33,7 +33,7 @@ test_utimens (int (*func) (char const *, struct timespec const *), bool print)
UTIMECMP_TRUNCATE_SOURCE to compensate, with st1 as the
source. */
ASSERT (stat (BASE "file", &st1) == 0);
- nap ();
+ gnulib_nap ();
ASSERT (func (BASE "file", NULL) == 0);
ASSERT (stat (BASE "file", &st2) == 0);
ASSERT (0 <= utimecmp (BASE "file", &st2, &st1, UTIMECMP_TRUNCATE_SOURCE));
@@ -52,7 +52,7 @@ test_utimens (int (*func) (char const *, struct timespec const *), bool print)
ts[1] = ts[0];
ASSERT (func (BASE "file", ts) == 0);
ASSERT (stat (BASE "file", &st1) == 0);
- nap ();
+ gnulib_nap ();
}
/* Invalid arguments. */
@@ -126,7 +126,7 @@ test_utimens (int (*func) (char const *, struct timespec const *), bool print)
ts[0].tv_nsec = UTIME_OMIT;
ts[1].tv_sec = 0;
ts[1].tv_nsec = UTIME_NOW;
- nap ();
+ gnulib_nap ();
ASSERT (func (BASE "file", ts) == 0);
ASSERT (stat (BASE "file", &st3) == 0);
ASSERT (st3.st_atime == Y2K);
@@ -136,7 +136,7 @@ test_utimens (int (*func) (char const *, struct timespec const *), bool print)
ASSERT (0 <= utimecmp (BASE "file", &st3, &st1, UTIMECMP_TRUNCATE_SOURCE));
if (check_ctime)
ASSERT (ctime_compare (&st2, &st3) < 0);
- nap ();
+ gnulib_nap ();
ts[0].tv_nsec = 0;
ts[1].tv_nsec = UTIME_OMIT;
ASSERT (func (BASE "file", ts) == 0);
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: nap() name space clash
2020-09-24 5:33 ` Tim Rice
@ 2020-10-11 18:55 ` Bruno Haible
0 siblings, 0 replies; 7+ messages in thread
From: Bruno Haible @ 2020-10-11 18:55 UTC (permalink / raw)
To: Tim Rice; +Cc: bug-gnulib
Hi Tim,
> I've prepared 2 patch options for your consideration.
>
> The attached nap2gnulib_nap.patch renames nap to gnulib_nap and leaves
> the tests/nap.h name alone.
>
> The attached nap2gnulib_nap_with_nap_h_rename.patch assumes a
> "git mv tests/nap.h tests/gnulib_nap.h"
It smells too much of a workaround. I would prefer
(a) either a rename like in your second patch, with a symbol name
that looks clean (e.g. 'short_sleep' instead of 'gnulib_nap'),
(b) or a workaround that is limited in scope: few lines of code, and
no effect on other platforms.
> > } > > In which .h file is this function declared on UnixWare?
> > } >
> > } > unistd.h
Since the function defined by tests/nap.h is of storage class 'static',
there is no conflict at the linker level, and the conflict at the source
code level can be resolved by a simple '#define'.
So I'm picking the approach (b).
2020-10-11 Bruno Haible <bruno@clisp.org>
tests: Avoid a name clash on UnixWare.
Reported by Tim Rice <tim@multitalents.net> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-02/msg00025.html>.
* tests/nap.h (nap): Define as gl_nap on OpenServer and UnixWare.
diff --git a/tests/nap.h b/tests/nap.h
index 5dd264f..c27e538 100644
--- a/tests/nap.h
+++ b/tests/nap.h
@@ -24,6 +24,13 @@
# include <intprops.h>
+/* Avoid a conflict with a function called nap() on UnixWare. */
+# if defined _SCO_DS || (defined __SCO_VERSION__ || defined __sysv5__) /* OpenServer, UnixWare */
+# include <unistd.h>
+# undef nap
+# define nap gl_nap
+# endif
+
/* Name of the witness file. */
#define TEMPFILE BASE "nap.tmp"
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-10-11 18:55 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04 5:34 nap() name space clash Tim Rice
2020-02-04 10:47 ` Bruno Haible
2020-02-04 17:02 ` Tim Rice
2020-02-05 2:03 ` Bruno Haible
2020-02-06 23:37 ` Tim Rice
2020-09-24 5:33 ` Tim Rice
2020-10-11 18:55 ` Bruno Haible
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 read-only IMAP folder(s) and NNTP newsgroup(s).