"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: possible gotd log typo
To:
Mark Jamsek <mark@jamsek.com>
Cc:
Game of Trees <gameoftrees@openbsd.org>
Date:
Tue, 07 Feb 2023 09:48:05 +0100

Download raw body.

Thread
On 2023/02/07 16:10:48 +1100, Mark Jamsek <mark@jamsek.com> wrote:
> Currently, running:
> 
>   # gotd -f /etc/gotd.conf
> 
> produces the error report:
> 
>   gotd: : bad path "gotd": must be an absolute path
> 
> I'm not sure if the second colon is an unintentional result of a typo or
> is indeed intended. If the former is the case, the following diff turns
> the same error report (without any regress fallout) into:
> 
>   gotd: bad path "gotd": must be an absolute path
> 
> diff /home/mark/src/got
> commit - c9003c52fc7f70dd988402560adcd22709e74800
> path + /home/mark/src/got
> blob - 5bb8770f6058679e049a234c6d8b4492640cfd7e
> file + gotd/log.c
> --- gotd/log.c
> +++ gotd/log.c
> @@ -166,9 +166,9 @@ vfatalc(int code, const char *emsg, va_list ap)
>  		sep = "";
>  	}
>  	if (code)
> -		logit(LOG_CRIT, "%s: %s%s", s, sep, strerror(code));
> +		logit(LOG_CRIT, "%s%s%s", s, sep, strerror(code));
>  	else
> -		logit(LOG_CRIT, "%s%s", sep, s);
> +		logit(LOG_CRIT, "%s", s);
>  }
>  
>  void

Yep.  vfatalc was prepending log_procname originally, but later vlog
was changed (see 6b5e612458) to prepend it, so that every log has the
procname prefix.  `log_procname' was dropped from vfatalc then but the
extra sep remained.

playing with this made me also realize that we're still prepending the
procname in some logs (as in "listen: listen: shutting down") that we
could drop too.

diff /home/op/w/gotd
commit - b0ac38bb75347d8463628704f64f5ff0349272a6
path + /home/op/w/gotd
blob - 01a705f61574e2653156dbe6ccb60035616515ac
file + gotd/auth.c
--- gotd/auth.c
+++ gotd/auth.c
@@ -266,11 +266,10 @@ auth_dispatch(int fd, short event, void *arg)
 		case GOTD_IMSG_AUTHENTICATE:
 			err = recv_authreq(&imsg, iev);
 			if (err)
-				log_warnx("%s: %s", gotd_auth.title, err->msg);
+				log_warnx("%s", err->msg);
 			break;
 		default:
-			log_debug("%s: unexpected imsg %d", gotd_auth.title,
-			    imsg.hdr.type);
+			log_debug("unexpected imsg %d", imsg.hdr.type);
 			break;
 		}
 
@@ -332,6 +331,6 @@ auth_shutdown(void)
 static void
 auth_shutdown(void)
 {
-	log_debug("%s: shutting down", gotd_auth.title);
+	log_debug("shutting down");
 	exit(0);
 }
blob - 0244dadfadb3fbe5d3d608eaee023f5df9744ce8
file + gotd/listen.c
--- gotd/listen.c
+++ gotd/listen.c
@@ -435,12 +435,10 @@ listen_dispatch(int fd, short event, void *arg)
 		case GOTD_IMSG_DISCONNECT:
 			err = recv_disconnect(&imsg);
 			if (err)
-				log_warnx("%s: disconnect: %s",
-				    gotd_listen.title, err->msg);
+				log_warnx("disconnect: %s", err->msg);
 			break;
 		default:
-			log_debug("%s: unexpected imsg %d", gotd_listen.title,
-			    imsg.hdr.type);
+			log_debug("unexpected imsg %d", imsg.hdr.type);
 			break;
 		}
 
@@ -506,7 +504,7 @@ listen_shutdown(void)
 static void
 listen_shutdown(void)
 {
-	log_debug("%s: shutting down", gotd_listen.title);
+	log_debug("shutting down");
 
 	free(gotd_listen.connection_limits);
 	if (gotd_listen.fd != -1)
blob - d7e43c48876932a301c2aa803f93172a823359ec
file + gotd/session.c
--- gotd/session.c
+++ gotd/session.c
@@ -1481,7 +1481,7 @@ gotd_session_shutdown(void)
 void
 gotd_session_shutdown(void)
 {
-	log_debug("%s: shutting down", gotd_session.title);
+	log_debug("shutting down");
 	if (gotd_session.repo)
 		got_repo_close(gotd_session.repo);
 	got_repo_pack_fds_close(gotd_session.pack_fds);