Bug 235445 - [PATCH] editors/nvi-devel: Avoid "Text file busy" error when editing a script
Summary: [PATCH] editors/nvi-devel: Avoid "Text file busy" error when editing a script
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Craig Leres
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-03 00:52 UTC by Craig Leres
Modified: 2019-03-21 17:21 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (johans)


Attachments
patch (1.31 KB, patch)
2019-02-03 00:53 UTC, Craig Leres
leres: maintainer-approval?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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]
patch
Comment 2 commit-hook freebsd_committer 2019-03-21 17:12:33 UTC
A commit references this bug:

Author: leres
Date: Thu Mar 21 17:12:16 UTC 2019
New revision: 496474
URL: https://svnweb.freebsd.org/changeset/ports/496474

Log:
  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.

  PR:		235445
  Approved by:	johans (maintainer timeout, 6 weeks), ler (mentor, implicit)

Changes:
  head/editors/nvi-devel/Makefile
  head/editors/nvi-devel/files/patch-common_exf.c