On 1/11/26 11:07, Paul Eggert wrote:
On 2026-01-11 01:21, Alexander Jones wrote:
Whether Antonio wants to expend the coding effort to do a stat call to check whether the filename is an actual directory just for proper diagnostic output is up to him.
There is no need for a stat call. Just open the file and read it as usual. If that fails, diagnose the problem as usual.
The coding effort here is simple: remove the code that checks whether the file name is empty or ends in "/". This simplifies things (and makes "ed" a tiny bit smaller and faster - isn't that the point of "ed"? :-).
Just as with other GNU utilities, I have sought to expand upon the original code to better align it with modern needs, while maintaining full backward compatibility (see: https://github.com/slewsys/ed). Unfortunately, Antonio broke the code that he inherited in ways that continues to surprise me. I'm sorry that GNU tolerates that. While I misread Mr. McIlroy's bug report, it did lead me to discover an inconsistency with traditional code (to the extent that Solaris is traditional) - namely how directory arguments are handled. So, although undocumented, I think it's fair to ask whether traditional behavior of discarding directory arguments and not raising an error is preferred, even if that requires and extra `stat'.
