Stage #LE5 failing with "copy_file_range: is a directory" error

I’m doing some refactoring, and for some reason I’m now failing Stage #LE5 with a strange error.

Link to GitHub repo

[tester::#LE5] Running tests for Stage #LE5 (Quoting - Backslash within single quotes)
[tester::#LE5] [setup] export PATH=/tmp/orange/grape/banana:$PATH
[tester::#LE5] Running ./your_program.sh
[tester::#LE5] [setup] echo -n "banana blueberry." > "/tmp/bee/no slash 70"
[tester::#LE5] [setup] echo -n "blueberry raspberry." > "/tmp/bee/one slash \\12"
[tester::#LE5] [setup] echo "banana raspberry." > "/tmp/bee/two slashes \\84\\"
[your-program] $ echo 'example\\nhello'
[your-program] example\\nhello
[tester::#LE5] ✓ Received expected response
[your-program] $ echo 'shell\"scripttest\"example'
[your-program] shell\"scripttest\"example
[tester::#LE5] ✓ Received expected response
[your-program] $ echo 'test\\nhello'
[your-program] test\\nhello
[tester::#LE5] ✓ Received expected response
[your-program] $ cat /tmp/bee/'no slash 70' /tmp/bee/'one slash \12' /tmp/bee/'two slashes \84\'
[your-program] cat: /tmp/bee/: write /dev/stdout: copy_file_range: is a directory
[tester::#LE5] ^ Line does not match expected value.
[tester::#LE5] Expected: "banana blueberry.blueberry raspberry.banana raspberry."
[tester::#LE5] Received: "cat: /tmp/bee/: write /dev/stdout: copy_file_range: is a directory"
[your-program] cat: no slash 70: No such file or directory
[your-program] cat: /tmp/bee/: write /dev/stdout: copy_file_range: is a directory
[your-program] cat: one slash \12: No such file or directory
[your-program] cat: /tmp/bee/: write /dev/stdout: copy_file_range: is a directory
[your-program] cat: two slashes \84\: No such file or directory
[your-program] $ 
[tester::#LE5] Assertion failed.
[tester::#LE5] Test failed

Try setting a breakpoint for debugging in the part of code where ‘cat’ command is processed, and then see how this is thrown:

[your-program] cat: /tmp/bee/: write /dev/stdout: copy_file_range: is a directory

It is an odd error indeed, out of my caliber. Just suggesting about putting a breakpoint.

It looks like incorrect parsing. You are asked to cat the file /tmp/bee/’no slash 70’, which is equivalent to /tmp/bee/no slash 70 but note the error in the output cat: /tmp/bee/: write ….

A very brief look, I am just guessing it might be your main parsing loop starts parsing get_normal_arg but then you encounter ' which breaks you of the loop inside get_normal_arg and parse the first part as /tmp/bee/ with the last forward slash which also matches your error. Not sure what happens after but look like you check it was empty (it is not) in check_empty_quoted_arg , and you then parse 'no slash 70’ as a separate token perhaps and you also get an error there cat: no slash 70: No such file or directory.

So does look like you have a bug handling single quotes.

1 Like