Date:        Thu, 26 Jul 2018 14:57:19 +0100
    From:        Ralph Corderoy <>
    Message-ID:  <>

  | You still seem to be referring to the first version I wrote?

Yes, I was in the early part of that message.   I was more
explaining my earlier message than responding to your
second one.

  | Here's the second one again that's being replied to.

Yes, I saw that too...

  | The first invocation of `date -d @NNN' uses `42', not the user's
  | $SOURCE_DATE_EPOCH and discards stderr.  If its exit value is good then
  | the second `date -d @NNN' uses $SOURCE_DATE_EPOCH and doesn't discard
  | stderr, nor the exit value.

Yes, I saw that too - but you're relying upon all versions of date
doing sane parsing, which in general I prefer not to do.   You cannot
get around that with a demonstration of what happens, as that just
shows one version.   As I said, I know (somewhat) the -d parser on
netbsd, which I know handles the @N form, but I kind of doubt has
much in the way of error checking there.

  | Well, it spots some flaws with SOURCE_DATE_EPOCH.

One version of date does.   Yes.

  | Yes, they might fling it at atoi(3), I agree.  I don't think that's
  | nmh's look out, and date is best off checking the parameter.

Again, it depends how seriously you want to take that "must
validate..." rule.   If you really believe in that, then you need to
do the validation.   If it isn't relaly all that important (which would
be my take on it) then you can just do it whatever actually works.

  | OK, but I want all of them checked apart from those I explicitly `||
  | true'.  That suggests a lot of clutter, or a lot of `&&' chaining before
  | the `|| true'.

It depends, but yes, sometimes.   But -e really is very difficult to use
properly, is wildly misunderstood, and most people who know shells
will advise against using it (not that it doesn't work as it should, but
that even people who know a lot about all of this don't really follow
the "as it should" part very well - it is very very easy to trap yourself.)



Reply via email to