Check-in [ae7d9fc61b]
Overview
Comment:Added patch from P. Thoyts fixing async channel copies in mk4vfs. This closes bug [0990f53b1a].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:ae7d9fc61bfdaeb156cebe593210bdc18a5fbb12
User & Date: rkeene on 2010-10-16 21:28:59
Other Links: manifest | tags
References
2010-10-16
21:29 Closed ticket [0990f53b1a]: PNG files in Metakit4 VFSes fail to be read correctly plus 2 other changes artifact: 950cd89836 user: rkeene
Context
2010-10-16
23:48
Corrected test for presence of mk4 in mk4vfs fcopy test check-in: 8e7cd7106a user: rkeene tags: trunk
21:28
Added patch from P. Thoyts fixing async channel copies in mk4vfs. This closes bug [0990f53b1a]. check-in: ae7d9fc61b user: rkeene tags: trunk
2010-10-14
07:41
Added patch for Tcl 8.4.19 to support compiling on Haiku

Updated release script to release patchscripts for Tcl check-in: a15ed07178 user: rkeene tags: trunk

Changes

Added build/test/tests/15-mk4vfsfcopy.sh version [269c39fe61].

            1  +#! /bin/bash
            2  +
            3  +TMPFILE="${TMPDIR:-/tmp}/DELETEME_testmk4vfs-$$${RANDOM}${RANDOM}${RANDOM}.mk"
            4  +export TMPFILE
            5  +
            6  +cat << \__EOF__ | base64 -d | gzip -dc > "${TMPFILE}"
            7  +H4sICMoPukwCA3Rlc3QubWsA8/KRYmBgYKu3KcrPL7FjYGcAgf8NDQ2N7R1t/Q2NU5umNexJySwq
            8  +js5LzE21CtYpSCxKzSux8tRJy8xJhYsWZ1alAsVSEktAVHJ+Xj9TQ2PXnzbGtoYmxp4Wxj7Wfvb5
            9  +TTcQxk69xaycXJRfXKxXkJfOwAW2tp/pAe8un84AP3deLimQEK+nh0sQkBYAYQ42ICn/+X8ikGJJ
           10  +d/R1ZGBYf8KcteslkC9Z4hpREpyfVlIOdB2DY0p+UqqCZ25iempQamJKZeHJVBsGBiZFTxfHEIvT
           11  +Uye/9hMOFGnt7DzZeX5BWGfbiYkNR6Sdotk01vJyqF343Rq3pGHL0rdLfBeaveL3rRGaz+1y9N6G
           12  +SzPLrC4/XTfDS1f14XG/cynnfn1bs/U7D4PEDp+r152un7MrjxcwttK6F/6Gv+jm297rOX7O+gt0
           13  +z71ZNPWcU7d6tUJpfMN15kQTs20fXj899fzVo0t76xv2Jz25v9B1qaqLifl2a4Gbu4+ttJ510WLC
           14  +6cW1dmbRj59KXp4a7KB1NoozMPvtPka7uqZpZ7cyZrA4xXz7YVnavkmW+cXeN/wPKv7tjBJ7tq4s
           15  +8kIS57J9fStnzWC8V98wy2uxHE/zLuebXUw399o/7zrp9CiyLK/j7Am17JZrV9NK2t/sYf32SeUM
           16  +40ydlH7+qZabo+bNS/y7vEBKbHJMHG/kpsffGPnMFZYFzpx73cut8W/9fnYFS9u3gYwmvDfmHOiS
           17  +veE5KZ+bSzj4j1PDk4Lik08bhfoYPCe2aCq4lWk4VF7t23Sv433y4z8xDmffPZp0mVd1C98FCdV2
           18  +bpFpUXOMMtS7TzukMG8VP61hU9NzeGHiPdYFZx9dkfX6IFrq67DIf/mGK4+WNIrO89mw+KN71tUU
           19  +tibFORFrLKQkjx5c63iP8UIap+lsZi8FlsyrjFzeunaXy5l+mxkd28d3P7xeitXjGusfidqGv9JW
           20  +C08z5U4LiI1wOmmwNjDCNlP+nmxSPNv7FelHbRWnfXFb+KFk0tffM/lKtt/893X2odbkPTl/2Yp2
           21  +Lzl+++0+EVBi9HT1c1nnlNCEmZAZJzWxLUSk5Glsi8nKISVARcVWTrGxjT1sOxvAGYC5HUg7AWlX
           22  +Lx9Q+md6MZoZRjPDIMoMFCb07veQdM6WD6SBSZZNDwAplnesfwYAAA==
           23  +__EOF__

Added build/test/tests/15-mk4vfsfcopy.tcl version [e1293c78f6].

            1  +#! /usr/bin/env tclsh
            2  +
            3  +set haveMk4vfs 0
            4  +catch {
            5  +	package require vfs::mk4
            6  +	set haveMk4vfs 1
            7  +}
            8  +
            9  +if {!$haveMk4vfs} {
           10  +	# This test only applies to kits that include Mk4vfs
           11  +	exit 0
           12  +}
           13  +
           14  +set TMPFILE $::env(TMPFILE)
           15  +
           16  +set ::fcopy_complete 0
           17  +proc fcopy_complete {args} {
           18  +	set ::fcopy_complete 1
           19  +}
           20  +
           21  +vfs::mk4::Mount $TMPFILE /TEST
           22  +set fd [open /TEST/cross.png]
           23  +fconfigure $fd -translation binary
           24  +set out [open /dev/null w]
           25  +fcopy $fd $out -command fcopy_complete
           26  +after 3000
           27  +update
           28  +
           29  +if {$::fcopy_complete != 1} {
           30  +	puts "Expected:  Fcopy Complete = 1"
           31  +	puts "Got:       Fcopy Complete = $::fcopy_complete"
           32  +	exit 1
           33  +}
           34  +
           35  +exit 0

