diff --git a/.github/workflows/fork-sync.yml b/.github/workflows/fork-sync.yml new file mode 100644 index 00000000..b766c0aa --- /dev/null +++ b/.github/workflows/fork-sync.yml @@ -0,0 +1,17 @@ +name: Sync Fork + +on: + schedule: + - cron: '45 4 * * *' # every day at 4:44 am + workflow_dispatch: # on button click + +jobs: + sync: + + runs-on: ubuntu-latest + + steps: + - uses: tgymnich/fork-sync@v1 + with: + base: master + head: master diff --git a/README.md b/README.md index 5c715e67..9ed7120f 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,13 @@ D-bus protocol client and server for node.js [![Build Status](https://secure.travis-ci.org/sidorares/dbus-native.png)](http://travis-ci.org/sidorares/dbus-native) +Fork Status +------------ + +This fork is maintained with the following two changes: +* Removed the optional `abstract-socket` dependency for faster installs +* Moved to our `long.js` fork to work around a crash on `ARMv6` platforms running node 16.1+ + Installation ------------ diff --git a/lib/dbus-buffer.js b/lib/dbus-buffer.js index 48b9b6a0..610f2413 100644 --- a/lib/dbus-buffer.js +++ b/lib/dbus-buffer.js @@ -1,4 +1,4 @@ -const Long = require('long'); +const Long = require('@homebridge/long'); const parseSignature = require('./signature'); // Buffer + position + global start position ( used in alignment ) diff --git a/lib/marshallers.js b/lib/marshallers.js index 0d90d6bf..409014af 100644 --- a/lib/marshallers.js +++ b/lib/marshallers.js @@ -1,7 +1,7 @@ const Buffer = require('safe-buffer').Buffer; const align = require('./align').align; const parseSignature = require('../lib/signature'); -const Long = require('long'); +const Long = require('@homebridge/long'); /** * MakeSimpleMarshaller * @param signature - the signature of the data you want to check @@ -63,8 +63,7 @@ var MakeSimpleMarshaller = function(signature) { // utf8 string align(ps, 4); const buff = Buffer.from(data, 'utf8'); - ps - .word32le(buff.length) + ps.word32le(buff.length) .put(buff) .word8(0); ps._offset += 5 + buff.length; @@ -80,8 +79,7 @@ var MakeSimpleMarshaller = function(signature) { this.check(data); // signature const buff = Buffer.from(data, 'ascii'); - ps - .word8(data.length) + ps.word8(data.length) .put(buff) .word8(0); ps._offset += 2 + buff.length; diff --git a/package-lock.json b/package-lock.json index d39d198d..5489b02b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,9 +9,9 @@ "version": "0.4.0", "license": "MIT", "dependencies": { + "@homebridge/long": "^5.2.1", "event-stream": "^4.0.0", "hexy": "^0.2.10", - "long": "^4.0.0", "optimist": "^0.6.1", "put": "0.0.6", "safe-buffer": "^5.1.1", @@ -149,6 +149,11 @@ "node": ">=6.9.0" } }, + "node_modules/@homebridge/long": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@homebridge/long/-/long-5.2.1.tgz", + "integrity": "sha512-i5Df8R63XNPCn+Nj1OgAoRdw9e+jHUQb3CNUbvJneI2iu3j4+OtzQj+5PA1Ce+747NR1SPqZSvyvD483dOT3AA==" + }, "node_modules/@samverschueren/stream-to-observable": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.1.tgz", @@ -3303,11 +3308,6 @@ "node": ">=4" } }, - "node_modules/long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, "node_modules/map-cache": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", @@ -5981,6 +5981,11 @@ "regenerator-runtime": "^0.13.4" } }, + "@homebridge/long": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@homebridge/long/-/long-5.2.1.tgz", + "integrity": "sha512-i5Df8R63XNPCn+Nj1OgAoRdw9e+jHUQb3CNUbvJneI2iu3j4+OtzQj+5PA1Ce+747NR1SPqZSvyvD483dOT3AA==" + }, "@samverschueren/stream-to-observable": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.1.tgz", @@ -8419,11 +8424,6 @@ } } }, - "long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, "map-cache": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", diff --git a/package.json b/package.json index 3644e896..85c636b3 100644 --- a/package.json +++ b/package.json @@ -40,13 +40,13 @@ "dependencies": { "event-stream": "^4.0.0", "hexy": "^0.2.10", - "long": "^4.0.0", + "@homebridge/long": "^5.2.1", "optimist": "^0.6.1", "put": "0.0.6", "safe-buffer": "^5.1.1", "xml2js": "^0.4.17" }, - "uncomment": { + "comment": { "optionalDependencies": { "abstract-socket": "^2.0.0" } diff --git a/test/unmarshall-basic.js b/test/unmarshall-basic.js index 839bfae3..bc527cc9 100644 --- a/test/unmarshall-basic.js +++ b/test/unmarshall-basic.js @@ -2,7 +2,7 @@ const Buffer = require('safe-buffer').Buffer; const marshall = require('../lib/marshall'); const unmarshall = require('../lib/unmarshall'); const assert = require('assert'); -const Long = require('long'); +const Long = require('@homebridge/long'); var LongMaxS64 = Long.fromString('9223372036854775807', false); var LongMinS64 = Long.fromString('-9223372036854775808', false); @@ -312,34 +312,93 @@ describe('marshall/unmarshall', function() { ], 'arrays of simple types': [ ['ai', [[1, 2, 3, 4, 5, 6, 7]]], - ['aai', [[[300, 400, 500], [1, 2, 3, 4, 5, 6, 7]]]], - ['aiai', [[1, 2, 3], [300, 400, 500]]] + [ + 'aai', + [ + [ + [300, 400, 500], + [1, 2, 3, 4, 5, 6, 7] + ] + ] + ], + [ + 'aiai', + [ + [1, 2, 3], + [300, 400, 500] + ] + ] ], 'compound types': [ ['iyai', [10, 100, [1, 2, 3, 4, 5, 6]]], // TODO: fix 'array of structs offset problem - ['a(iyai)', [[[10, 100, [1, 2, 3, 4, 5, 6]], [11, 200, [15, 4, 5, 6]]]]], + [ + 'a(iyai)', + [ + [ + [10, 100, [1, 2, 3, 4, 5, 6]], + [11, 200, [15, 4, 5, 6]] + ] + ] + ], [ 'sa(iyai)', [ 'test test test test', - [[10, 100, [1, 2, 3, 4, 5, 6]], [11, 200, [15, 4, 5, 6]]] + [ + [10, 100, [1, 2, 3, 4, 5, 6]], + [11, 200, [15, 4, 5, 6]] + ] + ] + ], + [ + 'a(iyai)', + [ + [ + [10, 100, [1, 2, 3, 4, 5, 6]], + [11, 200, [15, 4, 5, 6]] + ] + ] + ], + [ + 'a(yai)', + [ + [ + [100, [1, 2, 3, 4, 5, 6]], + [200, [15, 4, 5, 6]] + ] ] ], - ['a(iyai)', [[[10, 100, [1, 2, 3, 4, 5, 6]], [11, 200, [15, 4, 5, 6]]]]], - ['a(yai)', [[[100, [1, 2, 3, 4, 5, 6]], [200, [15, 4, 5, 6]]]]], [ 'a(yyai)', - [[[100, 101, [1, 2, 3, 4, 5, 6]], [200, 201, [15, 4, 5, 6]]]] + [ + [ + [100, 101, [1, 2, 3, 4, 5, 6]], + [200, 201, [15, 4, 5, 6]] + ] + ] ], [ 'a(yyyai)', - [[[100, 101, 102, [1, 2, 3, 4, 5, 6]], [200, 201, 202, [15, 4, 5, 6]]]] + [ + [ + [100, 101, 102, [1, 2, 3, 4, 5, 6]], + [200, 201, 202, [15, 4, 5, 6]] + ] + ] ], ['ai', [[1, 2, 3, 4, 5, 6]]], ['aii', [[1, 2, 3, 4, 5, 6], 10]], ['a(ai)', [[[[1, 2, 3, 4, 5, 6]], [[15, 4, 5, 6]]]]], - ['aai', [[[1, 2, 3, 4, 5, 6], [15, 4, 5, 6]]]] + [ + 'aai', + [ + [ + [1, 2, 3, 4, 5, 6], + [15, 4, 5, 6] + ] + ] + ] ], buffers: [ ['ayay', [Buffer.from([0, 1, 2, 3, 4, 5, 6, 0xff]), Buffer.from([])]]