[Tcsh] tcsh-6.24.08 and DragonFlyBSD 6.4.0

Luke Mewburn luke at mewburn.net
Wed Apr 12 08:48:09 UTC 2023


[resent to the tcsh list from my subscribed email address]

Hi Nelson,

Responses in line below.


On 23-04-10 15:16, Nelson H. F. Beebe wrote:
  | The test build of tcsh-6.24.08 on DragonFlyBSD 6.4.0 (the latest release
  | of that O/S) failed like this:
  | 
  | 	/usr/bin/cc -c -I/usr/uumath/include -I/usr/local/include -I/usr/uumath/include \
  | 	    -I. -I. -D_PATH_TCSHELL='"/usr/uumath/bin/tcsh"' \
  | 	    -I/usr/uumath/include -I/usr/local/include  tc.alloc.c
  | 	tc.alloc.c:462:8: error: conflicting types for 'malloc_usable_size'
  | 	 size_t malloc_usable_size(M_U_S_CONST void *);
  | 		^~~~~~~~~~~~~~~~~~
  | 	In file included from /usr/include/stdlib.h:43,
  | 			 from sh.h:335,
  | 			 from tc.alloc.c:40:
  | 	/usr/include/malloc_np.h:36:8: note: previous declaration of 'malloc_usable_size' was here
  | 	 size_t malloc_usable_size(const void *);
  | 		^~~~~~~~~~~~~~~~~~
  | 	tc.alloc.c:464:1: error: conflicting types for 'malloc_usable_size'
  | 	 malloc_usable_size(M_U_S_CONST void *ptr)
  | 	 ^~~~~~~~~~~~~~~~~~
  | 	In file included from /usr/include/stdlib.h:43,
  | 			 from sh.h:335,
  | 			 from tc.alloc.c:40:
  | 	/usr/include/malloc_np.h:36:8: note: previous declaration of 'malloc_usable_size' was here
  | 	 size_t malloc_usable_size(const void *);
  | 		^~~~~~~~~~~~~~~~~~
  | 
  | Indeed, I find these patterns:
  | 
  | 	%  grep M_U_S_CONST *.c
  | 	tc.alloc.c:#define M_U_S_CONST
  | 	tc.alloc.c:#define M_U_S_CONST
  | 	tc.alloc.c:size_t malloc_usable_size(M_U_S_CONST void *);
  | 	tc.alloc.c:malloc_usable_size(M_U_S_CONST void *ptr)
  | 
  | 	%  grep  malloc_usable_size /usr/include/malloc_np.h
  | 	size_t malloc_usable_size(const void *);
  | 
  | One possible solution is to rename the tcsh version of the conflicting
  | function to something unique to tcsh, but I leave that up to the tcsh
  | team.
  | 
  | As an experiment, I ran
  | 
  | 	% sed -i s/malloc_usable_size/tcsh_malloc_usable_size/g tc.alloc.c
  | 	% make all check


I don't think that this is the long term solution. Looking at the source
for tc.alloc.c, the comments for the function malloc_usable_size()
indicate that malloc_usable_size() is being provided as a compat API
when tcsh is providing its own malloc replacement.

I think the issue is probably more this:
	#ifdef __linux__
	#define M_U_S_CONST
	#else
	#define M_U_S_CONST
	#endif

I suspect that if you change the #else part to  #define M_U_S_CONST const
i.e.,
	@@ -457,7 +457,7 @@ realloc(ptr_t cp, size_t nbytes)
	 #ifdef __linux__
	 #define M_U_S_CONST
	 #else
	-#define M_U_S_CONST
	+#define M_U_S_CONST const
	 #endif
	 size_t malloc_usable_size(M_U_S_CONST void *);
	 size_t

that the problem will be resolved, but I don't have access to a DragonFlyBSD
system to confirm on.

This appears to be a problem introduced in commit 78410ed on 2011-12-30,
which was the same day as the commit that introduced malloc_usable_size().



  | That was successful, and the checks reporte
  | 
  | 	# ------------- ##
  | 	## Test results. ##
  | 	## ------------- ##
  | 
  | 	195 tests were successful.
  | 	53 tests were skipped.
  | 
  | That is the ONLY one of 105 builds today that experienced no test
  | failures.  It was also the only one that I did interactively, instead
  | of in batch mode: perhaps that is the difference.
  | 
  | To test that conjecture, I visited the build directory on two systems,
  | Ubuntu 20.04 and NetBSD 10.0.  On the former, an interactive "make
  | check" reported all tests passing, but on the latter, there were still
  | two failures:
  | 
  | 	 49: filetest             FAILED (commands.at:503)
  | 	112: Primary expressions  FAILED (expr.at:106)
  | 
  | The "117: Comments" and "181: $ edit" tests now pass, but did not in
  | the batch builds.


Without seeing more context from testsuite.log and knowing more about your
batch build environment, it's hard to know the exact problem.
Both of those tests involve running the test -x (test executable) behaviour:

commands.at

 491 touch file1 file2 'b{c'
 492 chmod 6777 file1
 493 chmod 000 file2
...
 503 AT_CHECK([tcsh -f -c 'filetest -x file1 file2'], ,
 504 [1 0
 505 ])

expr.at

 96 touch file1 file2
 97 chmod 6777 file1
 98 chmod 000 file2
...
106 AT_CHECK([tcsh -f -c 'exit ( -x file1 )'], 1)
107 AT_CHECK([tcsh -f -c 'exit ( -x file2 )'], 0)

This suggests that maybe your build environment doesn't allow the
chmod 6777 of file1 ? E.g., nosuid or nosgid on the mount point?

If that's the case, we'll need to adjust the testsuite to not
assume that we can chmod 4000 or chmod 2000.

BTW: my concerns about setuid and setgid in the testsuite is why my
commit 5a1e9b8 on 2023-03-13 which added LS_COLORS support for
colorizing setuid & setgid files has the commit log comment:
	Add testsuite for all except su and sg, because creating test
	entries for those may not always be supported.


regards,
Luke.


More information about the Tcsh mailing list