Bug 32678 - Update languages.json location and remove file from univention-management-console-frontend
Update languages.json location and remove file from univention-management-con...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC (Generic)
UNSTABLE
Other Linux
: P5 normal (vote)
: UCS 3.2
Assigned To: Lukas Walter
Florian Best
: interim-3
Depends on: 32677
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-24 13:02 CEST by Erik Damrose
Modified: 2013-11-19 06:43 CET (History)
3 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments
use real json (716 bytes, patch)
2013-10-28 17:24 CET, Florian Best
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Damrose univentionstaff 2013-09-24 13:02:35 CEST
Bug 32677 moved languages.json to /var/www/ucs-overview. The new location  has to be adapted in UMC. In addition, the file template has to be removed from univention-management-console-frontend

+++ This bug was initially created as a clone of Bug #32677 +++
Comment 1 Erik Damrose univentionstaff 2013-09-24 13:11:51 CEST
language specific information should be removed from /var/www/ucs-overview/entries.json and languages.json be used instead.
Comment 2 Erik Damrose univentionstaff 2013-09-24 14:32:27 CEST
The UCRV umc/server/languages/.* has been renamed to ucs/server/languages/.* to point out that it is not umc specific.

When removing the file from univention-management-console-frontend take note that the original variable description somehow ended up in the package 
univention-management-console/debian/univention-management-console-server.univention-config-registry-variables
Comment 3 Lukas Walter univentionstaff 2013-10-08 16:53:17 CEST
- removed UCRV from univention-management-console
- defaults for umc/server/languages/.* will not be set in umc frontend postinst anymore
- when updating from a version below 6.0.7-3, umc/server/languages/.* values will be adopted for ucs/server/languages/.* in univention-apache postinst (defaults will still be on new installations)
- removed locales field from entries.json template
- UCS overview has been adopted to use languages.json

Added changelog entry for ucs-3.2

svn r44905:
===========
univention-apache (6.0.7-3)
univention-management-console (6.0.15-4)
univention-management-console-frontend (3.0.90-2)
Comment 4 Erik Damrose univentionstaff 2013-10-09 09:00:36 CEST
With the current changes we maintain two languages.json files. The file residing in usr/share/univention-management-console-frontend/languages.json should be removed, as mentioned in Comment 0.
Comment 5 Lukas Walter univentionstaff 2013-10-09 09:52:24 CEST
Template removed.
Comment 6 Florian Best univentionstaff 2013-10-21 14:45:18 CEST
univention-apache.postinst:

127 if dpkg --compare-versions "$2" le-nl 6.0.7-2
128 echo "we are in"
129 then

→ remove that wrong echo
→ code is not executed when updating

141 else
…

