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.



Re: CVS commit: src/lib/libc/time

2016-03-22 Thread Brian Ginsbach
On Fri, Mar 18, 2016 at 02:02:21PM +, Christos Zoulas wrote:
> In article <20160318124125.42d61f...@cvs.netbsd.org>,
> Brian Ginsbach <source-changes-d@NetBSD.org> wrote:
> >-=-=-=-=-=-
> >
> >Module Name: src
> >Committed By:ginsbach
> >Date:Fri Mar 18 12:41:25 UTC 2016
> >
> >Modified Files:
> > src/lib/libc/time: localtime.c
> >
> >Log Message:
> >Use the correct upper bounds for the types array.  The correct upper
> >bound is typecnt not timecnt.  Now perpetual 'standard' time zones
> >will work correctly as they have a typecnt of 1 but a timecnt of 0.
> 
> Does this need to be pulled up to -7?
> 

Yes, in part as only tzgetname() is in -7; tzgetgmtoff() isn't.

Brian


Re: CVS commit: src/lib/libc/time

2015-10-30 Thread Brian Ginsbach
On Thu, Oct 29, 2015 at 10:27:48PM -0600, Warner Losh wrote:
> On Thu, Oct 29, 2015 at 9:06 PM, Brian Ginsbach <ginsb...@netbsd.org> wrote:
> 
> > On Thu, Oct 29, 2015 at 06:38:48PM -0800, Warner Losh wrote:
> > >
> > > > On Oct 29, 2015, at 8:06 PM, Robert Elz <k...@munnari.oz.au> wrote:
> > > >
> > > >Date:    Fri, 30 Oct 2015 01:49:36 +
> > > >From:"Brian Ginsbach" <ginsb...@netbsd.org>
> > > >Message-ID:  <20151030014936.3fd4...@cvs.netbsd.org>
> > > >
> > > >  | Reject timezone offsets more than 12 hours (east or west).
> > > >
> > > > That's definitely incorrect.
> > > >
> > > > andromeda$ TZ=Pacific/Auckland date +"%c %z"
> > > > Fri Oct 30 15:04:08 2015 +1300
> > > >
> > > > That's right now (or a minute or two ago).
> > > >
> > > > Offsets of +1400 have been seen as well, and +1500 isn't out of the
> > > > question.   I'm not sure if -1300 has ever been used, but probably.
> > > >
> > > > If you need limits, limit it to +/- 2400
> > >
> > > The problem is that the international date line doesn?t follow
> > > 180E exactly. There?s deviations and some islands are a day
> > > ahead of where they?d otherwise be. And these move from
> > > time to time. Apia in Samoa is GMT+1400. Pago Pago, just a
> > > few miles away is GMT-1300.
> > >
> > > As I write this it is Fri Oct 30 at 4:37pm in Apia and The Oct 29
> > > at 3:37 in Pago Pago.
> > >
> > > A limit of +/- 1200 is totally bogus. Time doesn?t work that way.
> > >
> >
> > No not totaly bogus if you equate 12 hours with 15 degrees of
> > longitude.  This means that given a fixed reference, i.e. prime
> > merdian, that no place would be further than 12 hours ahead or
> > behind.
> >
> > More investigation and direct evidence have proven that the above
> > logic falls down because of the peculiarities of the time zone
> > conventions especially relating to the international date line.
> >
> > It also proves that it is best not to trust other implementations
> > without doing more research.
> >
> 
> Timekeeping is complicated. A lot more complicated than you might
> think approaching the topic new.

Very well aware that it is very complicated especailly with regards
to civil time keeping.  The crazy way which time zones have changed
over time is especially vexing.

The above, 12 hour limit, applies to nautical and military time
zones (A-I,K-Z) as these are limited to +12/-12.  The mistake was
not taking into account that ISO 8601 and RFC 3339 allow for offsets
of 23:59.  As you've probably seen the mistake has been corrected.

> 
> https://www.youtube.com/watch?v=-5wpm-gesOY
> 
> is an excellent resource for all the insanity that goes on with time zones
> and how what you think you know about time zones is likely wrong.
> They are not all one hour increments. They aren't even in 15 minute
> increments. There are regions of the world where different timezones
> occupy the same physical space. And there's offsets greater than 12 hours
> from UTC. Heck, there's some that are more than an hour off from
> the 15-degree offset you'd expect, some several hours.
> 

Good video but doesn't present anything new to me.

Brian


Re: CVS commit: src/lib/libc/time

2015-07-08 Thread Brian Ginsbach
On Wed, Jul 08, 2015 at 07:30:45PM +, Christos Zoulas wrote:
 In article 20150708184409.81c2...@cvs.netbsd.org,
 Brian Ginsbach source-changes-d@NetBSD.org wrote:
 -=-=-=-=-=-
 
 Module Name: src
 Committed By:ginsbach
 Date:Wed Jul  8 18:44:09 UTC 2015
 
 Modified Files:
  src/lib/libc/time: strptime.c
 
 
 I thought about renaming too, but this just makes diffing
 with FreeBSD (where this code came from) more difficult.
 Unless of course you are planning to change the code a lot,
 where diffing does not make sense any more.
 

More changes coming.  Plus the rest of strptime() doesn't really look like
FreeBSD's either.  These changes make it easier to understand these and
the follow-on changes.


Re: CVS commit: src/lib/libc/time

2015-07-08 Thread Brian Ginsbach

On Wed, Jul 08, 2015 at 11:46:57AM -0700, Hisashi T Fujinaka wrote:
 No commit message?

It was fixed shortly afterwards.

 
 On Wed, 8 Jul 2015, Brian Ginsbach wrote:
 
 Module Name: src
 Committed By:ginsbach
 Date:Wed Jul  8 18:44:09 UTC 2015
 
 Modified Files:
  src/lib/libc/time: strptime.c
 
 


Re: CVS commit: src/lib/libc/time

2015-04-06 Thread Brian Ginsbach
On Mon, Apr 06, 2015 at 07:10:27PM +0200, Alan Barrett wrote:
 On Mon, 06 Apr 2015, Brian Ginsbach wrote:
 Module Name: src
 Committed By:ginsbach
 Date:Mon Apr  6 14:38:22 UTC 2015
 
 Modified Files:
  src/lib/libc/time: strptime.3 strptime.c
 
 Log Message:
 Add UTC as a synonym for GMT (%Z).  [from FreeBSD]
 
 The %z format (which is distinct from %Z) already accepts GMT and UT.
 If we are going to accept UTC as well, which I think is a good idea, then
 please allow both %z and %Z to accept all three of UT, UTC, and GMT.

It wasn't added to %Z (originally) as it wasn't (isn't) in the
classic three letter time zone, zoneinfo style.  UTC is in
the classic three letter time zone, zoneinfo style.

That %z accepts GMT and UT not UTC is that UTC isn't
specified in RFC-822/RFC-2822.  Maybe not the best reason but there
it is.  Maybe it should (be liberal in what you accept).  Now
since these are NetBSD extensions it probably wouldn't hurt to have
both %z and %Z understand GMT, UT, UCT (yet another alias), and
UTC.

An interesting aside, the GNU C Library simply ignores the string
specified for %Z (makes no conversion and simply advances to the
next whitespace).  FreeBSD, NetBSD, and MacOS X all treat an unknown
(non-local TZ and not GMT) time zone as an error and stop parsing.

--
Brian Ginsbach