coreutils
coreutils copied to clipboard
paste: handle list ending with unescaped backslash
Show an error if the user provides a delimiter list ending with an unescaped backslash. For example, paste -d'\' will now show an error whereas paste -d'\\' will work fine.
This makes the tests delim-bs1 and delim-bs2 in https://github.com/coreutils/coreutils/blob/master/tests/misc/paste.pl pass.
Hm, looks like it doesn't work on Windows...
GNU testsuite comparison:
Congrats! The gnu test tests/misc/paste is no longer failing!
GNU test failed: tests/rm/rm2. tests/rm/rm2 is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/tail-2/inotify-dir-recreate. tests/tail-2/inotify-dir-recreate is passing on 'main'. Maybe you have to rebase?
Fails with:
---- test_paste::test_delimiter_list_ending_with_escaped_backslash stdout ----
write(default): C:\Users\RUNNER~1\AppData\Local\Temp\.tmpwTCa7y\in0
write(default): C:\Users\RUNNER~1\AppData\Local\Temp\.tmpwTCa7y\in1
run: D:\a\coreutils\coreutils\target\i686-pc-windows-msvc\debug\coreutils.exe paste -d \\ in0 in1
thread 'test_paste::test_delimiter_list_ending_with_escaped_backslash' panicked at 'assertion failed: `(left == right)`
Diff < left / right > :
<b
>a\b
', tests\by-util\test_paste.rs:172:14
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\panicking.rs:584
1: core::panicking::panic_fmt
at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\core\src\panicking.rs:142
2: tests::common::util::CmdResult::stdout_is<str>
at .\tests\common\util.rs:444
3: tests::test_paste::test_delimiter_list_ending_with_escaped_backslash
at .\tests\by-util\test_paste.rs:169
4: tests::test_paste::test_delimiter_list_ending_with_escaped_backslash::closure$0
at .\tests\by-util\test_paste.rs:160
5: core::ops::function::FnOnce::call_once<tests::test_paste::test_delimiter_list_ending_with_escaped_backslash::closure_env$0,tuple$<> >
at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52\library\core\src\ops\function.rs:248
6: core::ops::function::FnOnce::call_once
at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\core\src\ops\function.rs:248
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
failures:
test_paste::test_delimiter_list_ending_with_escaped_backslash
test result: FAILED. 2027 passed; 1 failed; 23 ignored; 0 measured; 0 filtered out; finished in 317.42s
error: test failed, to rerun pass '--test tests'
Error: Process completed with exit code 101.
@cakebaker still interested by this PR ?
GNU testsuite comparison:
Congrats! The gnu test tests/misc/paste is no longer failing!
GNU test failed: tests/tail-2/inotify-dir-recreate. tests/tail-2/inotify-dir-recreate is passing on 'main'. Maybe you have to rebase?
GNU testsuite comparison:
Congrats! The gnu test tests/misc/paste is no longer failing!
GNU test failed: tests/tail-2/inotify-dir-recreate. tests/tail-2/inotify-dir-recreate is passing on 'main'. Maybe you have to rebase?
Failed with:
---- test_paste::test_delimiter_list_ending_with_escaped_backslash stdout ----
write(default): C:\Users\RUNNER~1\AppData\Local\Temp\.tmpqnhKRi\in0
write(default): C:\Users\RUNNER~1\AppData\Local\Temp\.tmpqnhKRi\in1
run: D:\a\coreutils\coreutils\target\debug\coreutils.exe paste -d \\ in0 in1
thread 'test_paste::test_delimiter_list_ending_with_escaped_backslash' panicked at 'assertion failed: `(left == right)`
Diff < left / right > :
<b
>a\b
GNU testsuite comparison:
Congrats! The gnu test tests/misc/paste is no longer failing!
Congrats! The gnu test tests/tail-2/inotify-dir-recreate is no longer failing!
As I'm unable to fix the Windows-related issue I disabled the failing test for Windows.
Sounds good, especially with "Congrats! The gnu test tests/misc/paste is no longer failing!" :)