3.0alpha24: make bug (or more...)

David Lee t.d.lee at durham.ac.uk
Fri May 16 14:02:31 GMT 2003


On Fri, 16 May 2003, Andrew Bartlett wrote:

> Send me a new patch (without special references to build_options.c on
> the proto line) and I'll think about it again.

OK.  Herewith the latest attempt.  It seems to cure the problem of writing
back into the "source" subtree.  Test it and see, but note that a the case
of "srcdir != builddir" may also require the trivial patch in bugzilla 83.

The comment lines starting "#TDL#" are solely to give an inline running
commentary on this patch while we discuss it.  These lines should be
removed (or at least amended) before application into CVS.

Also remember that, as things stand, "script/mkproto.sh" is to be renamed
"script/mkproto.sh.in".  The commentary suggests an alternative with the
advantage of not requiring such a rename, but the disadvantage of
requiring an extra compulsory argument (about which there would be
argument!) in its calling.

========================== snip ==========================
--- Makefile.in.bugzilla-83	Thu May 15 10:40:13 2003
+++ Makefile.in	Fri May 16 14:28:11 2003
@@ -318,6 +318,10 @@

 SMBD_OBJ_MAIN = smbd/server.o

+#TDL# SMBD_OBJ_SRV is used by both SMBD_OBJ_BASE and PROTO_OBJ.
+#TDL# The inclusion hitherto of smbd/build_options.o caused problems
+#TDL# building proto.h (the PROTO_OBJ) uses.
+#TDL# So migrate it from SMBD_OBJ_SRV into SMBD_OBJ_BASE
 SMBD_OBJ_SRV = smbd/files.o smbd/chgpasswd.o smbd/connection.o \
 	       smbd/utmp.o smbd/session.o \
                smbd/dfree.o smbd/dir.o smbd/password.o smbd/conn.o smbd/fileio.o \
@@ -330,12 +334,14 @@
                smbd/posix_acls.o lib/sysacls.o lib/server_mutex.o \
 	       smbd/process.o smbd/service.o smbd/error.o \
 	       printing/printfsp.o lib/util_seaccess.o \
-               smbd/build_options.o lib/sysquotas.o \
+               lib/sysquotas.o \
 	       smbd/change_trust_pw.o smbd/fake_file.o \
 	       smbd/quotas.o smbd/ntquotas.o \
 	       $(MANGLE_OBJ) @VFS_STATIC@

-SMBD_OBJ_BASE = $(PARAM_OBJ) $(SMBD_OBJ_SRV) $(MSDFS_OBJ) $(LIBSMB_OBJ) \
+#TDL# Because smbd/build_options.o is no longer in SMBD_OBJ_SRV
+#TDL# it needs to be explicitly re-included in SMBD_OBJ_BASE.
+SMBD_OBJ_BASE = $(PARAM_OBJ) $(SMBD_OBJ_SRV) smbd/build_options.o $(MSDFS_OBJ) $(LIBSMB_OBJ) \
 		$(RPC_SERVER_OBJ) $(RPC_PARSE_OBJ) $(SECRETS_OBJ) $(UBIQX_OBJ) \
 		$(LOCKING_OBJ) $(PASSDB_OBJ) $(PRINTING_OBJ) $(PROFILE_OBJ) \
 		$(LIB_OBJ) $(PRINTBACKEND_OBJ) $(OPLOCK_OBJ) \
@@ -608,6 +614,19 @@

 NTLM_AUTH_OBJ = utils/ntlm_auth.o $(LIBSAMBA_OBJ) $(POPT_LIB_OBJ)

+#TDL# The purpose of "mkproto.sh" is to construct the "proto.h" family of files.
+#TDL# What it REALLY needs to be given is the names of the ".c" files.
+#TDL# But hitherto it had been given ".o" names, which it then had to back-translate
+#TDL# into (assumed) ".c" files.  This was poor.
+#TDL#
+#TDL# So this patch migrates the naming details back here, into the Makefile,
+#TDL# where it belongs and where the necessary information about "srcdir"
+#TDL# and "builddir" is readily available.
+#TDL#
+
+# Location of mkproto.sh
+MKPROTO_SH = $(builddir)/script/mkproto.sh
+
 ######################################################################
 # now the rules...
 ######################################################################
@@ -1250,39 +1269,45 @@

 include/proto.h: smbd/build_options.c
 	@echo Building include/proto.h
-	@cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \
+	@$(SHELL) $(MKPROTO_SH) $(AWK) \
 	  -h _PROTO_H_ $(builddir)/include/proto.h \
-	  $(PROTO_OBJ)
+	  `echo $(PROTO_OBJ) $(builddir)/smbd/build_options.c | tr ' ' '\n' \
+	    | sed -e 's,^\(.*\)\.o,$(srcdir)/\1\.c,g'`

 include/build_env.h: script/build_env.sh
 	@echo Building include/build_env.h
-	@cd $(srcdir) && $(SHELL) script/build_env.sh $(srcdir) $(builddir) $(CC) > $(builddir)/include/build_env.h
+	@$(SHELL) $(srcdir)/script/build_env.sh $(srcdir) $(builddir) $(CC) > $(builddir)/include/build_env.h

 include/wrepld_proto.h:
 	@echo Building include/wrepld_proto.h
-	@cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \
+	@$(SHELL) $(MKPROTO_SH) $(AWK) \
 	  -h _WREPLD_PROTO_H_ $(builddir)/include/wrepld_proto.h \
