At 2025-02-23T23:52:07+0100, onf wrote: > I would argue that the fact the second argument to lf is not used by > groff to access the file system doesn't change its semantics of being > a filename. Especially since soelim emits lf requests for all the .so > calls it replaces, meaning that whatever is accepted by .so must also > be accepted by lf.
I'd say that soelim(1) transforms the file name argument to the `so`
into something that _isn't a file name_, but setting that brightly-drawn
line aside, you have a good argument.
Looks like it'd be easy enough to do...
(some minutes later)
Here's a patch.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 2656ff236..cf750bc73 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -6405,12 +6405,14 @@ void line_file()
{
int n;
if (get_integer(&n)) {
- const char *filename = 0 /* nullptr */;
if (has_arg()) {
- symbol s = get_long_name();
- filename = s.contents();
+ const char *reported_file_name = read_string();
+ (void) input_stack::set_location(reported_file_name, (n - 1));
+ delete[] reported_file_name;
+ tok.next();
+ return;
}
- (void) input_stack::set_location(filename, (n - 1));
+ (void) input_stack::set_location(0 /* nullptr */, (n - 1));
}
skip_line();
}
While I was at it, in changes not shown, I fixed the file_iterator class
to be more careful with memory, and more reliably freed heap memory
allocated by `read_string()` when called by other functions.
Any objections to this being in my next push?
Regards,
Branden
signature.asc
Description: PGP signature
