From a7b4b60ca182906d2d32a82b1cfe7ca6163855eb Mon Sep 17 00:00:00 2001 From: bad Date: Tue, 1 Aug 2006 17:59:17 +0000 Subject: Ensure that the file that is opened in the editor is writable by the user. Approved by wiz@. --- pkgtools/pkgdiff/Makefile | 4 ++-- pkgtools/pkgdiff/files/pkgvi | 6 ++++-- pkgtools/pkgdiff/files/pkgvi.0 | 7 ++++--- pkgtools/pkgdiff/files/pkgvi.1 | 7 +++++-- 4 files changed, 15 insertions(+), 9 deletions(-) (limited to 'pkgtools') diff --git a/pkgtools/pkgdiff/Makefile b/pkgtools/pkgdiff/Makefile index 3c660d5d6d2..06ff1f147ca 100644 --- a/pkgtools/pkgdiff/Makefile +++ b/pkgtools/pkgdiff/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.60 2006/04/28 06:51:14 jlam Exp $ +# $NetBSD: Makefile,v 1.61 2006/08/01 17:59:17 bad Exp $ # -DISTNAME= pkgdiff-0.118 +DISTNAME= pkgdiff-0.119 CATEGORIES= pkgtools devel MASTER_SITES= # empty DISTFILES= # empty diff --git a/pkgtools/pkgdiff/files/pkgvi b/pkgtools/pkgdiff/files/pkgvi index 6618dbffa1b..47c53bf6278 100755 --- a/pkgtools/pkgdiff/files/pkgvi +++ b/pkgtools/pkgdiff/files/pkgvi @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: pkgvi,v 1.9 2003/08/23 19:40:19 seb Exp $ +# $NetBSD: pkgvi,v 1.10 2006/08/01 17:59:17 bad Exp $ # # Copyright (c) 2001 Tomasz Luchowski. All rights reserved. # @@ -61,7 +61,8 @@ fi if [ -f $file.orig ] then - $editor $cmd $file + chmod u+w "$file" + $editor $cmd "$file" echo "$progname: Backup already exists. For a diff type:" echo "pkgdiff $file" exit 0 @@ -79,6 +80,7 @@ else fi cp "$file" "$tmp" +chmod u+w "$tmp" if [ $? -ne 0 ]; then echo "$progname: unable to create temporary file" diff --git a/pkgtools/pkgdiff/files/pkgvi.0 b/pkgtools/pkgdiff/files/pkgvi.0 index 6021813b23c..6383d541bff 100644 --- a/pkgtools/pkgdiff/files/pkgvi.0 +++ b/pkgtools/pkgdiff/files/pkgvi.0 @@ -1,7 +1,7 @@ PKGVI(1) NetBSD General Commands Manual PKGVI(1) NNAAMMEE - ppkkggvvii - run editor and make backup of given file if necessary + ppkkggvvii -- run editor and make backup of given file if necessary SSYYNNOOPPSSIISS ppkkggvvii [+command] _f_i_l_e @@ -11,7 +11,8 @@ DDEESSCCRRIIPPTTIIOONN file. If no changes are made in the editor, nothing happens. Else the original file is kept as _f_i_l_e_n_a_m_e_._o_r_i_g, and the modified file is saved as _f_i_l_e_n_a_m_e. If ppkkggvvii finds _f_i_l_e_n_a_m_e_._o_r_i_g, it behaves as normal editor and - changes are only made to _f_i_l_e_n_a_m_e, not affecting _f_i_l_e_n_a_m_e_._o_r_i_g. + changes are only made to _f_i_l_e_n_a_m_e, not affecting _f_i_l_e_n_a_m_e_._o_r_i_g. In both + cases ppkkggvvii ensures that the file to be edited is writable by the user. Available option: @@ -29,4 +30,4 @@ SSEEEE AALLSSOO AAUUTTHHOORRSS The pkgvi utility was written by Tomasz Luchowski . -NetBSD 1.6 May 28, 2003 NetBSD 1.6 +NetBSD 3.0_STABLE Aug 1, 2006 NetBSD 3.0_STABLE diff --git a/pkgtools/pkgdiff/files/pkgvi.1 b/pkgtools/pkgdiff/files/pkgvi.1 index d3860b7bf30..559374943d1 100644 --- a/pkgtools/pkgdiff/files/pkgvi.1 +++ b/pkgtools/pkgdiff/files/pkgvi.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkgvi.1,v 1.7 2003/05/28 14:53:51 seb Exp $ +.\" $NetBSD: pkgvi.1,v 1.8 2006/08/01 17:59:17 bad Exp $ .\" .\" Copyright (c) 2001 Tomasz Luchowski. All rights reserved. .\" @@ -29,7 +29,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 28, 2003 +.Dd Aug 1, 2006 .Dt PKGVI 1 .Os .Sh NAME @@ -58,6 +58,9 @@ it behaves as normal editor and changes are only made to .Pa filename , not affecting .Pa filename.orig . +In both cases +.Nm +ensures that the file to be edited is writable by the user. .Pp Available option: .Bl -tag -width indent -- cgit v1.2.3