chiark / gitweb /
changelog: finalise 1.3.5 master
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 23 Dec 2021 13:27:05 +0000 (13:27 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 23 Dec 2021 13:27:05 +0000 (13:27 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
40 files changed:
.gitignore
Makefile
adns/adns.c
base/Makefile
base/extension.make
base/tcmdifgen
crypto/crypto.c
debian/changelog
debian/compat
debian/regenerate-autopkgtests [new file with mode: 0755]
debian/rules
debian/tests/adns--8.5 [new file with mode: 0755]
debian/tests/adns--8.6 [new file with mode: 0755]
debian/tests/adns--8.7 [new file with mode: 0755]
debian/tests/adns--def [new file with mode: 0755]
debian/tests/cdb--8.5 [new file with mode: 0755]
debian/tests/cdb--8.6 [new file with mode: 0755]
debian/tests/cdb--8.7 [new file with mode: 0755]
debian/tests/cdb--def [new file with mode: 0755]
debian/tests/control [new file with mode: 0644]
debian/tests/crypto--8.5 [new file with mode: 0755]
debian/tests/crypto--8.6 [new file with mode: 0755]
debian/tests/crypto--8.7 [new file with mode: 0755]
debian/tests/crypto--def [new file with mode: 0755]
debian/tests/dgram--8.5 [new file with mode: 0755]
debian/tests/dgram--8.6 [new file with mode: 0755]
debian/tests/dgram--8.7 [new file with mode: 0755]
debian/tests/dgram--def [new file with mode: 0755]
debian/tests/hbytes--8.5 [new file with mode: 0755]
debian/tests/hbytes--8.6 [new file with mode: 0755]
debian/tests/hbytes--8.7 [new file with mode: 0755]
debian/tests/hbytes--def [new file with mode: 0755]
debian/tests/tuntap--8.5 [new file with mode: 0755]
debian/tests/tuntap--8.6 [new file with mode: 0755]
debian/tests/tuntap--8.7 [new file with mode: 0755]
debian/tests/tuntap--def [new file with mode: 0755]
dgram/dgram.c
dgram/dgram.tct
dgram/runtest.tcl [new file with mode: 0644]
hbytes/hbytes.h

index 29e8596ba844eede1106564e3469878fd69e2895..99ee608d3cfd78d16b5be18a1b36bdc604777b14 100644 (file)
@@ -2,7 +2,8 @@
 *.o
 *.so
 *.d
-*.test.tcl
+test-load.tcl
+debian-substvars
 *+tcmdif.[ch]
 debian/files
 debian/libtcl-chiark-1
index 74fc544ad13fa7a8feb90bf7288f6ff5b7803427..77e9e48b1116be7fc79f2a7e63d6c929ecaf3021 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ endif
 
 default: all
 
-clean all:
+clean all debian-substvars:
        set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
 
 # To find undefined symbols when implementing, for example:
index 7dde69cfc2782b1ff039160c1e827ef49f130bd6..d0ee2955b94e09e26c36acde087faf81212173fd 100644 (file)
@@ -494,7 +494,7 @@ static int query_submit(Tcl_Interp *ip,
   
   if (op.reverseany || (op.sflags & oisf_reverse)) {
     const int *af;
-    for (af=aftry; af < af + sizeof(af)/sizeof(*af); af++) {
+    for (af=aftry; af < af + sizeof(aftry)/sizeof(*aftry); af++) {
       memset(&sa,0,sizeof(sa));
       sa.sa_family= *af;
       r= inet_pton(*af,domain,&sa);
index 1bbfd21c82ec28d35a30384cf706995484a2d0b6..30c4f8faa43516139367dba10ba1092f97c5c6fd 100644 (file)
@@ -28,5 +28,7 @@ SHLIB =               $(BASE_SHLIB)
 base+tcmdif.h: $(BASE_TCT) $(TCMDIFGEN)
                $(TCMDIFGEN) -wh -o$@ $<
 
+debian-substvars: all
+
 include shlib.make
 include final.make
index 0d63e4fc80f1b71cb40633b7cdb39fbb5e78b064..80239921c95053cd35337566800680ce6d48dcef 100644 (file)
@@ -41,18 +41,22 @@ TCMDIFARGS ?=       -p$(FAMILY)_$(EXTBASE) -o$@ $(BASE_TCT) $(OTHER_TCTS) $<
 %+tcmdif.h:    %.tct $(BASE_TCT) $(OTHER_TCTS) $(TCMDIFGEN)
                $(TCMDIFGEN) -wh $(TCMDIFARGS)
 
-OTHER_DIRS +=  ../base/
+OTHER_DIRS +=  $(BASE_DIR)
 OTHER_DIRS +=  $(addprefix ../,$(dir $(OTHER_EXTS)))
 OTHER_DIRS +=  .
 
 null :=
 space := $(null) #
 
-$(SHLIB).test.tcl:
+test-load.tcl:
                echo >$@ "load $(SHLIB).so"
 
-test-load:     $(SHLIB).so $(SHLIB).test.tcl
+test-load:     $(SHLIB).so test-load.tcl
                @set -x; LD_LIBRARY_PATH=$(subst $(space),:,$(strip $(OTHER_DIRS)))$${LD_LIBRARY_PATH+:}$${LD_LIBRARY_PATH} \
-               tclsh$(TCL_VERSION) $(SHLIB).test.tcl
+               tclsh$(TCL_VERSION) test-load.tcl
+
+debian-substvars: all
+               set -e; d=`pwd`; cd ..; \
+               dpkg-shlibdeps -T"$$d"/$@ "$$d"/$(SHLIB).so
 
 include                $(BASE_DIR)/final.make
index f94479994410c8a3ee608bb41ea7d584354d6dce..6ce038a315c9c10422d0baee7a71299c2a8ab263 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
 
 # code generator to help with writing Tcl extensions
 # Copyright 2006-2012 Ian Jackson
 #  and the two predefined types `int' (C `int') and `obj' (Tcl_Obj*,
 #  unmodified.)  The corresponding definitions are in tcmdiflib.c.
 
-use IO;
+use strict;
+use IO::File;
 use Data::Dumper;
 
+our (%o, $oh);
+our ($prefix, $write, $output);
+our (%tables, %table_x, %entrytype_x);
+our (%types, %type_init, %type_fini);
+
+sub parse ($$);
+sub subst_in_decl ($$;$);
+sub subst_in ($$;$);
+sub o ($$$);
+sub make_decl ($$$;$);
+sub make_decl_init ($$$$;$);
+
 parse('builtins','DATA');
 
 while (@ARGV) {
@@ -169,13 +182,16 @@ while (@ARGV) {
        die "unknown option $_\n";
     } else {
        if (!defined $prefix) { $prefix= $_;  $prefix =~ s/\.[^.]+$//; }
-       $x= new IO::File $_,'r' or die "$_: $!\n";
+       my $x= new IO::File $_,'r' or die "$_: $!\n";
        parse($_,$x);
     }
 }
 
 die "must say -w<something>\n" if !defined $write;
 
+our ($c_entry, $c_entrytype);
+our ($c_table, $c_entryextra, $c_of);
+
 sub zilch () {
     undef $c_table;
     undef $c_entryextra;
@@ -195,6 +211,7 @@ sub enumargs ($) {
 
 sub parse ($$) {
     my ($wh,$f) = @_;
+    my @i;
     while (defined($_= $f->getline)) {
        chomp; s/\s+$//;
        next if m/^\s*\#/;
@@ -202,7 +219,7 @@ sub parse ($$) {
        while (s/\t/ ' 'x(8 - (length $`) % 8) /e) { }
 
        s/^\s*//;
-       $this_indent= length $&;
+       my $this_indent= length $&;
        while (@i && $this_indent < $i[0]) {
            shift @i;
        }
@@ -250,18 +267,18 @@ sub parse ($$) {
                { N => 'subcmd', T => 'enum', A => $enumargs, O => '' };
        } elsif (@i==2 && m/^(\??)([a-z]\w*)\s*(\S.*)/
                 && defined $c_entry) {
-           ($opt, $var, $type) = ($1,$2,$3);
-           ($type, $xtypeargs) = split_type_args($type);
+           my ($opt, $var, $typea) = ($1,$2,$3);
+           my ($type, $xtypeargs) = split_type_args($wh,$typea);
            push @{ $tables{$c_table}{$c_entry}{A} },
                { N => $var, T => $type, A => $xtypeargs, O => ($opt eq '?') };
        } elsif (@i==2 && m/^\=\>\s*(\S.*)$/ && defined $c_entry) {
-           ($type, $xtypeargs) = split_type_args($1);
+           my ($type, $xtypeargs) = split_type_args($wh,$1);
            $tables{$c_table}{$c_entry}{R}= $type;
            $tables{$c_table}{$c_entry}{X}= $xtypeargs;
        } elsif (@i==0 && m/^Type\s+([^\:]+)\:\s+(\S.*)$/) {
-           ($typename,$ctype)= ($1,$2);
+           my ($typenamea,$ctype)= ($1,$2);
            $ctype .= ' @' unless $ctype =~ m/\@/;
-           ($typename,$xtypeargs) = split_type_args($typename);
+           my ($typename,$xtypeargs) = split_type_args($wh,$typenamea);
            $types{$typename}= { C => $ctype, X => $xtypeargs };
        } elsif (@i==0 && s/^Init\s+(\w+)\s+(\S.*)//) {
            $type_init{$1}= $2;
@@ -279,11 +296,11 @@ sub parse ($$) {
 #print Dumper(\%tables),"\n";
 #print Dumper(\%types),"\n";
 
-foreach $t (sort keys %types) {
-    $type= $types{$t};
-    $c= $type->{C};
-    $xta= $type->{X};
-    $decl= "int cht_pat_$t(Tcl_Interp *ip, Tcl_Obj *obj, ";
+foreach my $t (sort keys %types) {
+    my $type= $types{$t};
+    my $c= $type->{C};
+    my $xta= $type->{X};
+    my $decl= "int cht_pat_$t(Tcl_Interp *ip, Tcl_Obj *obj, ";
     $decl .= subst_in_decl('*val', $c, "type $t");
     $decl .= ", $xta",  if length $xta;
     $decl .= ");\n";
@@ -306,42 +323,44 @@ foreach $c_entrytype (sort keys %entrytype_x) {
       "};\n\n");
 }
 
+our (%dispatch_done);
+
 foreach $c_table (sort keys %tables) {
-    $r_table= $tables{$c_table};
-    $x_table= $table_x{$c_table};
-    $op_tab= '';
+    my $r_table= $tables{$c_table};
+    my $x_table= $table_x{$c_table};
+    my $op_tab= '';
 
     foreach $c_entry (sort keys %$r_table) {
-       $c_entry_c= $c_entry; $c_entry_c =~ y/-/_/;
-       $r_entry= $r_table->{$c_entry};
-       $pa_decl= "int pa_${c_table}_${c_entry_c}(ClientData cd,".
+       my $c_entry_c= $c_entry; $c_entry_c =~ y/-/_/;
+       my $r_entry= $r_table->{$c_entry};
+       my $pa_decl= "int pa_${c_table}_${c_entry_c}(ClientData cd,".
            " Tcl_Interp *ip, int objc, Tcl_Obj *const *objv)";
-       $pa_func= "cht_do_${c_table}_${c_entry_c}";
+       my $pa_func= "cht_do_${c_table}_${c_entry_c}";
        if (exists $r_entry->{D}) {
            $pa_func= "cht_dispatch_$r_entry->{D}";
        }
-       $do_decl= "int $pa_func(";
-       @do_al= ('ClientData cd', 'Tcl_Interp *ip');
-       @do_aa= qw(cd ip);
-       $pa_init= '';
-       $pa_argc= "  objc--; objv++;\n";
-       $pa_vars= "  int rc;\n";
-       $pa_body= '';
-       $pa_rslt= '';
-       $pa_free= '';
-       $pa_fini= '';
-       $any_mand= 0;
-       $any_optl= 0;
-       $any_eerr= 0;
-       $any_eargc= 0;
-       $pa_hint= '';
+       my $do_decl= "int $pa_func(";
+       my @do_al= ('ClientData cd', 'Tcl_Interp *ip');
+       my @do_aa= qw(cd ip);
+       my $pa_init= '';
+       my $pa_argc= "  objc--; objv++;\n";
+       my $pa_vars= "  int rc;\n";
+       my $pa_body= '';
+       my $pa_rslt= '';
+       my $pa_free= '';
+       my $pa_fini= '';
+       my $any_mand= 0;
+       my $any_optl= 0;
+       my $any_eerr= 0;
+       my $any_eargc= 0;
+       my $pa_hint= '';
        $pa_hint .= "$c_table " if length $c_table &&
            !length $table_x{$c_table}{T};
        $pa_hint.= $c_entry;
-       foreach $arg (@{ $r_entry->{A} }) {
-           $n= $arg->{N};
-           $t= $arg->{T};
-           $a= $arg->{A};
+       foreach my $arg (@{ $r_entry->{A} }) {
+           my $n= $arg->{N};
+           my $t= $arg->{T};
+           my $a= $arg->{A};
            push @do_al, make_decl($n, $t, $arg->{A},
                                   "table $c_table entry $c_entry arg $n");
            $pa_vars .= make_decl_init("a_$n", $t, $a, \$pa_init, "pa_vars");
@@ -360,13 +379,13 @@ foreach $c_table (sort keys %tables) {
                $any_eargc= 1;
                die if $any_optl;
            }
-           $paarg= "&a_$n";
-           $pafin= '';
+           my $paarg= "&a_$n";
+           my $pafin= '';
            if ($t eq 'enum') {
                $pa_vars .= "  const void *v_$n= 0;\n";
                $paarg= "&v_$n";
                $pafin= "\n  a_$n= v_$n; ";
-               ($a_tab, $ee_type, $estr) = enumargs($a);
+               my ($a_tab, $ee_type, $estr) = enumargs($a);
                $a = "cht_$a_tab, sizeof($ee_type), $estr";
                o('h', 210, "extern const $ee_type cht_$a_tab".'[]'.";\n");
            }
@@ -380,7 +399,7 @@ foreach $c_table (sort keys %tables) {
        }
        if (exists $r_entry->{V}) {
            $pa_hint .= " ...";
-           $va= $r_entry->{V};
+           my $va= $r_entry->{V};
            push @do_al, subst_in_decl("${va}c", 'int @');
            push @do_al, subst_in_decl("${va}v", 'Tcl_Obj *const *@');
            push @do_aa, "objc+1", "objv-1";
@@ -394,8 +413,8 @@ foreach $c_table (sort keys %tables) {
            $pa_body .= "end_optional:\n";
        }
        if (exists $r_entry->{R}) {
-           $t= $r_entry->{R};
-           $xta= $r_entry->{X};
+           my $t= $r_entry->{R};
+           my $xta= $r_entry->{X};
            push @do_al, make_decl("*result", $t, "cht_do_al result");
            $pa_vars .= make_decl_init("result", $t, $xta, \$pa_init,
                                       "pa_vars result");
@@ -431,6 +450,7 @@ foreach $c_table (sort keys %tables) {
        $pa_init .= "\n" if length $pa_init;
        $pa_fini .= "}\n\n";
 
+       my $static;
        if (length $c_table) {
            $static= 'static ';
        } else {
@@ -461,14 +481,13 @@ foreach $c_table (sort keys %tables) {
        } else {
            o('h',100, $do_decl.";\n") or die $!;
        }
-
        $op_tab .= sprintf("  { %-20s %-40s%s },\n",
                           "\"$c_entry\",",
                           "pa_${c_table}_${c_entry_c}",
-                          $r_entry->{I});
+                          ($r_entry->{I}) // '');
     }
     if (length $c_table) {
-       $decl= "const $x_table->{C} cht_${c_table}_entries[]";
+       my $decl= "const $x_table->{C} cht_${c_table}_entries[]";
        o('h', 500, "extern $decl;\n");
        o('c', 100,
          "$decl = {\n".
@@ -478,13 +497,13 @@ foreach $c_table (sort keys %tables) {
     }
 }
 
-o(c, 0, "#include \"$prefix.h\"\n");
+o('c', 0, "#include \"$prefix.h\"\n");
 
-o(h, 0,
+o('h', 0,
   "#ifndef INCLUDED_\U${prefix}_H\n".
   "#define INCLUDED_\U${prefix}_H\n\n");
 
-o(h, 999,
+o('h', 999,
   "#endif /*INCLUDED_\U${prefix}_H*/\n");
 
 if (defined $output) {
@@ -494,7 +513,7 @@ if (defined $output) {
 }
 
 print $oh "/* AUTOGENERATED - DO NOT EDIT */\n" or die $!;
-foreach $pr (sort keys %{ $o{$write} }) {
+foreach my $pr (sort keys %{ $o{$write} }) {
     print $oh "\n" or die $!;
     print $oh $o{$write}{$pr} or die $!;
 }
@@ -506,13 +525,13 @@ if (defined $output) {
     rename "$output.tmp", $output or die $!;
 }
 
-sub o ($$) {
+sub o ($$$) {
     my ($wh,$pr,$s) = @_;
     $o{$wh}{sprintf "%010d", $pr} .= $s;
 }
 
-sub split_type_args ($) {
-    my ($type) = @_;
+sub split_type_args ($$) {
+    my ($wh,$type) = @_;
     my ($xtypeargs);
     if ($type =~ m/^\w+$/) {
        $xtypeargs='';
@@ -525,7 +544,7 @@ sub split_type_args ($) {
     return ($type,$xtypeargs);
 }
 
-sub make_decl_init ($$$$$) {
+sub make_decl_init ($$$$;$) {
     my ($n, $t, $a, $initcode, $why) = @_;
     my ($o,$init);
     $o= make_decl($n,$t,$a,"$why _init");
@@ -539,11 +558,11 @@ sub make_decl_init ($$$$$) {
     return "  ".$o.";\n";
 }
 
-sub make_decl ($$$$) {
+sub make_decl ($$$;$) {
     my ($n, $t, $ta, $why) = @_;
-    my ($type);
+    my ($type, $c);
     if ($t eq 'enum') {
-       ($a_tab, $ee_type, $estr) = enumargs($ta);
+       my ($a_tab, $ee_type, $estr) = enumargs($ta);
        $c= "const $ee_type* @";
     } else { 
        defined $types{$t} or die "unknown type $t ($why)\n";
@@ -552,14 +571,14 @@ sub make_decl ($$$$) {
     return subst_in_decl($n,$c);
 }
 
-sub subst_in_decl ($$$) {
+sub subst_in_decl ($$;$) {
     my ($val, $pat, $why) = @_;
     local ($_) = subst_in($val, $pat, $why);
     s/ *(\**) *$/$1/;
     return $_;
 }
     
-sub subst_in ($$$) {
+sub subst_in ($$;$) {
     my ($val, $pat, $why) = @_;
     $pat =~ m/\@/ or die "$pat for $val in $why ?";
     $pat =~ s/\@/$val/g;
index aee2556de1fcde705642944110a78a5bdd6cd1de..6efea24f325ce5b7079087e5b64082b33c32ce39 100644 (file)
@@ -252,6 +252,14 @@ static int blockcipher_prep(Tcl_Interp *ip, Tcl_Obj *key_obj,
   int rc;
   CiphKeyValue *key;
 
+  /* placate gcc, see Debian #968734 */
+  *key_r= 0;
+  *sched_r= 0;
+  *iv_r= 0;
+  *iv_lenbytes_r= 0;
+  *buffers_r= 0;
+  *nblocks_r= 0;
+
   if (data_len % alg->blocksize)
     return cht_staticerr(ip, "block cipher input not whole number of blocks",
                     "HBYTES BLOCKCIPHER LENGTH");
index 91dbcfdced98f29bc173b721419d61df4adb00d9..70097b77143ef6596d16e0e2d2eda6aeb945ec75 100644 (file)
@@ -1,4 +1,66 @@
-chiark-tcl (1.1.4~~iwj) UNRELEASED; urgency=low
+chiark-tcl (1.3.5) unstable; urgency=medium
+
+  * blockcipher_prep: Initialise parameters to placate gcc.  Closes:#968734.
+  * debhelper: bump compat to 12.  Closes:#965452.
+
+ -- Ian Jackson <ijackson@chiark.greenend.org.uk>  Thu, 23 Dec 2021 13:26:53 +0000
+
+chiark-tcl (1.3.4) unstable; urgency=medium
+
+  * debian/tests/control: Update to libnettle8.  Fixes DEP-8 failure.
+    (Reran debian/rules debian/tests/control.)
+
+ -- Ian Jackson <ijackson@chiark.greenend.org.uk>  Mon, 17 Aug 2020 18:09:07 +0100
+
+chiark-tcl (1.3.3) unstable; urgency=medium
+
+  * hbytes.h: Add a missing `extern' on a data declaration.
+    Fixes GCC-10 FTBFS.  Closes:957087.
+
+ -- Ian Jackson <ijackson@chiark.greenend.org.uk>  Mon, 17 Aug 2020 14:03:47 +0100
+
+chiark-tcl (1.3.2) unstable; urgency=medium
+
+  * changelog: start 1.3.2
+  * testing: Add skip-not-installable restriction to vsn-specific tests
+  * testing: Add tcl 8.7 to list of versions for testing
+
+ -- Ian Jackson <ijackson@chiark.greenend.org.uk>  Sun, 14 Oct 2018 01:33:49 +0100
+
+chiark-tcl (1.3.1) unstable; urgency=medium
+
+  * autopkgtests: Drop tcl8.7 which is only in experimental now.
+
+ -- Ian Jackson <ijackson@chiark.greenend.org.uk>  Sun, 19 Aug 2018 12:16:24 +0100
+
+chiark-tcl (1.3.0) unstable; urgency=medium
+
+  adns:
+  * Fix IPv6 PTR (reverse) lookups, and compilation with GCC-8.
+    Closes:#891544.
+
+  dgram:
+  * Provide `dgram-socket sockname S'.  Closes:#865451.
+
+  tcmdifgen:
+  * Turn on warnings and `use strict' and fix everything.
+  * Replace deprecated `use IO;' with `use IO::File'.
+
+  Makefiles and build system:
+  * Provide autopkgtests.
+  * Refer to $(BASE_DIR) rather than ../base/, making out-of-tree
+    extentions a bit easier.
+
+ -- Ian Jackson <ijackson@chiark.greenend.org.uk>  Sun, 19 Aug 2018 00:21:18 +0100
+
+chiark-tcl (1.2.1) unstable; urgency=high
+
+  * Multiarch: Use correct M-A triplet (DEB_HOST_MULTIARCH) for
+    libsubdir.  Closes:#856526.
+
+ -- Ian Jackson <ijackson@chiark.greenend.org.uk>  Sun, 19 Mar 2017 09:22:48 +0000
+
+chiark-tcl (1.2.0) unstable; urgency=medium
 
   * wiringpi module.  Built only if the wiringpi headers are actually
     installed (so not in the official Debian release).
@@ -11,7 +73,7 @@ chiark-tcl (1.1.4~~iwj) UNRELEASED; urgency=low
   * Honour dpkg-architecture's DEB_HOST_GNU_TYPE, to fix cross-building.
   * Multiarch: Move .so's to triplet paths, and declare M-A: same.
 
- -- Ian Jackson <ijackson@chiark.greenend.org.uk>  Tue, 24 Jan 2017 13:14:06 +0000
+ -- Ian Jackson <ijackson@chiark.greenend.org.uk>  Tue, 24 Jan 2017 14:32:11 +0000
 
 chiark-tcl (1.1.3) unstable; urgency=low
 
index 7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69..48082f72f087ce7e6fa75b9c41d7387daecd447b 100644 (file)
@@ -1 +1 @@
-5
+12
diff --git a/debian/regenerate-autopkgtests b/debian/regenerate-autopkgtests
new file mode 100755 (executable)
index 0000000..dc465c3
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/bash
+set -e
+
+dt=debian/tests
+
+rm -rf $dt
+mkdir -p $dt
+
+exec 4>$dt/control.new
+
+for sv in */debian-substvars; do
+       d=${sv%/*}
+       if ! test -e "$sv"; then continue; fi
+       make -C "$d" test-load.tcl
+       printf "%s..." $d
+       for v in '' "$@"; do
+               vv=${v:-def}
+               t=$d--$vv
+               printf " %s" $vv
+               exec 3>$dt/$t
+               echo >&3 "#!/usr/bin/tclsh$v"
+               cat >&3 "$d"/test-load.tcl
+               echo >&3 'set t {'"$d"'/runtest.tcl}'
+               echo >&3 'if {[file exists $t]} { source $t }'
+               chmod +x $dt/$t
+               echo >&4 "Tests: $t"
+               sed "s/^shlibs:Depends=/Depends: tcl$v, /" >&4 $sv
+               case $v in
+               '')     ;;
+               ?*)     echo >&4 'Restrictions: skip-not-installable' ;;
+               esac
+               echo >&4
+       done
+       echo
+done
+
+mv $dt/control.new $dt/control
index f9ed503fb1637fdfe7b2cf0b3016607821366f5c..f065f68d4fb414ce649dab7becf63a018650d15e 100755 (executable)
@@ -26,11 +26,14 @@ docdir=usr/share/doc/$(docpackage)
 tclh:=$(firstword $(wildcard /usr/include/tcl8.*/tcl.h))
 tclversion:=$(patsubst /usr/include/tcl%/tcl.h,%,$(tclh))
 
+tcl_versions= 8.5 8.6 8.7
+
+march := $(shell dpkg-architecture -q DEB_HOST_MULTIARCH)
+libsubdir = /$(march)
+
 garch := $(shell dpkg-architecture -q DEB_HOST_GNU_TYPE)
 ifneq ($(garch),)
 
-libsubdir = /$(garch)
-
 ifeq ($(origin CC),default)
 export CC=$(garch)-gcc
 endif
@@ -103,4 +106,8 @@ checkroot:
        $(checkdir)
        dh_testroot
 
+debian/tests/control: debian/regenerate-autopkgtests debian/rules
+       $(MAKE) debian-substvars
+       $< $(tcl_versions)
+
 .PHONY: binary binary-arch binary-indep clean checkroot
diff --git a/debian/tests/adns--8.5 b/debian/tests/adns--8.5
new file mode 100755 (executable)
index 0000000..5dd2b82
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh8.5
+load chiark_tcl_adns-1.so
+set t {adns/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/adns--8.6 b/debian/tests/adns--8.6
new file mode 100755 (executable)
index 0000000..773e4bd
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh8.6
+load chiark_tcl_adns-1.so
+set t {adns/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/adns--8.7 b/debian/tests/adns--8.7
new file mode 100755 (executable)
index 0000000..b830354
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh8.7
+load chiark_tcl_adns-1.so
+set t {adns/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/adns--def b/debian/tests/adns--def
new file mode 100755 (executable)
index 0000000..c18bb01
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh
+load chiark_tcl_adns-1.so
+set t {adns/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/cdb--8.5 b/debian/tests/cdb--8.5
new file mode 100755 (executable)
index 0000000..1cc0b8c
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh8.5
+load chiark_tcl_cdb-1.so
+set t {cdb/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/cdb--8.6 b/debian/tests/cdb--8.6
new file mode 100755 (executable)
index 0000000..44c52aa
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh8.6
+load chiark_tcl_cdb-1.so
+set t {cdb/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/cdb--8.7 b/debian/tests/cdb--8.7
new file mode 100755 (executable)
index 0000000..7ea7195
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh8.7
+load chiark_tcl_cdb-1.so
+set t {cdb/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/cdb--def b/debian/tests/cdb--def
new file mode 100755 (executable)
index 0000000..46fb5e8
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh
+load chiark_tcl_cdb-1.so
+set t {cdb/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644 (file)
index 0000000..a075529
--- /dev/null
@@ -0,0 +1,90 @@
+Tests: adns--def
+Depends: tcl, libadns1 (>= 1.5.0~), libc6 (>= 2.2.5), libtcl-chiark-1
+
+Tests: adns--8.5
+Depends: tcl8.5, libadns1 (>= 1.5.0~), libc6 (>= 2.2.5), libtcl-chiark-1
+Restrictions: skip-not-installable
+
+Tests: adns--8.6
+Depends: tcl8.6, libadns1 (>= 1.5.0~), libc6 (>= 2.2.5), libtcl-chiark-1
+Restrictions: skip-not-installable
+
+Tests: adns--8.7
+Depends: tcl8.7, libadns1 (>= 1.5.0~), libc6 (>= 2.2.5), libtcl-chiark-1
+Restrictions: skip-not-installable
+
+Tests: cdb--def
+Depends: tcl, libc6 (>= 2.14), libcdb1, libtcl-chiark-1
+
+Tests: cdb--8.5
+Depends: tcl8.5, libc6 (>= 2.14), libcdb1, libtcl-chiark-1
+Restrictions: skip-not-installable
+
+Tests: cdb--8.6
+Depends: tcl8.6, libc6 (>= 2.14), libcdb1, libtcl-chiark-1
+Restrictions: skip-not-installable
+
+Tests: cdb--8.7
+Depends: tcl8.7, libc6 (>= 2.14), libcdb1, libtcl-chiark-1
+Restrictions: skip-not-installable
+
+Tests: crypto--def
+Depends: tcl, libc6 (>= 2.14), libnettle8, libtcl-chiark-1
+
+Tests: crypto--8.5
+Depends: tcl8.5, libc6 (>= 2.14), libnettle8, libtcl-chiark-1
+Restrictions: skip-not-installable
+
+Tests: crypto--8.6
+Depends: tcl8.6, libc6 (>= 2.14), libnettle8, libtcl-chiark-1
+Restrictions: skip-not-installable
+
+Tests: crypto--8.7
+Depends: tcl8.7, libc6 (>= 2.14), libnettle8, libtcl-chiark-1
+Restrictions: skip-not-installable
+
+Tests: dgram--def
+Depends: tcl, libc6 (>= 2.14), libtcl-chiark-1
+
+Tests: dgram--8.5
+Depends: tcl8.5, libc6 (>= 2.14), libtcl-chiark-1
+Restrictions: skip-not-installable
+
+Tests: dgram--8.6
+Depends: tcl8.6, libc6 (>= 2.14), libtcl-chiark-1
+Restrictions: skip-not-installable
+
+Tests: dgram--8.7
+Depends: tcl8.7, libc6 (>= 2.14), libtcl-chiark-1
+Restrictions: skip-not-installable
+
+Tests: hbytes--def
+Depends: tcl, libc6 (>= 2.14), libtcl-chiark-1
+
+Tests: hbytes--8.5
+Depends: tcl8.5, libc6 (>= 2.14), libtcl-chiark-1
+Restrictions: skip-not-installable
+
+Tests: hbytes--8.6
+Depends: tcl8.6, libc6 (>= 2.14), libtcl-chiark-1
+Restrictions: skip-not-installable
+
+Tests: hbytes--8.7
+Depends: tcl8.7, libc6 (>= 2.14), libtcl-chiark-1
+Restrictions: skip-not-installable
+
+Tests: tuntap--def
+Depends: tcl, libc6 (>= 2.2.5), libtcl-chiark-1
+
+Tests: tuntap--8.5
+Depends: tcl8.5, libc6 (>= 2.2.5), libtcl-chiark-1
+Restrictions: skip-not-installable
+
+Tests: tuntap--8.6
+Depends: tcl8.6, libc6 (>= 2.2.5), libtcl-chiark-1
+Restrictions: skip-not-installable
+
+Tests: tuntap--8.7
+Depends: tcl8.7, libc6 (>= 2.2.5), libtcl-chiark-1
+Restrictions: skip-not-installable
+
diff --git a/debian/tests/crypto--8.5 b/debian/tests/crypto--8.5
new file mode 100755 (executable)
index 0000000..0289eb6
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh8.5
+load chiark_tcl_crypto-1.so
+set t {crypto/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/crypto--8.6 b/debian/tests/crypto--8.6
new file mode 100755 (executable)
index 0000000..860089a
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh8.6
+load chiark_tcl_crypto-1.so
+set t {crypto/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/crypto--8.7 b/debian/tests/crypto--8.7
new file mode 100755 (executable)
index 0000000..a9ed1f8
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh8.7
+load chiark_tcl_crypto-1.so
+set t {crypto/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/crypto--def b/debian/tests/crypto--def
new file mode 100755 (executable)
index 0000000..1b14b4f
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh
+load chiark_tcl_crypto-1.so
+set t {crypto/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/dgram--8.5 b/debian/tests/dgram--8.5
new file mode 100755 (executable)
index 0000000..ab23044
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh8.5
+load chiark_tcl_dgram-1.so
+set t {dgram/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/dgram--8.6 b/debian/tests/dgram--8.6
new file mode 100755 (executable)
index 0000000..cf3f9f8
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh8.6
+load chiark_tcl_dgram-1.so
+set t {dgram/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/dgram--8.7 b/debian/tests/dgram--8.7
new file mode 100755 (executable)
index 0000000..4f1d375
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh8.7
+load chiark_tcl_dgram-1.so
+set t {dgram/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/dgram--def b/debian/tests/dgram--def
new file mode 100755 (executable)
index 0000000..874cfd2
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh
+load chiark_tcl_dgram-1.so
+set t {dgram/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/hbytes--8.5 b/debian/tests/hbytes--8.5
new file mode 100755 (executable)
index 0000000..e512858
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh8.5
+load chiark_tcl_hbytes-1.so
+set t {hbytes/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/hbytes--8.6 b/debian/tests/hbytes--8.6
new file mode 100755 (executable)
index 0000000..5e737e5
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh8.6
+load chiark_tcl_hbytes-1.so
+set t {hbytes/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/hbytes--8.7 b/debian/tests/hbytes--8.7
new file mode 100755 (executable)
index 0000000..95e5d19
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh8.7
+load chiark_tcl_hbytes-1.so
+set t {hbytes/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/hbytes--def b/debian/tests/hbytes--def
new file mode 100755 (executable)
index 0000000..c437940
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh
+load chiark_tcl_hbytes-1.so
+set t {hbytes/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/tuntap--8.5 b/debian/tests/tuntap--8.5
new file mode 100755 (executable)
index 0000000..2f03f9c
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh8.5
+load chiark_tcl_tuntap-1.so
+set t {tuntap/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/tuntap--8.6 b/debian/tests/tuntap--8.6
new file mode 100755 (executable)
index 0000000..b1493c1
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh8.6
+load chiark_tcl_tuntap-1.so
+set t {tuntap/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/tuntap--8.7 b/debian/tests/tuntap--8.7
new file mode 100755 (executable)
index 0000000..1f58f36
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh8.7
+load chiark_tcl_tuntap-1.so
+set t {tuntap/runtest.tcl}
+if {[file exists $t]} { source $t }
diff --git a/debian/tests/tuntap--def b/debian/tests/tuntap--def
new file mode 100755 (executable)
index 0000000..58c5244
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/tclsh
+load chiark_tcl_tuntap-1.so
+set t {tuntap/runtest.tcl}
+if {[file exists $t]} { source $t }
index 24c5446c0b1625528f98fbb5ce4dceb664845f28..5ffe91ff5ae584ee17424c05e787f96b8540824a 100644 (file)
@@ -134,6 +134,18 @@ x_rc:
     Tcl_BackgroundError(ip);
 }
 
+int cht_do_dgramsocket_sockname(ClientData cd, Tcl_Interp *ip,
+                               void *sock_v, SockAddr_Value *result) {
+  DgramSocket *sock= sock_v;
+  int r;
+
+  socklen_t salen = sock->addr_buflen;
+  r= getsockname(sock->fd, sock->addr_buf, &salen);
+  if (r) return cht_posixerr(ip,errno,"getsockname");
+  cht_sockaddr_create(result, sock->addr_buf, salen);
+  return TCL_OK;
+}
+
 int cht_do_dgramsocket_on_receive(ClientData cd, Tcl_Interp *ip,
                               void *sock_v, Tcl_Obj *newscript) {
   DgramSocket *sock= sock_v;
index 119e3542675ffc2fe029f1ae6c846a3a49a3f160..938d0a3bf9a8f3f67a5dd8530cb92ce66480300e 100644 (file)
@@ -32,6 +32,9 @@ Table dgramsocket DgramSocket_SubCommand
                sock    iddata(&cht_dgram_socks)
                data    hb
                remote  sockaddr
+       sockname
+               sock    iddata(&cht_dgram_socks)
+               =>      sockaddr
        on-receive
                sock    iddata(&cht_dgram_socks)
                ?script obj
diff --git a/dgram/runtest.tcl b/dgram/runtest.tcl
new file mode 100644 (file)
index 0000000..9488d96
--- /dev/null
@@ -0,0 +1,2 @@
+set d [dgram-socket create *,*]
+dgram-socket sockname $d
index 0ed871c8f3d20a1e3ef9b64586fc4c878304d57e..2e5d658914c0286265fed4de858c7ee72e325ff7 100644 (file)
@@ -248,7 +248,7 @@ extern Tcl_ObjType cht_addrmap_type;
 
 /* from ulong.c */
 
-Tcl_ObjType cht_ulong_type;
+extern Tcl_ObjType cht_ulong_type;
 
 /* useful macros */