[arvados] updated: 2.7.0-5360-ge98eb84cc8

git repository hosting git at public.arvados.org
Thu Nov 16 07:10:49 UTC 2023


Summary of changes:
 cmd/arvados-client/cmd_test.go                    | 4 ++--
 cmd/arvados-server/arvados-controller.service     | 2 +-
 cmd/arvados-server/arvados-dispatch-cloud.service | 2 +-
 cmd/arvados-server/arvados-dispatch-lsf.service   | 2 +-
 cmd/arvados-server/arvados-git-httpd.service      | 2 +-
 cmd/arvados-server/arvados-health.service         | 2 +-
 cmd/arvados-server/arvados-ws.service             | 2 +-
 cmd/arvados-server/crunch-dispatch-slurm.service  | 2 +-
 cmd/arvados-server/keep-balance.service           | 2 +-
 cmd/arvados-server/keep-web.service               | 2 +-
 cmd/arvados-server/keepproxy.service              | 2 +-
 cmd/arvados-server/keepstore.service              | 2 +-
 lib/cli/get.go                                    | 4 ++--
 lib/cmd/cmd.go                                    | 6 +++---
 lib/cmd/cmd_test.go                               | 2 +-
 lib/cmd/parseflags.go                             | 7 +++----
 lib/config/cmd_test.go                            | 2 +-
 services/keep-balance/main.go                     | 2 +-
 18 files changed, 24 insertions(+), 25 deletions(-)

       via  e98eb84cc8f860bfad29b2b79e72603fccad673c (commit)
      from  74c506146023934d0f052e2bd4971d143b41404d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit e98eb84cc8f860bfad29b2b79e72603fccad673c
Author: Tom Clegg <tom at curii.com>
Date:   Thu Nov 16 02:10:41 2023 -0500

    21189: Revert exit code 64 to 2 for invalid command line argument.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/cmd/arvados-client/cmd_test.go b/cmd/arvados-client/cmd_test.go
