namespaces returned by debug.disable are not always accepted by debug.enable
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript
- 領域
- tooling
調査の方向性
Start in common.js at the enable implementation around line 184 and reproduce the issue with DEBUG=":error:". Trace how debug.disable() transforms the namespace before it is passed back to debug.enable(). Done means the namespace returned by disable() can be passed to enable() without an invalid regular expression error.
索引モデルが issue の本文から書いたものです。
説明
I have seen some strange behavior when temporary disabling the current namespaces, and trying to re-enable the namespaces returned by the debug.disable() call later in the debug.enable() call.
This happened while debugging a node-red custom node that I'm working on:
First I start node-red with some logging enabled:
DEBUG="*:error:*" node-red
Then using a REST call i fetch the current namespaces as follows:
RED.httpAdmin.get('/debug', function (req, res) {
console.log("/debug",req.method);
var namespaces = debug.disable();
console.log("/debug",req.method,namespaces);
debug.enable(namespaces);
res.end(JSON.stringify(Object({ "namespaces": namespaces })));
});
When this function is called, it prints the following on the console:
/debug GET
/debug GET .*?:error:*
SyntaxError: Invalid regular expression: /^..*??:error:.*?$/: Nothing to repeat
at new RegExp (<anonymous>)
at Function.enable (/home/hurenkam/Workspace/node-red-contrib-mh-hue/node_modules/debug/src/common.js:184:28)
at /home/hurenkam/Workspace/node-red-contrib-mh-hue/src/debug.js:21:15
at Layer.handle [as handle_request] (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
at next (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/route.js:144:13)
at Route.dispatch (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/route.js:114:3)
at Layer.handle [as handle_request] (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5)
at /usr/local/lib/node_modules/node-red/node_modules/express/lib/router/index.js:284:15
at Function.process_params (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/index.js:346:12)
at next (/usr/local/lib/node_modules/node-red/node_modules/express/lib/router/index.js:280:10)
It would seem that the wildcard namespace "*:error:*" is being translated to ".*?:error:*" which when fed back into debug.enable() triggers an error in common.js @ line 184 when trying to push the expression into a RegExp:
common.js:
184: createDebug.names.push(new RegExp('^' + namespaces + '$'));
- 主要言語
- JavaScript
- スター
- 11.5k
- フォーク
- 993
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
debug-js/debug のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
-
Debug as JSONオープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 28/100
似ている issue
-
bug CI breakage triage needed
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
oppia/oppia#27517 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
draftomen enhancement size: S
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
andreagrandi/draftomen#761 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
HarperFast/harper#2866 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
HarperFast/harper-pro#927 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
anthropics/skills#1897 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信