261021.10 · 48bd9b4f61f36554f3dbaa36399962322db14fe6
The name file is WORKING_NAME while www is provisional
www is a working name. The file that holds it says so, and the Makefile, go:embed and the name test read it there. It goes back to NAME once a final name is chosen.
reading declarations
@@ -1,8 +1,8 @@ .PHONY: all build run test clean install uninstall deb install-deb uninstall-deb -# NAME holds the program's name, which the binary, the package and the-# paths below take.-NAME := $(shell cat NAME)+# WORKING_NAME holds the program's name, provisional until a final one is+# chosen. The binary, the package and the paths below take it.+NAME := $(shell cat WORKING_NAME) all: build
NAME
@@ -1 +0,0 @@-www
@@ -70,7 +70,7 @@ www needs git. To try a change without installing it, `make run` builds `build/www` and serves this directory in the foreground on port 8080 with `--stamp`, beside an installed server on port 80. Stop it with Ctrl-C before the next run; a run that finds a server on 8080 hands its tree to that server, which keeps the old code. -The program's name lives in the file `NAME`. The binary, its paths, environment variables, journal tag and URLs, the Makefile and the Debian package all take it from there, and a test fails on any other copy outside prose and `go.mod`.+The program's name lives in the file `WORKING_NAME`, since www is a working name until a final one is chosen. The binary, its paths, environment variables, journal tag and URLs, the Makefile and the Debian package all take it from there, and a test fails on any other copy outside prose and `go.mod`. The package grants `/usr/bin/www` one capability, `cap_net_bind_service`, so it can bind port 80 while running as the user. `getcap /usr/bin/www` shows it. With it www serves on port 80 and URLs carry no port; without it, as after `make install`, the port is 8080. www also takes port 80 where the machine lets every user bind low ports.
@@ -0,0 +1 @@+www
@@ -5,12 +5,13 @@ import ( "strings" ) -//go:embed NAME+//go:embed WORKING_NAME var nameFile string -// progName is the program's name, from the file NAME, which the Makefile and-// the package files read too. Every path, variable, URL and message that-// names the program derives from it, so a rename changes one word.+// progName is the program's name, from the file WORKING_NAME, which the+// Makefile and the package files read too. Every path, variable, URL and+// message that names the program derives from it, so a rename changes one+// word. var progName = strings.TrimSpace(nameFile) // envPrefix starts the name of every environment variable the program
@@ -10,8 +10,8 @@ import ( "testing" ) -// The name lives in NAME alone. Go code takes it from progName, the Makefile-// and the package files from NAME, so a tracked file names the program+// The name lives in WORKING_NAME alone. Go code takes it from progName, the Makefile+// and the package files from WORKING_NAME, so a tracked file names the program // only in prose: comments, README.md, doc/ and go.mod, which Go needs as // a literal. A name such as www also occurs inside words that belong to // others, which foreign strips first.@@ -23,7 +23,7 @@ func TestNameHasOneSource(t *testing.T) { } lower := strings.ToLower(progName) for _, f := range strings.Fields(string(out)) {- if f == "NAME" || f == "go.mod" || f == "README.md" || strings.HasPrefix(f, "doc/") || strings.HasPrefix(f, "assets/fonts/") {+ if f == "WORKING_NAME" || f == "go.mod" || f == "README.md" || strings.HasPrefix(f, "doc/") || strings.HasPrefix(f, "assets/fonts/") { continue } src, err := os.ReadFile(f)