index 5cbb1e5e4a..911375c655 100644
--- a/cmd/arvados-client/cmd_test.go
+++ b/cmd/arvados-client/cmd_test.go
@@ -24,12 +24,12 @@ type ClientSuite struct{}
 
 func (s *ClientSuite) TestBadCommand(c *check.C) {
 	exited := handler.RunCommand("arvados-client", []string{"no such command"}, bytes.NewReader(nil), ioutil.Discard, ioutil.Discard)
-	c.Check(exited, check.Equals, cmd.EX_USAGE)
+	c.Check(exited, check.Equals, cmd.EXIT_INVALIDARGUMENT)
 }
 
 func (s *ClientSuite) TestBadSubcommandArgs(c *check.C) {
 	exited := handler.RunCommand("arvados-client", []string{"get"}, bytes.NewReader(nil), ioutil.Discard, ioutil.Discard)
-	c.Check(exited, check.Equals, cmd.EX_USAGE)
+	c.Check(exited, check.Equals, cmd.EXIT_INVALIDARGUMENT)
 }
 
 func (s *ClientSuite) TestVersion(c *check.C) {
diff --git a/cmd/arvados-server/arvados-controller.service b/cmd/arvados-server/arvados-controller.service
index cf680f959f..f96532de5e 100644
--- a/cmd/arvados-server/arvados-controller.service
+++ b/cmd/arvados-server/arvados-controller.service
@@ -19,7 +19,7 @@ ExecStart=/usr/bin/arvados-controller
 LimitNOFILE=65536
 Restart=always
 RestartSec=1
-RestartPreventExitStatus=64
+RestartPreventExitStatus=2
 
 # systemd<=219 (centos:7, debian:8, ubuntu:trusty) obeys StartLimitInterval in the [Service] section
 StartLimitInterval=0
diff --git a/cmd/arvados-server/arvados-dispatch-cloud.service b/cmd/arvados-server/arvados-dispatch-cloud.service
index 61e2325d26..11887b8f8c 100644
--- a/cmd/arvados-server/arvados-dispatch-cloud.service
+++ b/cmd/arvados-server/arvados-dispatch-cloud.service
@@ -19,7 +19,7 @@ ExecStart=/usr/bin/arvados-dispatch-cloud
 LimitNOFILE=65536
 Restart=always
 RestartSec=1
-RestartPreventExitStatus=64
+RestartPreventExitStatus=2
 
 # systemd<=219 (centos:7, debian:8, ubuntu:trusty) obeys StartLimitInterval in the [Service] section
 StartLimitInterval=0
diff --git a/cmd/arvados-server/arvados-dispatch-lsf.service b/cmd/arvados-server/arvados-dispatch-lsf.service
index 931ef40562..f90cd9033d 100644
--- a/cmd/arvados-server/arvados-dispatch-lsf.service
+++ b/cmd/arvados-server/arvados-dispatch-lsf.service
@@ -19,7 +19,7 @@ ExecStart=/usr/bin/arvados-dispatch-lsf
 LimitNOFILE=65536
 Restart=always
 RestartSec=1
-RestartPreventExitStatus=64
+RestartPreventExitStatus=2
 
 # systemd<=219 (centos:7, debian:8, ubuntu:trusty) obeys StartLimitInterval in the [Service] section
 StartLimitInterval=0
diff --git a/cmd/arvados-server/arvados-git-httpd.service b/cmd/arvados-server/arvados-git-httpd.service
index b86293d977..6e5b0dc8e2 100644
--- a/cmd/arvados-server/arvados-git-httpd.service
+++ b/cmd/arvados-server/arvados-git-httpd.service
@@ -19,7 +19,7 @@ ExecStart=/usr/bin/arvados-git-httpd
 LimitNOFILE=65536
 Restart=always
 RestartSec=1
-RestartPreventExitStatus=64
+RestartPreventExitStatus=2
 
 # systemd<=219 (centos:7, debian:8, ubuntu:trusty) obeys StartLimitInterval in the [Service] section
 StartLimitInterval=0
diff --git a/cmd/arvados-server/arvados-health.service b/cmd/arvados-server/arvados-health.service
index 4605681cb8..ef145e26eb 100644
--- a/cmd/arvados-server/arvados-health.service
+++ b/cmd/arvados-server/arvados-health.service
@@ -19,7 +19,7 @@ ExecStart=/usr/bin/arvados-health
 LimitNOFILE=65536
 Restart=always
 RestartSec=1
-RestartPreventExitStatus=64
+RestartPreventExitStatus=2
 
 # systemd<=219 (centos:7, debian:8, ubuntu:trusty) obeys StartLimitInterval in the [Service] section
 StartLimitInterval=0
diff --git a/cmd/arvados-server/arvados-ws.service b/cmd/arvados-server/arvados-ws.service
index 5ba7b54c7d..2e88449599 100644
--- a/cmd/arvados-server/arvados-ws.service
+++ b/cmd/arvados-server/arvados-ws.service
@@ -18,7 +18,7 @@ ExecStart=/usr/bin/arvados-ws
 LimitNOFILE=65536
 Restart=always
 RestartSec=1
-RestartPreventExitStatus=64
+RestartPreventExitStatus=2
 
 # systemd<=219 (centos:7, debian:8, ubuntu:trusty) obeys StartLimitInterval in the [Service] section
 StartLimitInterval=0
diff --git a/cmd/arvados-server/crunch-dispatch-slurm.service b/cmd/arvados-server/crunch-dispatch-slurm.service
index 53b0157807..d2a2fb39d9 100644
--- a/cmd/arvados-server/crunch-dispatch-slurm.service
+++ b/cmd/arvados-server/crunch-dispatch-slurm.service
@@ -19,7 +19,7 @@ ExecStart=/usr/bin/crunch-dispatch-slurm
 LimitNOFILE=65536
 Restart=always
 RestartSec=1
-RestartPreventExitStatus=64
+RestartPreventExitStatus=2
 
 # systemd<=219 (centos:7, debian:8, ubuntu:trusty) obeys StartLimitInterval in the [Service] section
 StartLimitInterval=0
diff --git a/cmd/arvados-server/keep-balance.service b/cmd/arvados-server/keep-balance.service
index c603939bcf..f282f0a650 100644
--- a/cmd/arvados-server/keep-balance.service
+++ b/cmd/arvados-server/keep-balance.service
@@ -20,7 +20,7 @@ LimitNOFILE=65536
 Restart=always
 RestartSec=10s
 Nice=19
-RestartPreventExitStatus=64
+RestartPreventExitStatus=2
 
 # systemd<=219 (centos:7, debian:8, ubuntu:trusty) obeys StartLimitInterval in the [Service] section
 StartLimitInterval=0
diff --git a/cmd/arvados-server/keep-web.service b/cmd/arvados-server/keep-web.service
index d88dea231f..4ecd0b4978 100644
--- a/cmd/arvados-server/keep-web.service
+++ b/cmd/arvados-server/keep-web.service
@@ -19,7 +19,7 @@ ExecStart=/usr/bin/keep-web
 LimitNOFILE=65536
 Restart=always
 RestartSec=1
-RestartPreventExitStatus=64
+RestartPreventExitStatus=2
 
 # systemd<=219 (centos:7, debian:8, ubuntu:trusty) obeys StartLimitInterval in the [Service] section
 StartLimitInterval=0
diff --git a/cmd/arvados-server/keepproxy.service b/cmd/arvados-server/keepproxy.service
index 952c7df6a1..139df1c3fa 100644
--- a/cmd/arvados-server/keepproxy.service
+++ b/cmd/arvados-server/keepproxy.service
@@ -19,7 +19,7 @@ ExecStart=/usr/bin/keepproxy
 LimitNOFILE=65536
 Restart=always
 RestartSec=1
-RestartPreventExitStatus=64
+RestartPreventExitStatus=2
 
 # systemd<=219 (centos:7, debian:8, ubuntu:trusty) obeys StartLimitInterval in the [Service] section
 StartLimitInterval=0
diff --git a/cmd/arvados-server/keepstore.service b/cmd/arvados-server/keepstore.service
index 14cad20436..de0fd1dbd7 100644
--- a/cmd/arvados-server/keepstore.service
+++ b/cmd/arvados-server/keepstore.service
@@ -23,7 +23,7 @@ ExecStart=/usr/bin/keepstore
 LimitNOFILE=65536
 Restart=always
 RestartSec=1
-RestartPreventExitStatus=64
+RestartPreventExitStatus=2
 
 # systemd<=219 (centos:7, debian:8, ubuntu:trusty) obeys StartLimitInterval in the [Service] section
 StartLimitInterval=0
diff --git a/lib/cli/get.go b/lib/cli/get.go
index 3976b2d3cc..352e7b9af6 100644
--- a/lib/cli/get.go
+++ b/lib/cli/get.go
@@ -30,12 +30,12 @@ func (getCmd) RunCommand(prog string, args []string, stdin io.Reader, stdout, st
 	flags.SetOutput(stderr)
 	err = flags.Parse(args)
 	if err != nil {
-		return cmd.EX_USAGE
+		return cmd.EXIT_INVALIDARGUMENT
 	}
 	if len(flags.Args()) != 1 {
 		fmt.Fprintf(stderr, "usage of %s:\n", prog)
 		flags.PrintDefaults()
-		return cmd.EX_USAGE
+		return cmd.EXIT_INVALIDARGUMENT
 	}
 	if opts.Short {
 		opts.Format = "uuid"
diff --git a/lib/cmd/cmd.go b/lib/cmd/cmd.go
index 332e0dcf58..40e80f5eaa 100644
--- a/lib/cmd/cmd.go
+++ b/lib/cmd/cmd.go
@@ -21,7 +21,7 @@ import (
 	"github.com/sirupsen/logrus"
 )
 
-const EX_USAGE = 64
+const EXIT_INVALIDARGUMENT = 2
 
 type Handler interface {
 	RunCommand(prog string, args []string, stdin io.Reader, stdout, stderr io.Writer) int
@@ -106,13 +106,13 @@ func (m Multi) RunCommand(prog string, args []string, stdin io.Reader, stdout, s
 	} else if len(args) < 1 {
 		fmt.Fprintf(stderr, "usage: %s command [args]\n", prog)
 		m.Usage(stderr)
-		return EX_USAGE
+		return EXIT_INVALIDARGUMENT
 	} else if cmd, ok = m[args[0]]; ok {
 		return cmd.RunCommand(prog+" "+args[0], args[1:], stdin, stdout, stderr)
 	} else {
 		fmt.Fprintf(stderr, "%s: unrecognized command %q\n", prog, args[0])
 		m.Usage(stderr)
-		return EX_USAGE
+		return EXIT_INVALIDARGUMENT
 	}
 }
 
diff --git a/lib/cmd/cmd_test.go b/lib/cmd/cmd_test.go
index b4ce7194c1..2d03722adc 100644
--- a/lib/cmd/cmd_test.go
+++ b/lib/cmd/cmd_test.go
@@ -57,7 +57,7 @@ func (s *CmdSuite) TestUsage(c *check.C) {
 	stdout := bytes.NewBuffer(nil)
 	stderr := bytes.NewBuffer(nil)
 	exited := testCmd.RunCommand("prog", []string{"nosuchcommand", "hi"}, bytes.NewReader(nil), stdout, stderr)
-	c.Check(exited, check.Equals, 64)
+	c.Check(exited, check.Equals, 2)
 	c.Check(stdout.String(), check.Equals, "")
 	c.Check(stderr.String(), check.Matches, `(?ms)^prog: unrecognized command "nosuchcommand"\n.*echo.*\n`)
 }
diff --git a/lib/cmd/parseflags.go b/lib/cmd/parseflags.go
index d4158a2195..275e063f31 100644
--- a/lib/cmd/parseflags.go
+++ b/lib/cmd/parseflags.go
@@ -26,8 +26,7 @@ var defaultFlagSet = flag.NewFlagSet("none", flag.ContinueOnError)
 // running normally, or false if it should exit now.
 //
 // If ok is false, the second return value is an appropriate exit
-// code: 0 if "-help" was given, EX_USAGE (64) if there was a usage
-// error.
+// code: 0 if "-help" was given, 2 if there was a usage error.
 func ParseFlags(f FlagSet, prog string, args []string, positional string, stderr io.Writer) (ok bool, exitCode int) {
 	f.Init(prog, flag.ContinueOnError)
 	f.SetOutput(io.Discard)
@@ -36,7 +35,7 @@ func ParseFlags(f FlagSet, prog string, args []string, positional string, stderr
 	case nil:
 		if f.NArg() > 0 && positional == "" {
 			fmt.Fprintf(stderr, "unrecognized command line arguments: %v (try -help)\n", f.Args())
-			return false, EX_USAGE
+			return false, EXIT_INVALIDARGUMENT
 		}
 		return true, 0
 	case flag.ErrHelp:
@@ -56,6 +55,6 @@ func ParseFlags(f FlagSet, prog string, args []string, positional string, stderr
 		return false, 0
 	default:
 		fmt.Fprintf(stderr, "error parsing command line arguments: %s (try -help)\n", err)
-		return false, EX_USAGE
+		return false, EXIT_INVALIDARGUMENT
 	}
 }
diff --git a/lib/config/cmd_test.go b/lib/config/cmd_test.go
index 123750e76e..53f677796d 100644
--- a/lib/config/cmd_test.go
+++ b/lib/config/cmd_test.go
@@ -33,7 +33,7 @@ func (s *CommandSuite) SetUpSuite(c *check.C) {
 func (s *CommandSuite) TestDump_BadArg(c *check.C) {
 	var stderr bytes.Buffer
 	code := DumpCommand.RunCommand("arvados config-dump", []string{"-badarg"}, bytes.NewBuffer(nil), bytes.NewBuffer(nil), &stderr)
-	c.Check(code, check.Equals, cmd.EX_USAGE)
+	c.Check(code, check.Equals, cmd.EXIT_INVALIDARGUMENT)
 	c.Check(stderr.String(), check.Equals, "error parsing command line arguments: flag provided but not defined: -badarg (try -help)\n")
 }
 
diff --git a/services/keep-balance/main.go b/services/keep-balance/main.go
index f9a3e1701a..ec1cb18ee1 100644
--- a/services/keep-balance/main.go
+++ b/services/keep-balance/main.go
@@ -59,7 +59,7 @@ func (command) RunCommand(prog string, args []string, stdin io.Reader, stdout, s
 		fmt.Fprint(stderr,
 			"Usage error: the -commit-pulls or -commit-trash command line flags are no longer supported.\n",
 			"Use Collections.BalancePullLimit and Collections.BalanceTrashLimit instead.\n")
-		return cmd.EX_USAGE
+		return cmd.EXIT_INVALIDARGUMENT
 	}
 
 	// Drop our custom args that would be rejected by the generic

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list