→ remove the "else" code. This should be executed in every case. The variables are only set if they doesn't exists.
Comment 7 Alexander Kläser univentionstaff 2013-10-22 14:23:02 CEST
No ucs/server/languages exist on a freshly installed UCS system.
Comment 8 Moritz Muehlenhoff univentionstaff 2013-10-22 14:32:37 CEST
(In reply to Alexander Kläser from comment #7)
> No ucs/server/languages exist on a freshly installed UCS system.

As a result only English can be selected in the UMC.
Comment 9 Florian Best univentionstaff 2013-10-22 14:41:36 CEST
(In reply to Moritz Muehlenhoff from comment #8)
> (In reply to Alexander Kläser from comment #7)
> > No ucs/server/languages exist on a freshly installed UCS system.
> 
> As a result only English can be selected in the UMC.

as i already said, this is caused by the wrong postinst "127 if dpkg --compare-versions "$2" le-nl 6.0.7-2" da müsste greather than (gt) oder so sein...
Comment 10 Lukas Walter univentionstaff 2013-10-23 11:46:32 CEST
The new ucs/server/languages/.* variables will now be set when updating AND when making a fresh installation.

The dpkg-version comparison is correct: we want the old variables to be removed once when updating from a version less than or equal to (but not null) 6.0.7-2.
Comment 11 Florian Best univentionstaff 2013-10-23 12:15:05 CEST
before:
umc/server/languages/de_DE: Deutsch
umc/server/languages/en_US: English

after:
ucs/server/languages/de: Deutsch
ucs/server/languages/en: English
umc/server/languages/de_DE: Deutsch
umc/server/languages/en_US: English

IFS=_ is a problem when the key contains "_"
→ s/unset/ucr unset/
Comment 12 Lukas Walter univentionstaff 2013-10-23 15:29:17 CEST
(In reply to Florian Best from comment #11)
> before:
> umc/server/languages/de_DE: Deutsch
> umc/server/languages/en_US: English
> 
> after:
> ucs/server/languages/de: Deutsch
> ucs/server/languages/en: English
> umc/server/languages/de_DE: Deutsch
> umc/server/languages/en_US: English
> 
> IFS=_ is a problem when the key contains "_"
> → s/unset/ucr unset/

Fixed that, UCRVs will now be unset correctly.
Comment 13 Florian Best univentionstaff 2013-10-23 16:19:03 CEST
You are calling ucr set and ucr unset for every variable again. This triggers always some ucr commits. Could you set them all at once? Or is this OK (@Alex/any other)?

+       langs=($(ucr search umc/server/languages/ | cut -d: -f 1))
+       for lang in ${langs[@]}; do
+               newLang="ucs/${lang#umc/}"
+               ucr set $newLang="$(ucr get "$lang")"
+               ucr unset "$lang"
+       done
Comment 14 Lukas Walter univentionstaff 2013-10-24 10:56:43 CEST
(In reply to Florian Best from comment #13)
> You are calling ucr set and ucr unset for every variable again. This
> triggers always some ucr commits. Could you set them all at once? Or is this
> OK (@Alex/any other)?
> 
> +       langs=($(ucr search umc/server/languages/ | cut -d: -f 1))
> +       for lang in ${langs[@]}; do
> +               newLang="ucs/${lang#umc/}"
> +               ucr set $newLang="$(ucr get "$lang")"
> +               ucr unset "$lang"
> +       done

Ok, I've change this so that all UCRVs will be (un)set at once.
Comment 15 Florian Best univentionstaff 2013-10-24 11:22:54 CEST
ucr set umc/server/languages/de_AT="Deutsch 'Österreich"
→
xargs: unmatched doppelte quote; by default quotes are special to xargs unless you use the -0 option
→ I don't think this will occur, if a customer has this his values will not be adopted.

Also if the string "umc/server/languages/" occurs anywhere this would fail.
→
-ucr --keys-only search umc/server/languages/
+ucr --keys-only search ^umc/server/languages/
(Do it for both)
Comment 16 Lukas Walter univentionstaff 2013-10-24 13:39:47 CEST
(In reply to Florian Best from comment #15)
> ucr set umc/server/languages/de_AT="Deutsch 'Österreich"
> →
> xargs: unmatched doppelte quote; by default quotes are special to xargs
> unless you use the -0 option
> → I don't think this will occur, if a customer has this his values will not
> be adopted.
> 
> Also if the string "umc/server/languages/" occurs anywhere this would fail.
> →
> -ucr --keys-only search umc/server/languages/
> +ucr --keys-only search ^umc/server/languages/
> (Do it for both)

OK, xarg will be called with "-0" when migrating the old UCRVs.
key search will be more exact (using "^" as suggested), though "umc/server/languages/" most likely would never appear in a UCRV value.
Comment 17 Alexander Kläser univentionstaff 2013-10-24 13:41:19 CEST
(In reply to Florian Best from comment #13)
> You are calling ucr set and ucr unset for every variable again. This
> triggers always some ucr commits. Could you set them all at once? Or is this
> OK (@Alex/any other)?

OK for me, this should not be a real performance problem. But maybe I am wrong.
Comment 18 Florian Best univentionstaff 2013-10-24 15:37:02 CEST
The UMC-Frontend is now only available in English. This is because the old language.json still exists and is in use but contains no languages.
Comment 19 Lukas Walter univentionstaff 2013-10-24 17:33:47 CEST
univention-management-console-frontend (3.0.129-1) unstable; urgency=low

  * use new languages.json file for UMC i18n
  * remove old languages.json file when updating from a version below
    3.0.129-1
  (Bug #32678)

svn 45575
Comment 20 Florian Best univentionstaff 2013-10-25 08:30:03 CEST
The old template still exists…

/etc/univention/templates/files/usr/share/univention-management-console-frontend/languages.json

If this would be correctly unregistered this is probably not neccessary (not sure):
+if dpkg --compare-versions "$2" le-nl 3.0.129-1
+then
+       rm -f /usr/share/univention-management-console-frontend/languages.json
+fi
Comment 21 Lukas Walter univentionstaff 2013-10-28 14:49:11 CET
Old template will be removed correctly now, as well as the legacy UCR info file.

svn 45635: univention-management-console-frontend (3.0.133-1)
Comment 22 Florian Best univentionstaff 2013-10-28 17:23:36 CET
before:
umc/server/languages/de_AT: Deutsch 'Österreich'
umc/server/languages/de_AU: Deutsch (Österreich)
umc/server/languages/de_CH: Deutsch (Schweiz)
umc/server/languages/de_DE: Deutsch
umc/server/languages/en_GB: English (United Kingdom)
umc/server/languages/en_US: English

after:
ucs/server/languages/de_AT: 'Deutsch 'Österreich''ucs/server/languages/de_AU='Deutsch (Österreich)'ucs/server/languages/de_CH='Deutsch (Schweiz)'ucs/server/languages/de_DE='Deutsch'ucs/server/languages/en_GB='English (United Kingdom)'ucs/server/languages/en_US='English'
[+defaults]

The unused "conffiles/usr/share/univention-management-console-frontend" still exists in SVN.
Comment 23 Florian Best univentionstaff 2013-10-28 17:24:38 CET
Created attachment 5535 [details]
use real json

Please also apply this patch (so that the output is real JSON, not broken strings).
Comment 24 Lukas Walter univentionstaff 2013-10-29 12:43:22 CET
svn 45671: univention-apache (6.0.13-2) unstable; urgency=low

  * do not call xargs with "-0" in postinst (leads to some UCRVs with invalid
    values)
  * use json module in languages.json template instead of joining a list to a
    string
  (Bug #32678)

Update/new installation work for me with that.
Comment 25 Philipp Hahn univentionstaff 2013-10-29 14:29:45 CET
(In reply to Florian Best from comment #15)
> ucr set umc/server/languages/de_AT="Deutsch 'Österreich"
> →
> xargs: unmatched doppelte quote; by default quotes are special to xargs
> unless you use the -0 option

NO: xargs' handling of quotes is broken when "s are mixed with 's. The "-0" changes xargs to split on '\0' characters instead of blanks. Since regular ucr doesn't output any such characters, the full output of the previous ucr search command is passed as _one_ argument to "ucr set".

Use "ucr search ... | xargs -r -d '\n' ucr set" instead:
1. Since UCR can't store any newlines, it's safe to use it as a separator of multiple values.
2. The "-r" makes xargs skip the invocation of ucr if no argument is given. Otherwise you get the following error message:

# ucr set
E: too few arguments for command [set]
try `univention-config-registry --help` for more information
Comment 26 Lukas Walter univentionstaff 2013-10-29 16:05:26 CET
(In reply to Philipp Hahn from comment #25)
> (In reply to Florian Best from comment #15)
> > ucr set umc/server/languages/de_AT="Deutsch 'Österreich"
> > →
> > xargs: unmatched doppelte quote; by default quotes are special to xargs
> > unless you use the -0 option
> 
> NO: xargs' handling of quotes is broken when "s are mixed with 's. The "-0"
> changes xargs to split on '\0' characters instead of blanks. Since regular
> ucr doesn't output any such characters, the full output of the previous ucr
> search command is passed as _one_ argument to "ucr set".
> 
> Use "ucr search ... | xargs -r -d '\n' ucr set" instead:
> 1. Since UCR can't store any newlines, it's safe to use it as a separator of
> multiple values.
> 2. The "-r" makes xargs skip the invocation of ucr if no argument is given.
> Otherwise you get the following error message:
> 
> # ucr set
> E: too few arguments for command [set]
> try `univention-config-registry --help` for more information

OK, I've adapted this.
Comment 27 Florian Best univentionstaff 2013-10-30 08:33:45 CET
OK
Comment 28 Stefan Gohmann univentionstaff 2013-11-19 06:43:09 CET
UCS 3.2 has been released:
 http://docs.univention.de/release-notes-3.2-en.html
 http://docs.univention.de/release-notes-3.2-de.html

If this error occurs again, please use "Clone This Bug".