Conversation
The test wanted to cut huge string into 1KB strings, for which a new line character was inserted at appropriate places. The value is different in Windows (10, 13). Make it portable, by making use of os.EOL semantics Refs: nodejs#25988
|
the modified test is failing in windows (10 and 2016) with one byte loss! can't think of a reason! |
Previously, the data in the file was of the structure \n
xxxxxxx...xxx\n
xxxxxxx...xxx\n
...
xxxxxxx...xxx\n
xxxxxxx...xxxwhich xxxxxxx...xxx\n
xxxxxxx...xxx\n
...
xxxxxxx...xxx\n
xxxxxxx...xxx\n(i.e. remove the empty line, but also add a trailing UNIX-style newline at the end.) I assume that now, where the file structure is \r\n
xxxxxxx...xxx\r\n
xxxxxxx...xxx\r\n
...
xxxxxxx...xxx\r\n
xxxxxxx...xxxgrep turns that into xxxxxxx...xxx\r\n
xxxxxxx...xxx\r\n
....
xxxxxxx...xxx\r\n
xxxxxxx...xxx\ni.e. grep still drops the empty line and adds a newline, but (like before) a UNIX-style one instead of a Windows-style one. |
|
great catch @addaleax !! I never knew we were loosing one byte and getting it back from |
|
@gireeshpunathil You can reproduce this pretty easily on UNIX, too, by replacing |
|
@addaleax, I made changes in the test to remove the new line in the beginning of the buffer and considered one extra byte which grep provides while doing assertion. Please take a look. |
|
Landed in 4fedb70 |
The test wanted to cut huge string into 1KB strings, for which a new line character was inserted at appropriate places. The value is different in Windows (10, 13). Make it portable, by making use of os.EOL semantics Refs: #25988 PR-URL: #32104 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
`buffer.write` documentation has an incaccuracy w.r.t the `length` parameter: It says default number of bytes written is `buf.length - offset`. Change it to: If the buffer has sufficient space from the offset, the string is written upto `length`. If the buffer is short in space, only `buf.length - offset` bytes are written. Refs : nodejs#32104 (comment)
The test wanted to cut huge string into 1KB strings, for which a new line character was inserted at appropriate places. The value is different in Windows (10, 13). Make it portable, by making use of os.EOL semantics Refs: #25988 PR-URL: #32104 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
The test wanted to cut huge string into 1KB strings, for which a new line character was inserted at appropriate places. The value is different in Windows (10, 13). Make it portable, by making use of os.EOL semantics Refs: #25988 PR-URL: #32104 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
`buffer.write` documentation has an incaccuracy w.r.t the `length` parameter: It says default number of bytes written is `buf.length - offset`. Change it to: If the buffer has sufficient space from the offset, the string is written upto `length`. If the buffer is short in space, only `buf.length - offset` bytes are written. Refs: #32104 (comment) PR-URL: #32119 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
`buffer.write` documentation has an incaccuracy w.r.t the `length` parameter: It says default number of bytes written is `buf.length - offset`. Change it to: If the buffer has sufficient space from the offset, the string is written upto `length`. If the buffer is short in space, only `buf.length - offset` bytes are written. Refs: #32104 (comment) PR-URL: #32119 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
`buffer.write` documentation has an incaccuracy w.r.t the `length` parameter: It says default number of bytes written is `buf.length - offset`. Change it to: If the buffer has sufficient space from the offset, the string is written upto `length`. If the buffer is short in space, only `buf.length - offset` bytes are written. Refs: #32104 (comment) PR-URL: #32119 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
The test wanted to cut huge string into 1KB strings, for which a new line character was inserted at appropriate places. The value is different in Windows (10, 13). Make it portable, by making use of os.EOL semantics Refs: #25988 PR-URL: #32104 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
`buffer.write` documentation has an incaccuracy w.r.t the `length` parameter: It says default number of bytes written is `buf.length - offset`. Change it to: If the buffer has sufficient space from the offset, the string is written upto `length`. If the buffer is short in space, only `buf.length - offset` bytes are written. Refs: #32104 (comment) PR-URL: #32119 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
The test wanted to cut huge string into 1KB strings,
for which a new line character was inserted at appropriate
places. The value is different in Windows (10, 13).
Make it portable, by making use of os.EOL semantics
Refs: #25988
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes