nextcloud/server

`occ` output not quiet when it should be, exit code not proper

Open

#27.029 aberto em 19 de mai. de 2021

Ver no GitHub
 (14 comments) (0 reactions) (1 assignee)PHP (4.865 forks)batch import
25-feedback3. to reviewbugfeature: occgood first issue

Métricas do repositório

Stars
 (34.953 stars)
Métricas de merge de PR
 (Mesclagem média 20d) (627 fundiu PRs em 30d)

Description

Steps to reproduce

  1. occ files:scan -- nonexistantuser
{"reqId":"gF4yvg4t66k03R7DWvY4","level":1,"time":"2021-05-19T09:45:18+00:00","remoteAddr":"","user":"--","app":"admin_audit","method":"","url":"--","message":"Console command executed: files:scan -- nonexistant","userAgent":"--","version":"19.0.8.1"}
Unknown user 1 nonexistant
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 0       | 0     | 00:00:00     |
+---------+-------+--------------+
$ echo $?
0
  1. occ files:scan -q -- nonexistantuser
{"reqId":"cP30drfWr696XfVOnNs1","level":1,"time":"2021-05-19T09:47:12+00:00","remoteAddr":"","user":"--","app":"admin_audit","method":"","url":"--","message":"Console command executed: files:scan -q -- nonexistantuser","userAgent":"--","version":"19.0.8.1"}
  1. occ files:scan -q -- existinguser
{"reqId":"cP30drfWr696XfVOnNs1","level":1,"time":"2021-05-19T09:47:12+00:00","remoteAddr":"","user":"--","app":"admin_audit","method":"","url":"--","message":"Console command executed: files:scan -q -- existinguser","userAgent":"--","version":"19.0.8.1"}

Expected behaviour

  1. Less output (see 3. below), but most of all, an exit code indicating an error has occurred.
  2. I said quiet! Still I get (irrelevant, to me) output but the one that should actually be issued (there has been an error!) gets suppressed!
  3. The logfile details in JSON should generally not be shown. Silence is golden. Using this (and most likely other occ commands as well, this is a more general issue!) in cron jobs/scripts always leads to notifications. If there is no error, do not output anything. Especially not when asked to be quiet. There are verbose flags. If using them, output can be generated. Only output error messages to stderr (or maybe verbose messages, if asked to). Yes, I can redirect stderr to /dev/null but that's not sensible. I'd like to get notified if an actual error occurs!

Server configuration

Nextcloud version: 19.0.8.1

The rest is irrelevant.

Guia do colaborador