The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: steffen@sdaoden.eu (Steffen Nurpmeso)
Subject: [TUHS] Happy birthday, Dennis Ritchie! [ really sun vs dec/apollo --> X and NeWS ]
Date: Tue, 19 Sep 2017 15:53:59 +0200	[thread overview]
Message-ID: <20170919135359.G38me%steffen@sdaoden.eu> (raw)
In-Reply-To: <20170919025031.GA25650@mcvoy.com>

Larry McVoy <lm at mcvoy.com> wrote:
 |On Mon, Sep 18, 2017 at 08:52:08PM -0400, Random832 wrote:
 |> On Thu, Sep 14, 2017, at 15:37, Steve Johnson wrote:
 |>> I wrote a paper on error messages at one point.?? I had examples from
 |>> bad to best.?? In a nutshell (worst to best):
 |>> 
 |>>  * <program aborts, leaving the world in an unknown state>
 |>>  * "internal error",?? "beta table overflow", "operation failed"
 |>>  * "Writing the output file failed"
 |>>  * "File xxx could not be opened for writing."
 |>>  * "File xxx could not be opened for writing: check the file location
 |>> and permissions"
 |>> 
 |>>  * "Writing the output file xxx caused an error.?? See <link> for
 |>> possible reasons and corrections" 
 |>> 
 |>> Most git messages fall between 2 and 3.?? But there are occasional 4's
 |>> and 5's.
 |> 
 |> Just out of curiosity, where does perror(filename), quite possibly the
 |> *most* common error message on Unix as a whole, fall on your scale? It
 |> says which of the file location or permissions (or whatever else) it is,
 |> but not whether it was attempting to open it for reading or writing.
 |
 |So in the BitKeeper source, perror is redifined to my_perror which is
 |this:
 |
 |void    
 |my_perror(char *file, int line, char *msg)
 |{
 |        char    *p = 0;
 |        int     save = errno;
 |
 |        if (p = getenv("_BK_VERSION")) {
 |                if (strneq(p, "bk-", 3)) p += 3;
 |                fprintf(stderr, "%s:%d (%s): ", file, line, p);
 |} else {
 |                fprintf(stderr, "%s:%d: ", file, line);
 |}
 |        if (p = strerror(errno)) {
 |                fprintf(stderr, "%s: %s\n", msg, p);
 |} else {
 |                fprintf(stderr, "%s: errno=%d\n", msg, errno);
 |}
 |        errno = save;   
 |}
 |
 |libc should do that.

That really made me wonder why "save" is not used, errno may
eventually change along the way.  Ok ok, but.. well.
I have had a Txt::FormatEncoder which was the sole implementation
of a format codec (plus FormatDecoder), which supported %m

  * "%m"
  * Print the description of the \SF Errno which was active at setup() time,
  * if it's value has an assigned description
  * (otherwise a message is printed which says that this value is unknown).
  * This always prints the original english string \ldots

