Bug
The GNU F command — print the current input filename, followed by a
newline — is not implemented.
Reproduction
$ echo abc | /usr/bin/sed -n 'F' /etc/hostname
/etc/hostname
$ echo abc | ./target/release/sed -n 'F' /etc/hostname
sed: <script argument 1>:1:1: error: invalid command code `F'
What it should do
From GNU sed manual:
F Print out the file name of the current input file (with a trailing newline).
Behaviour notes:
- Output goes to stdout (like
=, p).
- For stdin, GNU prints
-.
- Honors
-z (NUL-separated output) — see nulldata.sh.
- Accepts an address range like other GNU extensions.
- Rejected under
--posix (already handled by the existing
bad_command(OPT) path; once F is added, the --posix rejection
test in compile-errors will keep working as expected).
Suspected place to add it
src/sed/compiler.rs:1276 — get_cmd_spec:
'F' => Ok(CommandSpec {
n_addr: 2,
handler: compile_empty_command, // F takes no args
}),
…plus a corresponding execution case in src/sed/processor.rs (search
for the match cmd.code near processor.rs:635). The processor
already has access to the current input filename via the same path that
-i uses to compute backup names — see src/sed/in_place.rs for how
filenames are tracked.
Affected GNU testsuite tests
follow-symlinks, nulldata. Also unblocks the F parts of
follow-symlinks-stdin.
Bug
The GNU
Fcommand — print the current input filename, followed by anewline — is not implemented.
Reproduction
What it should do
From GNU sed manual:
Behaviour notes:
=,p).-.-z(NUL-separated output) — seenulldata.sh.--posix(already handled by the existingbad_command(OPT)path; onceFis added, the--posixrejectiontest in
compile-errorswill keep working as expected).Suspected place to add it
src/sed/compiler.rs:1276—get_cmd_spec:…plus a corresponding execution case in
src/sed/processor.rs(searchfor the
match cmd.codenearprocessor.rs:635). The processoralready has access to the current input filename via the same path that
-iuses to compute backup names — seesrc/sed/in_place.rsfor howfilenames are tracked.
Affected GNU testsuite tests
follow-symlinks,nulldata. Also unblocks theFparts offollow-symlinks-stdin.