• Bug#980996: ucf conffnew conffold sanity check

    From Mark Hindley@21:1/5 to Marco Schmidt on Thu Jan 2 20:00:02 2025
    Control: tags -1 patch

    Marco,

    Thanks for your patience with this.

    On Mon, Jan 25, 2021 at 08:47:40AM +0100, Marco Schmidt wrote:

    Package: ucf
    Version: all

    Hello,

    I see the sanity check for the conffold/conffnew setting as a bug.

    I agree. I have a patch (attached) which reorders the configuration by category (ucf.conf and environment). AFAICS, setting these options by commandline option was not possible, so I have removed that redundant code.

    Mark

    From 15be509cea45214260d50c11649170e1bcd4fc43 Mon Sep 17 00:00:00 2001
    From: Mark Hindley <mark@hindley.org.uk>
    Date: Tue, 31 Dec 2024 09:49:52 +0000
    Subject: [PATCH] Handle force_conff{old,new} in parallel for config file and
    environment.

    Closes: #980996
    ---
    ucf | 57 ++++++++++++++++++++++++++++++---------------------------
    1 file changed, 30 insertions(+), 27 deletions(-)

    diff --git a/ucf b/ucf
    index 310813a..a9cde0a 100755
    --- a/ucf
    +++ b/ucf
    @@ -460,22 +460,32 @@ else
    statedir=$(vset '/var/lib/ucf' "The State directory")
    fi

    -# Env, config file, or default
    -if [ "$UCF_FORCE_CONFFOLD" ]; then
    - force_conffold=$(vset "$UCF_FORCE_CONFFOLD" "Keep the old file")
    -elif [ "$conf_force_conffold" ]; then
    - force_conffold=$(vset "$conf_force_conffold" "Keep the old file")
    -else
    - force_conffold=''
    +# Handle conffold and conffnew together. See #980996
    +# Default
    +force_conff=
    +
    +# Config file
    +if [ "$conf_force_conffold" ]; then
    + if [ "$conf_force_conffnew" ]; then
    + echo >&2 "Error: Only one of conf_force_conffold and conf_force_conffnew should"
    + echo >&2 " be set in the config file"
    + exit 1
    + fi
    + force_conff=$(vset "old" "Keep the old file")
    +elif [ "$conf_force_conffnew" ]; then
    + force_conff