40f3592 Reverse the order by which variables are populated

Authored and Committed by sergiomb 2 years ago
    Reverse the order by which variables are populated
    
    From a86f885597a91cd41837d706bf6a08d4c239a54b Mon Sep 17 00:00:00 2001
    From: Denton Liu <liu.denton@gmail.com>
    Date: Tue, 20 Dec 2022 04:31:58 -0800
    
    On Arch Linux, when asking for the description, we get it:
    
    $ ./lsb_release -d
    Description:    Arch Linux
    
    But when we ask for the codename of the release as well, the description
    is set to "(none)".
    
    $ ./lsb_release -d -c
    Description:    (none)
    Codename:       n/a
    
    This happens because when we request the codename, in GetDistribInfo(),
    we trigger the InitDistribInfo() logic when -c is given. This overrides
    the DISTRIB_DESCRIPTION variable that has been parsed from
    /etc/lsb-release.
    
    However, according to lsb_release/src/lsb_release.examples:
    
    Optional fields are DISTRIB_ID, DISTRIB_RELEASE,
    DISTRIB_CODENAME, DISTRIB_DESCRIPTION and can be used to
    override information which is parsed from the
    "/etc/distrib-release" file.
    
    This means that we're actually invoking GetLSBInfo() and
    GetDistribInfo() in reverse order. We should invoke GetDistribInfo()
    first so that it can be overridden by GetLSBInfo() later. Reverse the
    calling order of these two functions.
    
    Since we've reversed the calling order, GetDistribInfo() will never have
    any of the variables populated when it's called so remove the checks for
    those.
    
        
file modified
+6 -12