Re: displaying Date using local timezone

2021-05-03 Thread Valdis Klētnieks
On Mon, 03 May 2021 09:30:46 +0100, Ralph Corderoy said:

> +0845  Australia/Eucla

To quote Casey Schaufler:

EGADS - Concept violates the principle of Least Astonishment.

And here in North America, we tease Newfoundland for being
on the half-hour.


pgp55RpIHwHdW.pgp
Description: PGP signature


Re: check if message is in a particular sequence?

2021-05-03 Thread Valdis Klētnieks
On Sun, 02 May 2021 19:23:06 +0100, Ralph Corderoy said:

> I went for -range because it's controlling the printing as ‘lo-hi’ and
> mh-sequence(5) already says things like
>
> A message range is specified as “name1-name2” or “name:n”, where
> `name', `name1' and `name2' are message names, and `n' is an
> integer.

So -range means "make it into a range if possible" and -norange doesn't.
I'm sold. :)

And yes, being able to say -norange is handy if you're doing something where
you're grabbing a range and then feeding it to a shell's "for i in $foo". (Over 
the
decades that's annoyed me - a big reason I don't use mark more is because I'm
usually using that to feed something else that doesn't grok "14-19"


pgpry30ACwrrf.pgp
Description: PGP signature


Re: fmttest(1) Suffers Segmentation Violation.

2021-05-03 Thread Ken Hornstein
>Hi,
>
>This dumps core for me.
>
>fmttest --x y -forma ''
>
>I've had a look at the code and I suspect it's an easy fix related to
>spotting no messages have been provided before attempting to loop from 0
>to 0 inclusive and indexing 0-1 but thought it better to leave the fix
>to someone more confident in what's meant to happen.  :-)

Oh, strangely enough ... it's because it's trying to call seq_setprev()
with no messages set.

So, I guess "-message" is the default.  And that suggests to me if you
don't give a message on the command line, it should default to 'cur'
like other nmh programs, unless people think it makes sense to fail
in that case.

(And I realize from reading the man page I never documented what
-file/-nofile means).

--Ken



Re: fmttest(1) Suffers Segmentation Violation.

2021-05-03 Thread Henrique Martins
Ralph>This dumps core for me.
Ralph>  fmttest --x y -forma ''

Ken> On MacOS X it returns nothing, but on Linux I do get a segfault.

Well, on my "linux" it returns nothing too, with
mh-1.7.1-13.fc34.x86_64.

-- Henrique



Re: fmttest(1) Suffers Segmentation Violation.

2021-05-03 Thread Ken Hornstein
>This dumps core for me.
>
>fmttest --x y -forma ''

Interesting.  On MacOS X it returns nothing, but on Linux I do get a
segfault.  Should be easy enough to track down, at least.

--Ken



fmttest(1) Suffers Segmentation Violation.

2021-05-03 Thread Ralph Corderoy
Hi,

This dumps core for me.

fmttest --x y -forma ''

I've had a look at the code and I suspect it's an easy fix related to
spotting no messages have been provided before attempting to loop from 0
to 0 inclusive and indexing 0-1 but thought it better to leave the fix
to someone more confident in what's meant to happen.  :-)

I did notice the man page suggests the ‘[msgs | strings]’ are optional
but the usage error has no brackets which tells me they're mandatory.

-- 
Cheers, Ralph.



Re: displaying Date using local timezone

2021-05-03 Thread Steven Winikoff
>I had an inkling that it might be bad for NMH to try to handle
>DST calculations on its own;

Tom Scott would agree:

   https://www.youtube.com/watch?v=-5wpm-gesOY

This is probably the best explanation I've ever seen of why time
zones and DST calculations induce madness.

 - Steven
-- 
___
Steven Winikoff  | "Some men see things as they are and ask
Montreal, QC, Canada |  'Why?'.  I dream things that never
s...@smwonline.ca |  were and ask, 'Why not?'."
http://smwonline.ca  |
 |- Robert F. Kennedy



Blast from the Past Patches.

2021-05-03 Thread Ralph Corderoy
Hi,

I've commits here I haven't pushed from a few years ago.  I've just
spent some time rebasing them onto 6618bcff and I've compiled and ‘make
check’ each one.  They're mainly source-code improvements, e.g. creating
or altering h/foo.h to match the existing sbr/foo.c or uip/foo.c and
moving the header file to sit alongside its C file, emptying the h
directory.  It's a continuation of the work I was doing back then before
life interrupted.

I'd like to get them pushed but wanted to warn other committers in case
they've unpushed commits of their own which would need much rework.
A summary of them, if I've got my Git right, is

Makefile.am |  28 ++--
config/config.c | 102 ++
h/aliasbr.h |  34 -
h/done.h|   9 --
h/dropsbr.h |  16 ---
h/fmt_scan.h| 269 
h/mf.h  |  36 -
h/mh.h  |  31 -
h/mhparse.h |  74 --
h/oauth.h   | 258 --
h/prototypes.h  |  18 ---
h/signals.h |  20 ---
h/utils.h   | 126 -
mts/smtp/smtp.c |   7 +-
sbr/addrsbr.c   |   8 +-
{h => sbr}/addrsbr.h|  76 +-
sbr/arglist.c   |   2 +-
sbr/base64.c|   2 +
sbr/brkstring.c |   2 +-
sbr/charstring.c|   3 +-
sbr/charstring.h|  36 +
sbr/client.c|   4 +-
sbr/concat.c|   2 +-
sbr/context_del.c   |   2 +-
sbr/context_foil.c  |   3 +-
sbr/context_read.c  |   2 +-
sbr/context_replace.c   |   2 +-
sbr/context_save.c  |   3 +-
sbr/crawl_folders.c |   2 +-
sbr/credentials.c   |   4 +-
sbr/datetime.c  |   6 +-
sbr/done.c  |   1 +
sbr/done.h  |   8 ++
sbr/dtime.c |   2 +-
sbr/dtimep.l|   2 +-
sbr/encode_rfc2047.c|   4 +-
sbr/error.c |   2 +-
sbr/escape_addresses.c  |   2 +-
sbr/ext_hook.c  |   2 +
sbr/fmt_addr.c  |   8 +-
sbr/fmt_compile.c   | 123 +
{h => sbr}/fmt_compile.h|  91 +++-
sbr/fmt_new.c   |   3 +-
sbr/fmt_rfc2047.c   |   2 +-
sbr/fmt_scan.c  |  16 ++-
sbr/fmt_scan.h  |  58 
sbr/folder_delmsgs.c|   3 +-
sbr/folder_free.c   |   2 +-
sbr/folder_read.c   |   2 +-
sbr/folder_realloc.c|   2 +-
sbr/getarguments.c  |   2 +-
sbr/getcpy.c|   2 +-
sbr/geteditor.c |   2 +-
sbr/icalendar.l |   1 +
sbr/icalparse.y |   3 +-
sbr/lock_file.c |   7 +-
sbr/m_convert.c |   2 +-
sbr/m_draft.c   |   4 +-
sbr/m_getfld.c  |   4 +-
sbr/m_maildir.c |   2 +-
sbr/m_mktemp.c  |   5 +-
sbr/m_name.c|   2 +-
sbr/m_popen.c   |   5 +-
sbr/message_id.c|   2 +-
sbr/mf.c|   4 +-
sbr/mf.h|  23 +++
sbr/mime_type.c |   3 +-
sbr/mts.c   |   8 +-
{h => sbr}/mts.h|  51 +++
sbr/netsec.c|   4 +-
sbr/oauth.c | 100 +-
sbr/oauth.h | 116 
sbr/oauth_prof.c|   7 +-
sbr/oauth_prof.h|  19 +++
sbr/path.c  |  71 +-
sbr/path.h  |   1 +
sbr/pidwait.c   |   4 +-
sbr/pidwait.h   |   7 +
sbr/push.c  |   5 +-
sbr/read_line.c |   2 +-
sbr/read_switch_multiword.c |   3 +-
sbr/readconfig.c|   2 +-
sbr/refile.c|   3 +-
sbr/ruserpass.c |   2 +-
sbr/seq_del.c   |   1 +
sbr/seq_getnum.c|   1 +
sbr/seq_list.c  |   2 +-
sbr/seq_read.c  |   2 +-
sbr/seq_save.c  |   3 +-
sbr/seq_setprev.c   |   2 +-
sbr/seq_setunseen.c |   2 +-
sbr/showfile.c  |   2 +
sbr/signals.c   |   3 +-
sbr/signals.h   |  17 +++
sbr/terminal.c  |   2 +-
sbr/trimcpy.c   |   2 +-
sbr/utils.c |  30 +++-
sbr/utils.h |  85 
sbr/vector.c|   2 +-
sbr/vfgets.c|   2 +-
uip/ali.c   |  10 +-
uip/aliasbr.c   

Re: check if message is in a particular sequence?

2021-05-03 Thread Paul Fox
laura wrote:
 > 
 > -noexpand/-expand ??
 > 

You almost had me with that one, and it pointed out that I'd only been
looking at synonyms for compress, or terse, forgetting completely that
an antonym could work just as well.

In the end, though, the specificity of -range/-norange won out.

I've pushed all of the mark(1) changes I've been working on.

paul
=--
paul fox, p...@foxharp.boston.ma.us (arlington, ma, where it's 55.6 degrees)




Re: displaying Date using local timezone

2021-05-03 Thread Bob Carragher
On Mon, 03 May 2021 09:30:46 +0100 Ralph Corderoy  sez:

> Hi Bob,

Hi Ralph,

This time you're not giving me happy-useful news.  B-D

> > > $ TZ=Australia/Lord_Howe date -d '01 Aug'
> > > 2021-08-01 00:00:00 +1030 Sun
> > > $ TZ=Australia/Lord_Howe date -d '01 Feb'
> > > 2021-02-01 00:00:00 +1100 Mon
> >
> > Wat.  -_-##
> >
> > Why?!  I can see some localities deciding that having their time zone
> > not be an integer number of hours offset can be more representative or
> > useful for them
>
> Yes, India is +05:30 with no DST.  And there are finer-grained ones,
> e.g.
>
> $ tz() { printf '%s  %s\n' `TZ=$1 date +%z` $1; } 
> $ for t in UTC Australia/Eucla; do tz $t; done
> +  UTC
> +0845  Australia/Eucla
> $

I had an inkling that it might be bad for NMH to try to handle
DST calculations on its own; hopefully it's not trying to do any
with time zones (but rather relying on system libraries that are
intended to figure out all that) 

> Perhaps some known-to-fail tests could be added to nmh's test suite.
>
> > but why mess with the DST offset, too?
>
> In Lord Howe's case it's so its time agrees with the mainland half the
> time.  Aussies.

More like "Humans."  B-)

> Why bother with DST in the first place?  Isn't it a relic of the
> pre-industrial era when farm labourers would rise by the sun to maximise
> work on the land?

Nope:  it's a relic of the Industrial Age/WW1:

 https://en.wikipedia.org/wiki/Daylight_saving_time

> I didn't bother adjusting one year, initially by accident, and given
> work was a bit flexible on hours it was quite simple to just adjust ‘my
> truth’ of time to local time for the odd appointment, TV programme
> schedule, etc.  Isn't the sudden switch for those that must live by the
> state's clock meant to harm health?

There are indications that, at least on the Monday after each
switchover, certain problems see spikes, such as car crashes and
heart attacks.  I personally wouldn't mind seeing DST eliminated.

> > At this rate, they might as well just create a server that calculates
> > the sun's position in the sky on a second-by-second basis and send out
> > that time accordingly for people to sync their computers to.  -_-#
>
> That occurred to me on the last switch and Google suggested its been
> done by others.  Though I think it might be better to produce a local
> time so my normal waking clock times are centred around the daylight.
> :-)

Well, that's what I meant:  depending on your longitude, the
server would give you a "local time," perhaps centered around the
daylight.  Though I also heard one proposal for just a universal
time (like UTC) that everyone uses (to avoid issues like "Is my
3pm your 10am or 11am?"), and you always do a conversion to
calculate your local time.  Both of these seem to require
computing devices, making it hard or impossible for us old fogeys
who still use _actual_ clocks.  B-)

> DST is generally odd.  The Yanks mostly have DST.  But not in Arizona.
> Except for Navajo Nation which is inside AZ.  But there's no DST in Hopi
> Nation which is inside Navajo Nation.
>
> $ tz() { printf '%s  %s\n' "`TZ=$1 date '+%z %Z'`" $1; } 
> $ for t in America/{Phoenix,Shiprock}; do tz $t; done
> -0700 MST  America/Phoenix
> -0600 MDT  America/Shiprock
> $
>
> And if you carry on up the Wakhjir Pass in Afghanistan then the clocks
> will switch from +0430 to +0800 as you enter the People's Most
> Democratic Uncensorious Republic of China.

Like I said:  "Humans."  B-)

Bob



Re: displaying Date using local timezone

2021-05-03 Thread Ralph Corderoy
Hi Bob,

> > $ TZ=Australia/Lord_Howe date -d '01 Aug'
> > 2021-08-01 00:00:00 +1030 Sun
> > $ TZ=Australia/Lord_Howe date -d '01 Feb'
> > 2021-02-01 00:00:00 +1100 Mon
>
> Wat.  -_-##
>
> Why?!  I can see some localities deciding that having their time zone
> not be an integer number of hours offset can be more representative or
> useful for them

Yes, India is +05:30 with no DST.  And there are finer-grained ones,
e.g.

$ tz() { printf '%s  %s\n' `TZ=$1 date +%z` $1; } 
$ for t in UTC Australia/Eucla; do tz $t; done
+  UTC
+0845  Australia/Eucla
$

Perhaps some known-to-fail tests could be added to nmh's test suite.

> but why mess with the DST offset, too?

In Lord Howe's case it's so its time agrees with the mainland half the
time.  Aussies.

Why bother with DST in the first place?  Isn't it a relic of the
pre-industrial era when farm labourers would rise by the sun to maximise
work on the land?

I didn't bother adjusting one year, initially by accident, and given
work was a bit flexible on hours it was quite simple to just adjust ‘my
truth’ of time to local time for the odd appointment, TV programme
schedule, etc.  Isn't the sudden switch for those that must live by the
state's clock meant to harm health?

> At this rate, they might as well just create a server that calculates
> the sun's position in the sky on a second-by-second basis and send out
> that time accordingly for people to sync their computers to.  -_-#

That occurred to me on the last switch and Google suggested its been
done by others.  Though I think it might be better to produce a local
time so my normal waking clock times are centred around the daylight.
:-)

DST is generally odd.  The Yanks mostly have DST.  But not in Arizona.
Except for Navajo Nation which is inside AZ.  But there's no DST in Hopi
Nation which is inside Navajo Nation.

$ tz() { printf '%s  %s\n' "`TZ=$1 date '+%z %Z'`" $1; } 
$ for t in America/{Phoenix,Shiprock}; do tz $t; done
-0700 MST  America/Phoenix
-0600 MDT  America/Shiprock
$

And if you carry on up the Wakhjir Pass in Afghanistan then the clocks
will switch from +0430 to +0800 as you enter the People's Most
Democratic Uncensorious Republic of China.

-- 
Cheers, Ralph.