Uh oh!
There was an error while loading. Please reload this page.
test: use portable EOL - #32104
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
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot
commented
Mar 7, 2020
gireeshpunathil
commented
Mar 7, 2020
the modified test is failing in windows (10 and 2016) with one byte loss! can't think of a reason! |
addaleax
commented
Mar 9, 2020
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. |
gireeshpunathil
commented
Mar 9, 2020
great catch @addaleax !! I never knew we were loosing one byte and getting it back from |
addaleax
commented
Mar 9, 2020
@gireeshpunathil You can reproduce this pretty easily on UNIX, too, by replacing |
HarshithaKP
commented
Mar 9, 2020
@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. |
nodejs-github-bot
commented
Mar 9, 2020
nodejs-github-bot
commented
Mar 10, 2020
nodejs-github-bot
commented
Mar 13, 2020
addaleax
commented
Mar 13, 2020
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