Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paste: handle list ending with unescaped backslash #3661

Merged
merged 2 commits into from
Apr 28, 2023

Conversation

cakebaker
Copy link
Contributor

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:/coreutils/coreutils/blob/master/tests/misc/paste.pl pass.

@cakebaker
Copy link
Contributor Author

Hm, looks like it doesn't work on Windows...

@github-actions
Copy link

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?

@sylvestre
Copy link
Contributor

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.

@sylvestre
Copy link
Contributor

@cakebaker still interested by this PR ?

@github-actions
Copy link

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?

@github-actions
Copy link

github-actions bot commented Apr 3, 2023

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?

@sylvestre
Copy link
Contributor

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
 

@github-actions
Copy link

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!

@cakebaker cakebaker marked this pull request as ready for review April 28, 2023 14:03
@cakebaker
Copy link
Contributor Author

As I'm unable to fix the Windows-related issue I disabled the failing test for Windows.

@sylvestre
Copy link
Contributor

Sounds good, especially with "Congrats! The gnu test tests/misc/paste is no longer failing!" :)

@sylvestre sylvestre merged commit 9f98471 into uutils:main Apr 28, 2023
@cakebaker cakebaker deleted the unescaped_backslash branch April 28, 2023 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants