Skip to content

Fix 'sympa config' command return code to be 0 when there are no changes - #1518

Merged
ikedas merged 1 commit into
sympa-community:sympa-6.2from
k0lter:sympa-config-command-rc
Nov 23, 2022
Merged

Fix 'sympa config' command return code to be 0 when there are no changes#1518
ikedas merged 1 commit into
sympa-community:sympa-6.2from
k0lter:sympa-config-command-rc

Conversation

@k0lter

@k0lter k0lter commented Nov 13, 2022

Copy link
Copy Markdown
Contributor

While trying to update a config value using sympa config command when there are no changes, it die() with a return code > 0.

It means that the command is not idempotent.

As an example, we started to use it in Debian Maintainer scripts with some config parameters instead of our custom routines to update configuration.

@ikedas

ikedas commented Nov 17, 2022

Copy link
Copy Markdown
Member

Hi @k0lter ,

It makes sense not to die(), however I feel the message "Not changed." helps.

@ikedas ikedas added the bug label Nov 17, 2022
@k0lter

k0lter commented Nov 17, 2022

Copy link
Copy Markdown
Contributor Author

Hi @ikedas

It will pollute stdout especially when used multiple times in scripts.

Could you consider adding a -q (--quiet) argument (disabled by default)?

Thanks,

@ikedas

ikedas commented Nov 17, 2022

Copy link
Copy Markdown
Member

As --quiet has already been used by the other commands, I suggest -s / --silent.

-use constant _options   => qw(output|o=s@);
+use constant _options   => qw(output|o=s@ silent|s);

(BTW since stdout pollution is the problem for all commands, I'd like to make this option available for all the other commands in the future.)

@k0lter

k0lter commented Nov 17, 2022

Copy link
Copy Markdown
Contributor Author

Sounds good to me. Thanks.

@racke

racke commented Nov 17, 2022

Copy link
Copy Markdown
Contributor

Yes, but I would suggest to use "--noout" or something similar as it is easy to confuse --quiet and --silent.

@ikedas

ikedas commented Nov 17, 2022

Copy link
Copy Markdown
Member

--quiet is used not to notify the target user, but --silent is certainly confusing.

--noout is used by something including openssl and xmllint. I'm ok.

@ikedas ikedas added this to the 6.2.72 milestone Nov 18, 2022
ikedas added a commit to ikedas/sympa that referenced this pull request Nov 18, 2022
@ikedas

ikedas commented Nov 18, 2022

Copy link
Copy Markdown
Member

Though I've not tested yet, I've added the --noout option.

sympa-6.2...ikedas:sympa:k0lter/sympa-config-command-rc

@k0lter

k0lter commented Nov 19, 2022

Copy link
Copy Markdown
Contributor Author

Thanks @ikedas

@racke

racke commented Nov 19, 2022

Copy link
Copy Markdown
Contributor

Though I've not tested yet, I've added the --noout option.

sympa-6.2...ikedas:sympa:k0lter/sympa-config-command-rc

"Skip output" is easier to parse for the human brain than "No output".

ikedas added a commit to ikedas/sympa that referenced this pull request Nov 19, 2022
@ikedas

ikedas commented Nov 19, 2022

Copy link
Copy Markdown
Member

Thanks racke. I re-pushed correction and more changes.

ikedas added a commit to ikedas/sympa that referenced this pull request Nov 20, 2022
ikedas added a commit to ikedas/sympa that referenced this pull request Nov 23, 2022
ikedas added a commit that referenced this pull request Nov 23, 2022
…y k0lter & ikedas

Add --noout option to sympa command line (see #1518)
@ikedas
ikedas merged commit 5b5d79b into sympa-community:sympa-6.2 Nov 23, 2022
@mberva mberva mentioned this pull request Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants