You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var b = new Buffer(256);
for (var i = 0, len = b.length; i < len; ++i) b[i] = i;
var s = b.slice(-8);
console.log(s.length, s);
var s2 = b.slice(-16);
console.log(s2.length);
Expected:
postel:fatfs natevw$ node t_buffer.js
8 <Buffer f8 f9 fa fb fc fd fe ff>
16
Actual:
postel:fatfs natevw$ tessel run -s t_buffer.js
TESSEL! Connected to TM-00-02-nnn-nnn-nnn.
WARN Warning. Deploying just this file.
INFO Bundling directory /Users/natevw/Desktop/Clients/Technical_Machine/fatfs
INFO Deploying bundle (3.50 KB)...
INFO Running script...
264 <Buffer 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 ...>
272
Ah! What's happening is the negative number never even hits that code path, but remains in the untouched sourceStart rather than len [sic…it's really the end not a length anyway…].
natevw
added a commit
to natevw/fatfs
that referenced
this issue
Mar 27, 2015
Script:
Expected:
Actual:
So it seems the resulting length is the original plus the negative index, even though https://github.com/tessel/runtime/blob/fb2fcbe624bf7a613d2781cedd06641198ef1122/src/colony/lua/colony-node.lua#L228 looks reasonable at first review.
The text was updated successfully, but these errors were encountered: