Commit a86f885
committed
Reverse the order by which variables are populated
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.1 parent 4db6950 commit a86f885
1 file changed
+6
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
57 | 58 | | |
58 | | - | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
| 277 | + | |
284 | 278 | | |
285 | 279 | | |
286 | 280 | | |
| |||
410 | 404 | | |
411 | 405 | | |
412 | 406 | | |
413 | | - | |
414 | 407 | | |
| 408 | + | |
415 | 409 | | |
416 | 410 | | |
417 | 411 | | |
| |||
0 commit comments