Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 205075

Summary: baselayout-1.12.10-r5 - Colon missing in /etc/init.d/clock @ line 57
Product: Gentoo Linux Reporter: Vince C. <vincent.cadet>
Component: [OLD] baselayoutAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED INVALID    
Severity: normal CC: polynomial-c
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://forums.gentoo.org/viewtopic-p-4704254.html
Whiteboard:
Package list:
Runtime testing required: ---

Description Vince C. 2008-01-09 14:33:14 UTC
The line that determines whether the TIMEZONE variable is set to Factory contains a typo error (a missing colon in bash variable substitution).

Reproducible: Always

Steps to Reproduce:
Install baselayout 1.12.10-r5

Actual Results:  
Actual merge suggestion with dispatch-conf.

@@ -57,7 +57,7 @@ 
         # Make sure people set their timezone ... we do it here 
         # even though we don't actually use the variable so that 
         # people see the warning on boot. 
 -       if [[ ${TIMEZONE:-Factory} == "Factory" ]] ; then 
 +       if [[ ${TIMEZONE-Factory} == "Factory" ]] ; then 
                 ewarn "Your TIMEZONE in /etc/conf.d/clock is still set to Factory!" 
         fi 
  }

Note the missing colon.

Expected Results:  
No merge needed.

Might be the cause for Bug #193700.
Comment 1 SpanKY gentoo-dev 2008-01-09 18:16:31 UTC
the cause of Bug 193700 is that he was expecting something to happen that wasnt supposed to happen

the : is not supposed to be there, read the conf.d/clock file
Comment 2 Vince C. 2008-01-10 05:56:15 UTC
(In reply to comment #1)
> the : is not supposed to be there, read the conf.d/clock file

I've read conf.d/clock file and I still don't understand what a bash variable substitution like ${TIMEZONE-Factory} would mean. Would you mind explaining it, please?

(I expect ${VAR:-value} to mean "If $VAR is unset then return 'value'" so if was the initial intent, why remove the colon?)
Comment 3 SpanKY gentoo-dev 2008-01-10 06:36:46 UTC
check out the bash man page

${VAR:-val} => set "VAR" to "val" if "VAR" is unset *or null*
${VAR-val} => set "VAR" to "val" if "VAR" is unset

correlate that with conf.d/clock and i think you should see why we do not want the colon there
Comment 4 Vince C. 2008-01-10 08:59:37 UTC
Thanks a lot Sparky. I didn't know that syntax. Probably time to update my old bash manuals ;-) .

Note that particular syntax is not mentioned in bash man pages. I only knew of ${VAR:=default value}, which is similar, except it also sets the variable if it is NULL but it is probably not appropriate in this case.
Comment 5 SpanKY gentoo-dev 2008-01-10 09:17:37 UTC
sure it is ... right above the actual enumeration, it states:
... omitting the colon results in a test only for a parameter that is unset.
Comment 6 Vince C. 2008-01-10 19:18:14 UTC
(In reply to comment #5)
> sure it is ... right above the actual enumeration, it states:
> ... omitting the colon results in a test only for a parameter that is unset.

Oops! I probably didn't pay attention to that paragraph... Thanks for pinning this.