mostly for debugging and developers thus, but why not, except for
inter-dependencies, thus optional at least, support of
a # modifier could have been added.
The encoder could be used for finite (CP::) as well as resizable
buffers (CString, ([Sys::]IO::TextWriter, etc.) as in

  static void _MyAddVFmt(
          CString                 &_str,
          const char              *_fmt,
          void                    *_valist)
  {
          ui32                    grow, olen;
          auto Txt::FormatEncoder fe;
          // use special case+update() for better code flow
          (void)fe.setup(NIL, 0, _fmt, _valist);
          for(grow=80-1;  ;  ) {
                  olen = _str.length();
                  (void)fe.update(_str.reserve(grow).data()+olen, grow)
                          .call();
                  // resize insufficient? nothing changed!
                  if(fe.isInsufficient()) {
                          (void)_str.truncate(olen);
                          grow <<= 1;
                  } else {
                          (void)_str.truncate(olen + fe.count());
                          if(fe.isFinished())
                                  break;
                          grow = 80-1;
                  }
          }
          return;
  }

Terrible: no overflow protection.  And camel case.
Plus a [Sys::]Log and [Sys::]Log::Domain with vWrite() and

  pub static void write(Priority _prio, const char *_fmt, ...);

That was for the builtin Domain only, which needs to be created
to overcome the no-op state, optionally SMP safe:

  pub static void createBuiltinDomain(IO::Device *_dev,
                    SMP::Mutex *_mtx=NIL);
  pub static Domain *getBuiltinDomain(void){ return(s_bdom); }

Optionally in [Sys::]POSIX there also was

  pub static Log::Domain *createSyslogDomain(
                            SyslogFacility _facility=user,
                            boolean _includepid=tru1,
                            const char *_intro=NIL,
                            boolean _enabled=tru1,
                            Log::Priority _prio=Log::debug);

but that cannot be used as the main log domain.  I have forgotten
why.  It also used a shared internal socket connection and mutex
for all domains created like that, but can (re)use
CP::fromVFormat() to actually prepare the written messages in
the 1 KB stack buffer for syslog purposes.  At least.  All this of
course very inconvenient in a main():

          Mem::Cache::enableStatistics();
          Mem::Cache::configure(Mem::Cache::conf_trash, tru1);
          Std::createChannels(tru1, tru1, tru1);
  No standard streams by default.
          Log::setEnabled(tru1);
          Log::setPriority(Log::debug);
          Log::createBuiltinDomain(Std::ferr);
  No logging by default.
          (void)Misc::NYD::setDumpChannel(Std::ferr);
  And NotYetDead chirps or profiling needs to be charged, too.

But despite all faulty design decisions, implementation
shortcomings, missing focus on security details, etc., at least
you can exactly specify what is going on.  And get that and
nothing else.

Unfortunately C++ has become overly huge, and i am not rich enough
to go for a C+ / C-- / C-w-C.  Well.  There is i think a German
who did something i think nice, Python style source code,
transformed to C which then is compilable as such.  But with
garbage collection and all that stuff that interpreted languages
ship, and inclusive a runtime.  Now called Nim, Nimrod no longer.
I have just looked, in the meantime also compiles to JavaScript.
Getting real grip it seems, on github etc.  Well.  Never used it,
but sounds very interesting to me.

The NetBSD getenv() uses a fast tree i think to speed up lookups.
I think especially in massive parallel object-based programs any
sort of perror() is likely overchallenged and needs to attach to
more context.  Then again i have no idea better than "CTX1: CTX2:
CTX3: message" either, and always get a headache when i see
OpenSSL error messages which exactly go this route.  So you need
two programs, one to do the work, and the other to interpret the
error messages of the first...

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


  parent reply	other threads:[~2017-09-19 13:53 UTC|newest]

Thread overview: 204+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-08 20:54 [TUHS] Happy birthday, Dennis Ritchie! Dave Horsfall
2017-09-08 21:04 ` Noel Chiappa
2017-09-08 21:09   ` Michael Kjörling
2017-09-09  1:16     ` Wesley Parish
2017-09-09  1:30       ` [TUHS] File-as-record (was: Happy birthday, Dennis Ritchie!) Greg 'groggy' Lehey
2017-09-09  1:43         ` Warner Losh
2017-09-09  1:50         ` Wesley Parish
2017-09-09 13:59           ` [TUHS] File-as-record Arthur Krewat
2017-09-11 17:26         ` [TUHS] File-as-record (was: Happy birthday, Dennis Ritchie!) Paul Winalski
2017-09-09  4:34       ` [TUHS] Happy birthday, Dennis Ritchie! Steve Johnson
2017-09-09 13:04         ` William Cheswick
2017-09-09 17:26           ` Steve Nickolas
2017-09-09 17:49           ` Arthur Krewat
2017-09-09 19:40             ` Steve Nickolas
2017-09-09 20:33           ` Lawrence Stewart
2017-09-09 21:56             ` Steve Johnson
2017-09-10  1:27               ` Dave Horsfall
2017-09-11 16:20             ` Paul Winalski
2017-09-09 15:55         ` Clem Cole
2017-09-08 22:28   ` Steve Nickolas
2017-09-09 11:04     ` Michael Kjörling
2017-09-09 11:19       ` Steve Nickolas
2017-09-08 21:05 ` Arthur Krewat
2017-09-08 21:14 ` William Pechter
2017-09-08 22:13   ` Angus Robinson
2017-09-08 23:11     ` William Pechter
2017-09-09  5:13       ` Dave Horsfall
2017-09-09 15:41         ` Larry McVoy
2017-09-09  4:20   ` Dave Horsfall
2017-09-11 16:30   ` Paul Winalski
2017-09-11 16:49     ` [TUHS] Happy birthday, Dennis Ritchie! [ really sun vs dec/apollo ] Jon Steinhart
2017-09-11 17:37       ` Paul Winalski
2017-09-11 23:09       ` Larry McVoy
2017-09-12  7:38         ` arnold
2017-09-12 14:12           ` Ronald Natalie
2017-09-12 14:51             ` Toby Thain
2017-09-12 15:33             ` arnold
2017-09-12 15:35           ` [TUHS] Happy birthday, Dennis Ritchie! [ really sun vs dec/apollo --> X and NeWS ] Jon Steinhart
2017-09-12 16:57             ` Larry McVoy
2017-09-12 17:04             ` Arthur Krewat
2017-09-12 17:07               ` Larry McVoy
2017-09-12 22:11               ` [TUHS] X and NeWS history (long) Jon Steinhart
2017-09-12 22:58                 ` Larry McVoy
2017-09-12 23:22                   ` Jon Steinhart
2017-09-12 23:44                     ` Chris Torek
2017-09-12 23:41                 ` Adam Sampson
2017-09-13  0:14                   ` Jon Steinhart
2017-09-13 16:38                     ` [TUHS] old X versions (was:X and NeWS history) Christian Groessler
2017-09-13 19:10                       ` Kurt H Maier
2017-09-13 19:13                         ` Henry Bent
2017-09-19  0:44                       ` Random832
2017-09-19 10:30                         ` Nigel Williams
2017-09-19 14:05                           ` Jon Steinhart
2017-09-19 15:16                             ` Gregg Levine
2017-09-19 15:39                               ` [TUHS] old X versions Chet Ramey
2017-09-19 18:23                                 ` Nemo
2017-09-19 18:32                                   ` Clem Cole
2017-09-19 18:32                                   ` Chet Ramey
2017-09-19 18:34                                     ` Jon Steinhart
2017-09-19 18:43                                     ` Chet Ramey
2017-09-19 19:19                                       ` Stephen Kitt
2017-09-19 15:40                               ` [TUHS] old X versions (was:X and NeWS history) Clem Cole
2017-09-19 17:01                               ` Steve Nickolas
2017-09-19 17:15                                 ` Gregg Levine
2017-09-19 18:56                                   ` Derek Fawcus
2017-09-19 19:22                                     ` [TUHS] old X versions Arthur Krewat
2017-09-19 20:15                                     ` [TUHS] old X versions (was:X and NeWS history) Gregg Levine
2017-09-19 18:30                                 ` Nemo
2017-09-19 23:40                               ` Wesley Parish
2017-09-19 23:46                                 ` [TUHS] old X versions Grant Taylor
2017-09-20  0:06                                   ` Arthur Krewat
2017-09-13  0:29                 ` [TUHS] X and NeWS history (long) Bakul Shah
2017-09-13  0:52                   ` ron minnich
2017-09-13  0:54                     ` Warner Losh
2017-09-13  0:56                       ` ron minnich
2017-09-13  0:57                         ` Warner Losh
2017-09-13  2:06                         ` Kurt H Maier
2017-09-13  3:34                           ` ron minnich
2017-09-13  3:55                             ` Jon Steinhart
2017-09-13 15:16                               ` Arthur Krewat
2017-09-13 15:42                                 ` [TUHS] X and NeWS history (long) [ really systemd, student access to real code ] Jon Steinhart
2017-09-13  1:42                     ` [TUHS] X and NeWS history (long) Arthur Krewat
2017-09-13  2:27                       ` Grant Taylor
2017-09-13 16:14                     ` Lawrence Stewart
2017-09-13  0:56                   ` Jon Steinhart
2017-09-13  1:34                     ` Bakul Shah
2017-09-13  2:43                     ` Grant Taylor
2017-09-13  3:01                       ` Jon Steinhart
2017-09-13  3:25                         ` Grant Taylor
2017-09-13  3:27                           ` Jon Steinhart
2017-09-13 15:09                 ` Tony Finch
2017-09-13 15:19                   ` Jon Steinhart
2017-09-12 23:33               ` [TUHS] Happy birthday, Dennis Ritchie! [ really sun vs dec/apollo --> X and NeWS ] Dave Horsfall
2017-09-12 20:15             ` Steve Johnson
2017-09-13  2:23               ` Larry McVoy
2017-09-14  0:53                 ` Nemo
2017-09-14  1:18                   ` Henry Bent
2017-09-14  3:15                   ` Larry McVoy
2017-09-14  9:35                   ` Rico Pajarola
2017-09-14 11:11                     ` arnold
2017-09-14 12:13                       ` Rico Pajarola
2017-09-14 12:50                         ` Chet Ramey
2017-09-14 13:27                           ` Rico Pajarola
2017-09-14 14:30                             ` Chet Ramey
2017-09-14 13:21                       ` Steffen Nurpmeso
2017-09-14 19:44                         ` arnold
2017-09-14 20:22                           ` [TUHS] Tools and building: libtool, autoconf, etc. [ trying to have a relevant subject line ] Jon Steinhart
2017-09-14 20:32                             ` Ron Natalie
2017-09-14 21:00                               ` Chris Torek
2017-09-14 21:03                                 ` Ron Natalie
2017-09-14 22:26                                   ` Grant Taylor
2017-09-16  3:34                                 ` Larry McVoy
2017-09-16  4:16                                   ` Warner Losh
2017-09-16  5:08                                   ` Dave Horsfall
2017-09-16  3:33                               ` Larry McVoy
2017-09-14 20:41                             ` Bakul Shah
2017-09-14 21:00                               ` Noel Hunt
2017-09-15 17:42                           ` [TUHS] Happy birthday, Dennis Ritchie! [ really sun vs dec/apollo --> X and NeWS ] Steffen Nurpmeso
2017-09-14 20:31                         ` Ian Zimmerman
2017-09-15  3:16                   ` Dave Horsfall
2017-09-15  3:33                     ` Warner Losh
2017-09-15  8:32                       ` Ron Natalie
2017-09-15 12:42                     ` Arthur Krewat
2017-09-15 18:20                     ` Steffen Nurpmeso
2017-09-15 18:37                       ` Paul Winalski
2017-09-13  7:30               ` arnold
2017-09-13 13:35                 ` Larry McVoy
2017-09-13 23:55                   ` Dave Horsfall
2017-09-14  0:18                     ` Henry Bent
2017-09-14  2:10                       ` Larry McVoy
2017-09-14 19:37                       ` Steve Johnson
2017-09-14 19:54                         ` Steve Nickolas
2017-09-14 20:50                           ` Ian Zimmerman
2017-09-14 21:00                             ` Ron Natalie
2017-09-14 20:11                         ` Ron Natalie
2017-09-14 20:26                           ` Jon Steinhart
2017-09-19  0:52                         ` Random832
2017-09-19  2:50                           ` Larry McVoy
2017-09-19  2:56                             ` Gregg Levine
2017-09-19  3:37                               ` Larry McVoy
2017-09-19  6:52                                 ` Lars Brinkhoff
2017-09-19  7:22                             ` Ian Zimmerman
2017-09-19 13:22                               ` Larry McVoy
2017-09-19 13:53                             ` Steffen Nurpmeso [this message]
2017-09-19 13:56                               ` Larry McVoy
2017-09-19 17:56                                 ` Random832
2017-09-19 18:31                                   ` Steffen Nurpmeso
2017-09-19 18:34                                     ` Larry McVoy
2017-09-19 19:31                                   ` Lawrence Stewart
2017-09-20  3:13                                   ` Larry McVoy
2017-09-23 22:24                                     ` Ralph Corderoy
2017-09-19 14:32                             ` Clem Cole
2017-09-19 14:42                               ` Larry McVoy
2017-09-19 15:12                                 ` Clem Cole
2017-09-19 18:03                                 ` Random832
2017-09-10  9:44 ` [TUHS] Happy birthday, Dennis Ritchie! arnold
2017-09-13 23:22   ` Dave Horsfall
2017-09-14 16:11     ` Ian Zimmerman
2017-09-14 16:15       ` Steve Nickolas
2017-09-14 19:30         ` Theodore Ts'o
2017-09-14 19:52           ` Steve Nickolas
2017-09-14 22:03             ` Christian Groessler
2017-09-14 22:39               ` Erik Berls
2017-09-14 22:52                 ` ron minnich
2017-09-14 23:04                   ` Warner Losh
2017-09-14 23:14                     ` Bakul Shah
2017-09-15 19:01                     ` Chris Torek
2017-09-15 19:50                       ` Lyndon Nerenberg
2017-09-15 19:56                         ` ron minnich
2017-09-15 20:34                         ` Chris Torek
2017-09-14 23:06                   ` Bakul Shah
2017-09-15  0:47                     ` ron minnich
2017-09-14 19:39         ` Kurt H Maier
2017-09-14 20:09           ` [TUHS] Happy birthday, Dennis Ritchie! [ really Pottering vs UNIX ] Jon Steinhart
2017-09-14 21:35           ` [TUHS] Happy birthday, Dennis Ritchie! Theodore Ts'o
2017-09-15  1:40             ` Ron Natalie
2017-09-15 14:04               ` Larry McVoy
2017-09-16  3:40             ` Larry McVoy
2017-09-16  7:45               ` Steve Nickolas
2017-09-16 12:59               ` Ron Natalie
2017-09-16 18:19                 ` Andy Kosela
2017-09-17 18:37                 ` Chet Ramey
2017-09-18 15:11                   ` Steve Johnson
2017-09-16 19:20               ` arnold
2017-09-17  1:43                 ` Larry McVoy
2017-09-17  1:55                   ` Jon Steinhart
2017-09-17  2:14                     ` Warner Losh
2017-09-17  2:18                       ` Larry McVoy
2017-09-17 14:27                         ` Warner Losh
2017-09-17  5:13                     ` Ian Zimmerman
2017-09-17  5:19                   ` arnold
2017-09-17 18:49                     ` Chet Ramey
2017-09-17 18:57                       ` Kurt H Maier
2017-09-17 19:08                         ` Warner Losh
2017-09-17 19:33                           ` Bakul Shah
2017-09-17 19:22                         ` Chet Ramey
2017-09-17 18:43                   ` Chet Ramey
2017-09-18  0:12                     ` Larry McVoy
2017-09-18  0:51                       ` Clem Cole
2017-09-17 18:25               ` Chet Ramey
2017-09-19 12:24 [TUHS] Happy birthday, Dennis Ritchie! [ really sun vs dec/apollo --> X and NeWS ] Norman Wilson
2017-09-19 18:09 ` Random832
2017-09-19 19:21   ` Chris Torek
2017-09-21 17:46 Norman Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170919135359.G38me%steffen@sdaoden.eu \
    --to=steffen@sdaoden.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).