CVS commit: src/usr.bin/shar

2023-01-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jan 25 19:52:14 UTC 2023

Modified Files:
src/usr.bin/shar: shar.1

Log Message:
shar.1: remove false security claim

It's easy to embed arbitrary shell code in a line starting with 'X',
which the suggested egrep command would fail to detect.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/shar/shar.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/shar/shar.1
diff -u src/usr.bin/shar/shar.1:1.13 src/usr.bin/shar/shar.1:1.14
--- src/usr.bin/shar/shar.1:1.13	Mon Jul  3 21:34:21 2017
+++ src/usr.bin/shar/shar.1	Wed Jan 25 19:52:14 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: shar.1,v 1.13 2017/07/03 21:34:21 wiz Exp $
+.\"	$NetBSD: shar.1,v 1.14 2023/01/25 19:52:14 rillig Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)shar.1	8.1 (Berkeley) 6/6/93
 .\"
-.Dd June 6, 1993
+.Dd January 25, 2023
 .Dt SHAR 1
 .Os
 .Sh NAME
@@ -93,9 +93,3 @@ files.
 It is strongly recommended that all shell archive files be examined
 before running them through
 .Xr sh 1 .
-Archives produced using this implementation of
-.Nm
-may be easily examined with the command:
-.Bd -literal -offset indent
-egrep -v '^[X#]' shar.file
-.Ed



CVS commit: src/usr.bin/shar

2023-01-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jan 25 19:52:14 UTC 2023

Modified Files:
src/usr.bin/shar: shar.1

Log Message:
shar.1: remove false security claim

It's easy to embed arbitrary shell code in a line starting with 'X',
which the suggested egrep command would fail to detect.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/shar/shar.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/shar

2022-12-30 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Sat Dec 31 03:44:18 UTC 2022

Modified Files:
src/usr.bin/shar: shar.sh

Log Message:
shar: send usage message to standard error so it is not swallowd by
redirection.

>From FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/shar/shar.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/shar/shar.sh
diff -u src/usr.bin/shar/shar.sh:1.5 src/usr.bin/shar/shar.sh:1.6
--- src/usr.bin/shar/shar.sh:1.5	Sat Dec 31 03:38:59 2022
+++ src/usr.bin/shar/shar.sh	Sat Dec 31 03:44:18 2022
@@ -1,6 +1,6 @@
 #!/bin/sh -
 #
-#	$NetBSD: shar.sh,v 1.5 2022/12/31 03:38:59 ginsbach Exp $
+#	$NetBSD: shar.sh,v 1.6 2022/12/31 03:44:18 ginsbach Exp $
 #
 # Copyright (c) 1990, 1993
 #	The Regents of the University of California.  All rights reserved.
@@ -33,7 +33,7 @@
 #
 
 if [ $# -eq 0 ]; then
-	echo 'usage: shar file ...'
+	echo 'usage: shar file ...' 1>&2
 	exit 1
 fi
 



CVS commit: src/usr.bin/shar

2022-12-30 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Sat Dec 31 03:44:18 UTC 2022

Modified Files:
src/usr.bin/shar: shar.sh

Log Message:
shar: send usage message to standard error so it is not swallowd by
redirection.

>From FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/shar/shar.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/shar

2022-12-30 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Sat Dec 31 03:38:59 UTC 2022

Modified Files:
src/usr.bin/shar: shar.sh

Log Message:
better handle special characters or white space in file names fed to shar

Code from Dave Sainty in PR bin/11107


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/shar/shar.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/shar

2022-12-30 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Sat Dec 31 03:38:59 UTC 2022

Modified Files:
src/usr.bin/shar: shar.sh

Log Message:
better handle special characters or white space in file names fed to shar

Code from Dave Sainty in PR bin/11107


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/shar/shar.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/shar/shar.sh
diff -u src/usr.bin/shar/shar.sh:1.4 src/usr.bin/shar/shar.sh:1.5
--- src/usr.bin/shar/shar.sh:1.4	Sat Dec 31 03:33:53 2022
+++ src/usr.bin/shar/shar.sh	Sat Dec 31 03:38:59 2022
@@ -1,6 +1,6 @@
 #!/bin/sh -
 #
-#	$NetBSD: shar.sh,v 1.4 2022/12/31 03:33:53 ginsbach Exp $
+#	$NetBSD: shar.sh,v 1.5 2022/12/31 03:38:59 ginsbach Exp $
 #
 # Copyright (c) 1990, 1993
 #	The Regents of the University of California.  All rights reserved.
@@ -56,13 +56,13 @@ echo "#"
 
 for i
 do
-	if [ -d $i ]; then
-		echo "echo c - $i"
-		echo "mkdir -p $i > /dev/null 2>&1"
+	if [ -d "$i" ]; then
+		echo "echo c - '$i'"
+		echo "mkdir -p '$i' > /dev/null 2>&1"
 	else
-		echo "echo x - $i"
-		echo "sed 's/^X//' >$i << 'END-of-$i'"
-		sed 's/^/X/' $i || exit 1
+		echo "echo x - '$i'"
+		echo "sed 's/^X//' >'$i' << 'END-of-$i'"
+		sed 's/^/X/' "$i" || exit 1
 		echo "END-of-$i"
 	fi
 done



CVS commit: src/usr.bin/shar

2022-12-30 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Sat Dec 31 03:33:53 UTC 2022

Modified Files:
src/usr.bin/shar: shar.sh

Log Message:
make sure a sed failure in the generated archive stops execution

Code from Dave Sainty in PR bin/11107 (similar in FreeBSD)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/shar/shar.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/shar/shar.sh
diff -u src/usr.bin/shar/shar.sh:1.3 src/usr.bin/shar/shar.sh:1.4
--- src/usr.bin/shar/shar.sh:1.3	Thu Jun 30 02:36:35 2005
+++ src/usr.bin/shar/shar.sh	Sat Dec 31 03:33:53 2022
@@ -1,6 +1,6 @@
 #!/bin/sh -
 #
-#	$NetBSD: shar.sh,v 1.3 2005/06/30 02:36:35 perry Exp $
+#	$NetBSD: shar.sh,v 1.4 2022/12/31 03:33:53 ginsbach Exp $
 #
 # Copyright (c) 1990, 1993
 #	The Regents of the University of California.  All rights reserved.
@@ -62,7 +62,7 @@ do
 	else
 		echo "echo x - $i"
 		echo "sed 's/^X//' >$i << 'END-of-$i'"
-		sed 's/^/X/' $i
+		sed 's/^/X/' $i || exit 1
 		echo "END-of-$i"
 	fi
 done



CVS commit: src/usr.bin/shar

2022-12-30 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Sat Dec 31 03:33:53 UTC 2022

Modified Files:
src/usr.bin/shar: shar.sh

Log Message:
make sure a sed failure in the generated archive stops execution

Code from Dave Sainty in PR bin/11107 (similar in FreeBSD)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/shar/shar.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.