Despite invoking the nvi ":set nolock" command there are still locks on the file that is being edited which prevent certain actions. If the file is a script you get EBUSY when you try to run it. Reproducible: Always Steps to Reproduce: 1. echo -e "#! /bin/sh\necho hello" > runme 2. chmod 755 runme 3. nvi runme 4. :set nolock 5. ^Z 6. ./runme Actual Results: -bash: ./runme: /bin/sh: bad interpreter: Text file busy Expected Results: hello world Lock is set with this system call as observed via strace: flock(5, LOCK_EX|LOCK_NB)
Bug exists in: app-editors/nvi 1.81.5-r5 $ emerge --info nvi Portage 2.1.2.2 (default-linux/amd64/2006.1, gcc-4.1.1, glibc-2.5-r0, 2.6.18-gentoo-r6 x86_64) ================================================================= System Settings ================================================================= System uname: 2.6.18-gentoo-r6 x86_64 AMD Opteron(tm) Processor 246 Gentoo Base System release 1.12.9 Timestamp of tree: Wed, 14 Mar 2007 10:20:01 +0000 dev-java/java-config: 1.3.7, 2.0.31-r4 dev-lang/python: 2.3.5-r3, 2.4.3-r4 dev-python/pycrypto: 2.0.1-r5 sys-apps/sandbox: 1.2.17 sys-devel/autoconf: 2.13, 2.61 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10 sys-devel/binutils: 2.16.1-r3 sys-devel/gcc-config: 1.3.14 sys-devel/libtool: 1.5.22 virtual/os-headers: 2.6.17-r2 ACCEPT_KEYWORDS="amd64" AUTOCLEAN="yes" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -fomit-frame-pointer -pipe -march=k8" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config /var/bind" CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/terminfo" CXXFLAGS="-O2 -fomit-frame-pointer -pipe -march=k8" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict" GENTOO_MIRRORS="http://mirror.datapipe.net/gentoo http://gentoo.mirrors.tds.net/gentoo http://open-systems.ufl.edu/mirrors/gentoo" LANG="en_US.UTF-8" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.us.gentoo.org/gentoo-portage" USE="X Xaw3d a52 aac acpi alsa amd64 audiofile bash-completion berkdb bidi bitmap-fonts bzip2 cdda cddb cdparanoia cli cracklib crypt cups dbus djvu dri dts dv dvd dvdr dvdread emacs esd fam ffmpeg flac foomaticdb fortran gdbm gif gnome gnutls gpm gtk gtk2 gtkhtml hal httpd iconv immqt-bc isdnlog java jpeg jpeg2k kqemu lame libg++ live mad matroska midi mjpeg mozbranding mozcalendar mozilla moznopango mp3 mp4 mp4live mpeg mpeg2 mplayer musepack ncurses network nls no-old-linux nptl nptlonly nsplugin ogg opengl pam pcap pcre pdf perl png portaudio ppds pppd python qt3 quicktime readline realmedia reflection rtsp sdl sdl-image session shout spell spl ssl stream tcl tcpd theora threads tiff tk truetype truetype-fonts type1-fonts unicode vcd vlm vorbis wma wmp wxwindows xext xorg xpm xvid xvmc zip zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="radeon" Unset: CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Thanks for the report. nolock (as well as several other no* options) is incorrectly taken as an abbreviation for noprint, because the wide character support (USE=unicode) is broken wrt. options parsing. To get the lock option unset without rebuilding nvi, you can use "set nolockxxxxxxxxxxxx" as a hack; I'll fix this properly shortly in -r6. Note that after fixing this, trying to run a script being edited still results in "Text file busy"; this is not caused by the flock() system call.
Fixed in -r6.