head emits an extra trailing blank line on its default line count.
# /f = "x\n"
$ head /f
x
<- extra blank line; GNU prints "x\n"
Raw bytes:
| command |
just_bash |
GNU |
head /f |
"x\n\n" |
"x\n" |
echo x | head |
"x\n\n" |
"x\n" |
head /f /g |
"==> /f <==\nx\n\n\n==> /g <==\nhi\n\n" |
"==> /f <==\nx\n\n==> /g <==\nhi\n" |
It is specific to the default line count. The explicit form is correct:
head -n1 /f -> "x\n" matches GNU
head -n1 - /f -> "==> standard input <==\nSSS\n\n==> /f <==\nFFF\n" matches GNU
So the bug is in the default-count path of take_content / format_head_output in
lib/just_bash/commands/head.ex, not in the multi-file separator logic — the multi-file case just makes
it visible twice.
Anything byte-comparing head output gets a spurious diff, and x=$(head f) picks up the extra newline
before command substitution strips it (so that particular spelling hides it, which is part of why it has
survived).
Worth checking tail for the same shape, since the two share their default-count handling.
Pre-existing. Reproduced byte-identically at bb55214 and d59d84d, and unrelated to the - operand
work in PR #74 (head.ex's take_content/format_head_output were not modified there), which is why it
was deferred.
Found by an independent verification pass while working #70.
heademits an extra trailing blank line on its default line count.Raw bytes:
head /f"x\n\n""x\n"echo x | head"x\n\n""x\n"head /f /g"==> /f <==\nx\n\n\n==> /g <==\nhi\n\n""==> /f <==\nx\n\n==> /g <==\nhi\n"It is specific to the default line count. The explicit form is correct:
So the bug is in the default-count path of
take_content/format_head_outputinlib/just_bash/commands/head.ex, not in the multi-file separator logic — the multi-file case just makesit visible twice.
Anything byte-comparing
headoutput gets a spurious diff, andx=$(head f)picks up the extra newlinebefore command substitution strips it (so that particular spelling hides it, which is part of why it has
survived).
Worth checking
tailfor the same shape, since the two share their default-count handling.Pre-existing. Reproduced byte-identically at
bb55214andd59d84d, and unrelated to the-operandwork in PR #74 (
head.ex'stake_content/format_head_outputwere not modified there), which is why itwas deferred.
Found by an independent verification pass while working #70.