This file is indexed.

/usr/share/slsh/stkcheck.sl is in slsh 2.3.0-2ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
% Copyright (C) 2012-2014 John E. Davis
%
% This file is part of the S-Lang Library and may be distributed under the
% terms of the GNU General Public License.  See the file COPYING for
% more information.
%---------------------------------------------------------------------------
% This file adds BOS/EOS hooks to the interpreter to help debug stack problems.
% To use it, put the following at the top of a problematic file:
%
%   require ("stkcheck");
%   enable_stack_check ();
%
% To check only portions of a file, surround the suspect functions by:
%
%   enable_stack_check ();
%      .
%      .
%   disable_stack_check ();
%
_boseos_info = 0;
private variable Stack = Struct_Type[512];
private variable Stack_Depth = 0;

private variable Output_Hook = NULL;
private variable Output_Hook_Args = NULL;

define stkcheck_set_output_hook ()
{
   if (_NARGS == 0)
     {
	Output_Hook = NULL;
	Output_Hook_Args = NULL;
	return;
     }

   Output_Hook_Args = __pop_list (_NARGS-1);
   Output_Hook = ();
}

private define output ()
{
   variable args = __pop_list (_NARGS);
   variable str = sprintf (__push_list (args));

   if (Output_Hook != NULL)
     return (@Output_Hook)(__push_list (Output_Hook_Args), str);

   () = fprintf (stderr, __push_list (args));
}

private define bos_handler (file, line)
{
   if (Stack_Depth >= length (Stack))
     throw StackOverflowError, "BOS stack overflow";

   variable s = struct
     {
	file, line, depth
     };
   s.file = file;
   s.line = line;
   s.depth = _stkdepth ();
   Stack[Stack_Depth] = s;
   Stack_Depth++;
}

private define eos_handler ()
{
   if (Stack_Depth <= 0)
     return;
     %throw StackUnderflowError, "BOS stack depth underflow";
   Stack_Depth--;
   variable s = Stack[Stack_Depth];
   variable depth = _stkdepth ();
   if (depth != s.depth)
     {
	if (depth < s.depth)
	  ;
	else
	  {
	     output ("%s:%d: %d object(s) left on the stack\n", s.file, s.line, depth-s.depth);
	     if ((s.file == "***string***") && (Stack_Depth > 0))
	       {
		  s = Stack[Stack_Depth-1];
		  output (" called from %s:%d\n", s.file, s.line);
	       }
	  }
     }
}

define enable_stack_check ()
{
   ()=_set_bos_handler (&bos_handler);
   ()=_set_eos_handler (&eos_handler);
   Stack_Depth = 0;
   _boseos_info = 1;
}

define disable_stack_check ()
{
   ()=_set_bos_handler (NULL);
   ()=_set_eos_handler (NULL);
   Stack_Depth = 0;
   _boseos_info = 0;
}

#ifexists _jed_version
private define output_to_buffer (buf, str)
{
   variable cbuf = whatbuf ();
   setbuf (buf);
   insert (str);
   setbuf (cbuf);
}
if (BATCH == 0) stkcheck_set_output_hook (&output_to_buffer, "*traceback*");
#endif

provide ("stkcheck");