Added mk4tcl/patches/all/metakit-2.4.9.7-fixeventchannels-1pt.diff version [8e303e1d43].

            1  +diff -uNr metakit-2.4.9.7.orig/tcl/mk4tcl.cpp metakit-2.4.9.7-1ptrsk/tcl/mk4tcl.cpp
            2  +--- metakit-2.4.9.7.orig/tcl/mk4tcl.cpp	2007-06-18 16:05:24.000000000 -0500
            3  ++++ metakit-2.4.9.7-1ptrsk/tcl/mk4tcl.cpp	2010-10-16 16:21:41.000000000 -0500
            4  +@@ -182,6 +182,8 @@
            5  +     Tcl_Channel _chan;
            6  +     int _validMask;
            7  +     int _watchMask;
            8  ++    int _flags;
            9  ++    SiasStrategy *_next;
           10  +     Tcl_Interp *_interp;
           11  + 
           12  +     SiasStrategy(c4_Storage &storage_, const c4_View &view_, const c4_BytesProp
           13  +@@ -259,23 +261,58 @@
           14  + ///////////////////////////////////////////////////////////////////////////////
           15  + // New in 1.2: channel interface to memo fields
           16  + 
           17  +-typedef SiasStrategy MkChannel;
           18  +-
           19  + typedef struct {
           20  +   Tcl_Event header;
           21  +   MkChannel *chan;
           22  ++  int flags;
           23  + } MkEvent;
           24  + 
           25  ++#define CHANNEL_FLAG_PENDING (1<<1)
           26  ++
           27  + static int mkEventProc(Tcl_Event *evPtr, int flags) {
           28  +   MkEvent *me = (MkEvent*)evPtr;
           29  + 
           30  +-  if (!(flags &TCL_FILE_EVENTS))
           31  ++  if (!(flags & TCL_FILE_EVENTS))
           32  +     return 0;
           33  + 
           34  +-  Tcl_NotifyChannel(me->chan->_chan, me->chan->_watchMask);
           35  ++  me->chan->_flags &= ~CHANNEL_FLAG_PENDING;
           36  ++  Tcl_NotifyChannel(me->chan->_chan, me->chan->_watchMask & me->flags);
           37  +   return 1;
           38  + }
           39  + 
           40  ++static void SetupProc(ClientData clientData, int flags) {
           41  ++  MkWorkspace *ws = (MkWorkspace *)clientData;
           42  ++  int msec = 10000;
           43  ++  Tcl_Time blockTime = {0, 0};
           44  ++  if (!(flags & TCL_FILE_EVENTS))
           45  ++    return;
           46  ++  for (MkChannel *chan = ws->_chanList; chan != NULL; chan = chan->_next) {
           47  ++    msec = 10;
           48  ++  }
           49  ++  blockTime.sec = msec / 1000;
           50  ++  blockTime.usec = (msec % 1000) * 1000;
           51  ++  Tcl_SetMaxBlockTime(&blockTime);
           52  ++}
           53  ++
           54  ++static void CheckProc(ClientData clientData, int flags) {
           55  ++  MkWorkspace *ws = (MkWorkspace *)clientData;
           56  ++  if (!(flags & TCL_FILE_EVENTS))
           57  ++    return;
           58  ++  for (MkChannel *chan = ws->_chanList; chan != NULL; chan = chan->_next) {
           59  ++    if (chan->_watchMask == 0)
           60  ++      continue;
           61  ++    int mask = TCL_WRITABLE | TCL_READABLE;
           62  ++    if (chan->_watchMask & mask) {
           63  ++      MkEvent *me = (MkEvent *)ckalloc(sizeof(MkEvent));
           64  ++      chan->_flags |= CHANNEL_FLAG_PENDING;
           65  ++      me->header.proc = mkEventProc;
           66  ++      me->chan = chan;
           67  ++      me->flags = mask;
           68  ++      Tcl_QueueEvent((Tcl_Event *)me, TCL_QUEUE_TAIL);
           69  ++    }
           70  ++  }
           71  ++}
           72  ++
           73  + static int mkEventFilter(Tcl_Event *evPtr, ClientData instanceData) {
           74  +   MkEvent *me = (MkEvent*)evPtr;
           75  +   MkChannel *chan = (MkChannel*)instanceData;
           76  +@@ -285,6 +322,16 @@
           77  + static int mkClose(ClientData instanceData, Tcl_Interp *interp) {
           78  +   MkChannel *chan = (MkChannel*)instanceData;
           79  + 
           80  ++  /* remove this channel from the package list */
           81  ++  if (interp) {
           82  ++    MkWorkspace *ws = (MkWorkspace*)Tcl_GetAssocData(interp, "mk4tcl", 0);
           83  ++    MkChannel **tmpPtrPtr = &ws->_chanList;
           84  ++    while (*tmpPtrPtr && *tmpPtrPtr != chan) {
           85  ++      tmpPtrPtr = &(*tmpPtrPtr)->_next;
           86  ++    }
           87  ++    *tmpPtrPtr = chan->_next;
           88  ++  }
           89  ++  
           90  +   Tcl_DeleteEvents(mkEventFilter, (ClientData)chan);
           91  +   chan->_chan = 0;
           92  +   delete chan;
           93  +@@ -726,7 +773,7 @@
           94  +   ++generation; // make sure all cached paths refresh on next access
           95  + }
           96  + 
           97  +-MkWorkspace::MkWorkspace(Tcl_Interp *ip_): _interp(ip_) {
           98  ++MkWorkspace::MkWorkspace(Tcl_Interp *ip_): _interp(ip_), _chanList(NULL) {
           99  +   new Item("", "", 0, _items, 0);
          100  + 
          101  +   // never uses entry zero (so atoi failure in ForgetPath is harmless)
          102  +@@ -741,6 +788,7 @@
          103  +     delete Nth(i);
          104  + 
          105  +   // need this to prevent recursion in Tcl_DeleteAssocData in 8.2 (not 8.0!)
          106  ++  Tcl_DeleteEventSource(SetupProc, CheckProc, this);
          107  +   Tcl_SetAssocData(_interp, "mk4tcl", 0, 0);
          108  +   Tcl_DeleteAssocData(_interp, "mk4tcl");
          109  + }
          110  +@@ -2371,6 +2419,7 @@
          111  + 
          112  +   mkChan->_watchMask = 0;
          113  +   mkChan->_validMask = mode;
          114  ++  mkChan->_flags = 0;
          115  +   mkChan->_interp = interp;
          116  +   mkChan->_chan = Tcl_CreateChannel(&mkChannelType, buffer, (ClientData)mkChan,
          117  +     mode);
          118  +@@ -2380,6 +2429,10 @@
          119  + 
          120  +   Tcl_RegisterChannel(interp, mkChan->_chan);
          121  + 
          122  ++  /* insert this channel at the front of the workspace channels list */
          123  ++  mkChan->_next = work._chanList;
          124  ++  work._chanList = mkChan;
          125  ++
          126  +   if (_error)
          127  +     return _error;
          128  + 
          129  +@@ -2603,6 +2656,7 @@
          130  +     // since that does not seem to trigger exitproc handling (!)
          131  +     Tcl_SetAssocData(interp, "mk4tcl", DelProc, ws);
          132  +     Tcl_CreateExitHandler(ExitProc, ws);
          133  ++    Tcl_CreateEventSource(SetupProc, CheckProc, ws);
          134  +   }
          135  + 
          136  +   // this list must match the "CmdDef defTab []" above.
          137  +@@ -2648,3 +2702,11 @@
          138  + }
          139  + 
          140  + ///////////////////////////////////////////////////////////////////////////////
          141  ++
          142  ++/*
          143  ++ * Local variables:
          144  ++ * mode: c
          145  ++ * c-basic-offset: 2
          146  ++ * indent-tabs-mode: nil
          147  ++ * End:
          148  ++ */
          149  +diff -uNr metakit-2.4.9.7.orig/tcl/mk4tcl.h metakit-2.4.9.7-1ptrsk/tcl/mk4tcl.h
          150  +--- metakit-2.4.9.7.orig/tcl/mk4tcl.h	2007-06-15 18:26:40.000000000 -0500
          151  ++++ metakit-2.4.9.7-1ptrsk/tcl/mk4tcl.h	2010-10-16 16:19:00.000000000 -0500
          152  +@@ -205,6 +205,9 @@
          153  + ///////////////////////////////////////////////////////////////////////////////
          154  + // A workspace manages a number of storage objects and their associated paths.
          155  + 
          156  ++class SiasStrategy;
          157  ++typedef SiasStrategy MkChannel;
          158  ++
          159  + class MkWorkspace {
          160  +     c4_PtrArray _items; // items, or null if released
          161  +     c4_Bytes _usedBuffer; // buffer, using 1 byte per entry
          162  +@@ -213,6 +216,7 @@
          163  + 
          164  +   public:
          165  +     Tcl_Interp *_interp;
          166  ++    MkChannel *_chanList;
          167  + 
          168  +     struct Item {
          169  +         const c4_String _name; // the alias for this storage