This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH v2 1/7] common: add scoped_fd


Hello Yao, Eli,

> > How about checking for mkstemp and, if not available, falling back to tmpnam.
> 
> Can we unconditionally use tmpnam+open which are more portable?  I know it is
> racy, but mkstemp is only used in a test case.  It is overkill to me to do the configure
> check or import gnulib module.
> 
> If we use mkstemp in gdb source (not test case) one day in the future, I prefer
> importing gnulib module.  What do you think?

I'd rather not use tmpnam.  This is really only a fallback for old systems.


I added mkstemp to update-gnulib.sh ...
 
---
diff --git a/gdb/gnulib/update-gnulib.sh b/gdb/gnulib/update-gnulib.sh
index 55cd6e0..d026536 100755
--- a/gdb/gnulib/update-gnulib.sh
+++ b/gdb/gnulib/update-gnulib.sh
@@ -59,6 +59,7 @@ IMPORTED_GNULIB_MODULES="\
     update-copyright \
     wchar \
     wctype-h \
+    mkstemp \
 "
 
 # The gnulib commit ID to use for the update.
---

... cloned gnulib, updated my automake, ran that script, and ended up with:

#       modified:   gdb/gnulib/aclocal.m4
#       modified:   gdb/gnulib/config.in
#       modified:   gdb/gnulib/configure
#       modified:   gdb/gnulib/import/Makefile.am
#       modified:   gdb/gnulib/import/Makefile.in
#       modified:   gdb/gnulib/import/m4/gnulib-cache.m4
#       modified:   gdb/gnulib/import/m4/gnulib-comp.m4
#       new file:   gdb/gnulib/import/m4/mkstemp.m4
#       new file:   gdb/gnulib/import/m4/secure_getenv.m4
#       new file:   gdb/gnulib/import/m4/tempname.m4
#       new file:   gdb/gnulib/import/mkstemp.c
#       new file:   gdb/gnulib/import/secure_getenv.c
#       new file:   gdb/gnulib/import/tempname.c
#       new file:   gdb/gnulib/import/tempname.h
#       modified:   gdb/gnulib/update-gnulib.sh


If I did everything correctly, it looks like gnulib would only provide mkstemp as a fall-back.  On
my system, it would still use the glibc version.  Good.  I wouldn't want to replace a standard
glibc function.

I have not tried building GDB with mingw cross tools, yet.  Would you be able to test whether
this solves your build problem, Yao?

thanks,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]