fix fd is null when calling clearBuffer
(cherry picked from commit 4a7bb21877da46b8b6f513871532f0fc373a1813)
This commit is contained in:
parent
990a07a0b7
commit
38197f03b9
59
0003-fix-fd-is-null-when-calling-clearBuffer.patch
Normal file
59
0003-fix-fd-is-null-when-calling-clearBuffer.patch
Normal file
@ -0,0 +1,59 @@
|
||||
From e0d8242693da7d6c1eb5f2ae75cb224e8bc7397b Mon Sep 17 00:00:00 2001
|
||||
From: zhenweijin <zhenwei.jin@intel.com>
|
||||
Date: Fri, 1 Dec 2023 19:35:05 +0800
|
||||
Subject: [PATCH] stream: fix fd is null when calling clearBuffer
|
||||
|
||||
---
|
||||
lib/internal/streams/writable.js | 3 ++-
|
||||
test/parallel/test-file-write-stream5.js | 28 ++++++++++++++++++++++++
|
||||
2 files changed, 30 insertions(+), 1 deletion(-)
|
||||
create mode 100644 test/parallel/test-file-write-stream5.js
|
||||
|
||||
diff --git a/lib/internal/streams/writable.js b/lib/internal/streams/writable.js
|
||||
index e55ddc1796cf6c..0dbf56d7a69ca9 100644
|
||||
--- a/lib/internal/streams/writable.js
|
||||
+++ b/lib/internal/streams/writable.js
|
||||
@@ -733,7 +733,8 @@ function errorBuffer(state) {
|
||||
|
||||
// If there's something in the buffer waiting, then process it.
|
||||
function clearBuffer(stream, state) {
|
||||
- if ((state[kState] & (kDestroyed | kBufferProcessing | kCorked | kBuffered)) !== kBuffered) {
|
||||
+ if ((state[kState] & (kDestroyed | kBufferProcessing | kCorked | kBuffered | kConstructed)) !==
|
||||
+ (kBuffered | kConstructed)) {
|
||||
return;
|
||||
}
|
||||
|
||||
diff --git a/test/parallel/test-file-write-stream5.js b/test/parallel/test-file-write-stream5.js
|
||||
new file mode 100644
|
||||
index 00000000000000..cdc8b52eebd48d
|
||||
--- /dev/null
|
||||
+++ b/test/parallel/test-file-write-stream5.js
|
||||
@@ -0,0 +1,28 @@
|
||||
+'use strict';
|
||||
+
|
||||
+// Test 'uncork' for WritableStream.
|
||||
+// Refs: https://github.com/nodejs/node/issues/50979
|
||||
+
|
||||
+const common = require('../common');
|
||||
+const fs = require('fs');
|
||||
+const assert = require('assert');
|
||||
+const test = require('node:test');
|
||||
+const tmpdir = require('../common/tmpdir');
|
||||
+
|
||||
+const filepath = tmpdir.resolve('write_stream.txt');
|
||||
+tmpdir.refresh();
|
||||
+
|
||||
+const data = 'data';
|
||||
+
|
||||
+test('writable stream uncork', () => {
|
||||
+ const fileWriteStream = fs.createWriteStream(filepath);
|
||||
+
|
||||
+ fileWriteStream.on('finish', common.mustCall(() => {
|
||||
+ const writtenData = fs.readFileSync(filepath, 'utf8');
|
||||
+ assert.strictEqual(writtenData, data);
|
||||
+ }));
|
||||
+ fileWriteStream.cork();
|
||||
+ fileWriteStream.write(data, common.mustCall());
|
||||
+ fileWriteStream.uncork();
|
||||
+ fileWriteStream.end();
|
||||
+});
|
||||
@ -1,4 +1,4 @@
|
||||
%global baserelease 2
|
||||
%global baserelease 3
|
||||
%{?!_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}}
|
||||
%global nodejs_epoch 1
|
||||
%global nodejs_major 20
|
||||
@ -81,6 +81,7 @@ Source4: nodejs_native.attr
|
||||
|
||||
Patch0: 0001-Use-system-uv-zlib.patch
|
||||
Patch1: 0002-Revert-deps-V8-tagged.patch
|
||||
Patch2: 0003-fix-fd-is-null-when-calling-clearBuffer.patch
|
||||
|
||||
BuildRequires: python3-devel python3-setuptools make
|
||||
BuildRequires: zlib-devel python3-jinja2
|
||||
@ -398,6 +399,9 @@ NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules:%{buildroot}%{_prefix}/lib/nod
|
||||
%{_pkgdocdir}/npm/docs
|
||||
|
||||
%changelog
|
||||
* Mon May 06 2024 Ge Wang <wang__ge@126.com> - 1:20.11.1-3
|
||||
- Fix fd is null when calling clearBuffer
|
||||
|
||||
* Mon Mar 18 2024 Eustace <eusteuc@outlook.com> - 1:20.11.1-2
|
||||
- Revert some v8 roll
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user