Bug 235445

Summary: [PATCH] editors/nvi-devel: Avoid "Text file busy" error when editing a script
Product: Ports & Packages Reporter: Craig Leres <leres>
Component: Individual Port(s)Assignee: Johan van Selst <johans>
Status: New ---    
Severity: Affects Only Me Flags: bugzilla: maintainer-feedback? (johans)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Description Flags
patch leres: maintainer-approval?

Description Craig Leres freebsd_committer 2019-02-03 00:52:38 UTC
I found that unlike the base vi (nvi 2.1.3), nvi-devel calls flock() on a writable file descriptor. This has the unfortunately side effect of causing the "Text file busy" error when you edit a script in one window and try to run it in another.

The fix is to change the initial open() just prior to calling file_lock() in file_init() to use O_RDONLY instead of O_RDWR. This does not impact nvi's ability to write files, nvi creates a new file when writing.
Comment 1 Craig Leres freebsd_committer 2019-02-03 00:53:15 UTC
Created attachment 201664 [details]