-	  $(WREPL_OBJ1)
+	  `echo $(WREPL_OBJ1) | tr ' ' '\n' \
+	    | sed -e 's,^\(.*\)\.o,$(srcdir)/\1\.c,g'`

 nsswitch/winbindd_proto.h:
-	@cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \
-	  -h _WINBINDD_PROTO_H_ nsswitch/winbindd_proto.h \
-	  $(WINBINDD_OBJ1)
+	@$(SHELL) $(MKPROTO_SH) $(AWK) \
+	  -h _WINBINDD_PROTO_H_ $(builddir)/nsswitch/winbindd_proto.h \
+	  `echo $(WINBINDD_OBJ1) | tr ' ' '\n' \
+	    | sed -e 's,^\(.*\)\.o,$(srcdir)/\1\.c,g'`

 web/swat_proto.h:
-	@cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \
-	  -h _SWAT_PROTO_H_ web/swat_proto.h \
-	  $(SWAT_OBJ1)
+	@$(SHELL) $(MKPROTO_SH) $(AWK) \
+	  -h _SWAT_PROTO_H_ $(builddir)/web/swat_proto.h \
+	  `echo $(SWAT_OBJ1) | tr ' ' '\n' \
+	    | sed -e 's,^\(.*\)\.o,$(srcdir)/\1\.c,g'`

 client/client_proto.h:
-	@cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \
-	  -h _CLIENT_PROTO_H_ client/client_proto.h \
-	  $(CLIENT_OBJ1)
+	@$(SHELL) $(MKPROTO_SH) $(AWK) \
+	  -h _CLIENT_PROTO_H_ $(builddir)/client/client_proto.h \
+	  `echo $(CLIENT_OBJ1) | tr ' ' '\n' \
+	    | sed -e 's,^\(.*\)\.o,$(srcdir)/\1\.c,g'`

 utils/net_proto.h:
-	@cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \
-	  -h _CLIENT_PROTO_H_ utils/net_proto.h \
-	  $(NET_OBJ1)
+	@$(SHELL) $(MKPROTO_SH) $(AWK) \
+	  -h _CLIENT_PROTO_H_ $(builddir)/utils/net_proto.h \
+	  `echo $(NET_OBJ1) | tr ' ' '\n' \
+	    | sed -e 's,^\(.*\)\.o,$(srcdir)/\1\.c,g'`

 # "make headers" or "make proto" calls a subshell because we need to
 # make sure these commands are executed in sequence even for a
--- script/mkproto.sh.orig	Mon Jul 29 13:51:31 2002
+++ script/mkproto.sh.in	Fri May 16 14:35:08 2003
@@ -4,6 +4,13 @@
 LC_ALL=C; export LC_ALL
 LC_COLLATE=C; export LC_COLLATE

+# Need reference point for "mkproto.awk", including when "srcdir != builddir".
+abs_srcdir=@abs_srcdir@
+#TDL# Use of absolute "abs_..." above is not ideal.
+#TDL# A possible, cleaner alternative might be to pass its location into
+#TDL# here as an argument (compulsory, not optional).  make/autoconf would
+#TDL# be able do so in the preferable relative manner (its "$(srcdir)/script").
+
 if [ $# -lt 3 ]
 then
   echo "Usage: $0 awk [-h headerdefine] outputheader proto_obj"
@@ -25,14 +32,14 @@
 shift
 headertmp="$header.$$.tmp~"

-proto_src="`echo $@ | tr ' ' '\n' | sed -e 's/\.o/\.c/g' | sort | uniq | egrep -v 'ubiqx/|wrapped'`"
+proto_src="`echo $@ | tr ' ' '\n' | sort | uniq | egrep -v 'ubiqx/|wrapped'`"

 echo creating $header

 mkdir -p `dirname $header`

 ${awk} $headeropt \
-  -f script/mkproto.awk $proto_src > $headertmp
+  -f $abs_srcdir/mkproto.awk $proto_src > $headertmp

 if cmp -s $header $headertmp 2>/dev/null
 then
--- configure.in.orig	Wed May 14 19:56:18 2003
+++ configure.in	Thu May 15 18:09:17 2003
@@ -3757,7 +3757,7 @@
 CFLAGS_REMOVE_USR_INCLUDE(CFLAGS)
 CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS)

-AC_OUTPUT(include/stamp-h Makefile script/findsmb)
+AC_OUTPUT(include/stamp-h Makefile script/findsmb script/mkproto.sh)

 #################################################
 # Print very concise instructions on building/use
--- nsswitch/winbindd.h.orig	Wed May 14 19:56:26 2003
+++ nsswitch/winbindd.h	Thu May 15 19:28:04 2003
@@ -219,7 +219,7 @@
   void (*status)(void);
 };

-#include "winbindd_proto.h"
+#include "../nsswitch/winbindd_proto.h"

 #include "rpc_parse.h"
 #include "rpc_client.h"
========================== snip ==========================


Note that "build_options.c" was already present in the alpha24 Makefile.
In principle, that was right and proper.  The failure was in the
surrounding structure (not "build_options.c" reference itself) which
was failing to conform to the GNU srcdir/builddir separation.

That is "build_options.c" was the correct thing, which was being
undermined by another, more systematic, fault.

Hope this brings us towards closure.

Best wishes.


-- 

:  David Lee                                I.T. Service          :
:  Systems Programmer                       Computer Centre       :
:                                           University of Durham  :
:  http://www.dur.ac.uk/t.d.lee/            South Road            :
:                                           Durham                :
:  Phone: +44 191 334 2752                  U.K.                  :



More information about the samba-technical mailing list