When opening a nonexistent file such as sudo:/root/nonexist: shell returned 1 Press ENTER or type command to continue When I open the buffer it is pre-filled with: cat: /root/nonexist: No such file or directory Ideally app-vim/sudo should open with an empty buffer instead. Portage 2.1.1-r2 (default-linux/amd64/2006.1, gcc-4.1.1, glibc-2.4-r4, 2.6.18-gentoo-r4-bd1 x86_64) ================================================================= System uname: 2.6.18-gentoo-r4-bd1 x86_64 AMD Turion(tm) 64 X2 Mobile Technology TL-50 Gentoo Base System version 1.12.6 Last Sync: Fri, 15 Dec 2006 04:30:01 +0000 ccache version 2.3 [disabled] app-admin/eselect-compiler: [Not Present] dev-java/java-config: [Not Present] dev-lang/python: 2.4.3-r4 dev-python/pycrypto: 2.0.1-r5 dev-util/ccache: 2.3 dev-util/confcache: [Not Present] sys-apps/sandbox: 1.2.17 sys-devel/autoconf: 2.13, 2.60 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2 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.11-r2 ACCEPT_KEYWORDS="amd64" AUTOCLEAN="yes" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=athlon64 -O2 -pipe" 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" CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo" CXXFLAGS="-O2 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig buildpkg collision-protect confcache distlocks metadata-transfer parallel-fetch sandbox sfperms strict userfetch userpriv usersandbox" GENTOO_MIRRORS="http://www.gtlib.gatech.edu/pub/gentoo http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/ " LANG="en_US.UTF-8" MAKEOPTS="-j3" 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'" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/portage/local/layman/haskell /usr/portage/local/layman/berkano" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="amd64 X aac aalib acl adns alsa amr asf ass bdf berkdb bitmap-fonts bzip2 cjk cli cracklib crypt cscope cups dbus dlloader dri dvd ecc elibc_glibc fam flac fortran gdbm gif glitz gpm iconv idea imlib immqt input_devices_keyboard input_devices_mouse input_devices_synaptics ipv6 isdnlog jingle jpeg kde kdeenablefinal kernel_linux libcaca libg++ mad mng mp3 mp4 multicall musepack ncurses network nls nptl nptlonly ogg openal opengl pam pcre perl png ppds pppd python qt3 qt4 rdesktop readline reflection rle rtc ruby session smp speex spell spl sqlite ssl svg tcpd theora threads tiff truetype truetype-fonts type1-fonts udev unicode userland_GNU video_cards_nv video_cards_vesa vim-pager vim-with-x vorbis wifi x264 xcomposite xorg xscreensaver xv xvid xvmc zlib" Unset: CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_RSYNC_EXTRA_OPTS
I've been wondering if it's worth to fix this one.. You can already set your EDITOR to vim and run sudo -e to edit a file instead of this unmaintained,insecure script imo. Anyway editing the exec function in SudoRead() like below wfm. - exec '1read !sudo cat "'.file.'" ' + exec '1read !sudo cat "'.file.'" 2>/dev/null'
As was said, the functionality of this package can be fulfilled better by just using sudo -e. This package has been package masked and will be removed from the tree in 30 days.
(In reply to comment #2) > As was said, the functionality of this package can be fulfilled better by just > using sudo -e. This package has been package masked and will be removed from > the tree in 30 days. I see the only purpose when you opened, e.g. make.conf as a normal user, started editing it and then realize that you weren't root. Is there a way, to give a running vim root permissions. Something like an u+s but at runtime? Then this script could be replaced by a "becomeRoot" script. The sudo password prompt anyway wasn't working with gvim - but the possibility of granting a running vim root privileges saves work.
I agree to Florian, this is a *very* useful script. For example, sometimes i'm editing /etc/portage/package.use, make my changes and *whops* i forgot to prepend "sudo". In this case, i have to save the file with another name and "sudo mv" it, or i have to omit my changes and edit the file again. Or i enter "SudoWrite %" so save the file in place. "sudo -e" is not an alternative because apps-vim/sudo is an sheet anchor in the case you forgot to prepend it.