disk/storage_device_sda fails on non-English systems

Bug #1484872 reported by Kristin Chuang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Checkbox Provider - Base
Fix Released
High
Pierre Equoy

Bug Description

[Steps]
1. Run plainbox test case /disk/storage_device_sda on non-English system such as Kylin
2. Check if case passes

[Expected Results]
Case should pass

[Actual results]
Case fail with error message "dev/sda doesn't report a size".

ii plainbox 0.22.2+ppa~ubuntu14.04.1 all toolkit for software and hardware integration testing
ii plainbox-glmark2-es2-meta 0.18-1 amd64 Meta-package to selectively install glmark2-es2
ii plainbox-insecure-policy 0.22.2+ppa~ubuntu14.04.1 all policykit policy required to use plainbox (insecure version)
ii plainbox-provider-certification-client 0.18-1 all Client Certification provider for Plainbox
ii plainbox-provider-checkbox 0.21.4-1~ppa2 amd64 CheckBox provider for PlainBox
ii plainbox-provider-oem 0.18 all plainbox oem provider
ii plainbox-provider-oem-stella 0.18 all plainbox oem provider for stella
ii plainbox-provider-resource-generic 0.19+ppa~ubuntu14.04.1 amd64 CheckBox generic resource jobs provider
ii python3-plainbox 0.22.2+ppa~ubuntu14.04.1 all toolkit for software and hardware testing (python3 module)

Related branches

Revision history for this message
Kristin Chuang (kristinchuang) wrote :

Did some investigation and found out the main reason seems to be in line #52 of script /usr/lib/plainbox-provider-checkbox/storage_test:
size=`parted -l -s |grep "Disk.*${disk}" |awk '{print $3}'`

On a Simplified Chinese Kylin system, perform the command "$sudo parted -l -s" and you will notice in the output that the string "Disk" is now replaced by the Chinese characters standing for "disk" (i.g. "磁盘").

The command size=`parted -l -s |grep "Disk.*${disk}" |awk '{print $3}'` therefore returns nothing, the script will terminate with "exit 1" and test case will fail.

Test case passed when I manually replaced "Disk" in line #52 of /usr/lib/plainbox-provider-checkbox/storage_test to "磁盘".

Jerry Kao (jerry.kao)
Changed in plainbox-provider-checkbox:
importance: Undecided → High
Pierre Equoy (pieq)
Changed in plainbox-provider-checkbox:
status: New → Confirmed
Revision history for this message
Pierre Equoy (pieq) wrote :

This script relies on grepping/regexp English text. As Kristin mentioned, line 52 is an example, but line 40 also uses English text:

    WARN=$(parted -s ${disk} print | grep "^Warning.*${disk}.*[Rr]ead-only" 2>&1)

Revision history for this message
Pierre Equoy (pieq) wrote :

According to Plainbox controller (checkbox/plainbox/plainbox/impl/ctrl.py), commands are run using LANG=C.UTF-8 (i.e. plain English language) unless explicitly mentioned in the job description (using the `preserve-locale` flag).

When running the following command:

    plainbox -C --trace plainbox.ctrl run -i .*disk/storage_device.*

we can see that the `storage_test` command is launched with pkexec as root using flag `LANG=C.UTF-8`.

However, the output still fails.

If we manually launch the command prefixed by the correct flags, the output works:

    LANG=C.UTF-8 LANGUAGE= sudo parted -l -s |grep "Disk.*sda" |awk '{print $3}'
    (this will return a value such as “500GB”)

Revision history for this message
Pierre Equoy (pieq) wrote :

The problem comes from the fact that in ctrl.py, we do not pass the “non-internationalized” LANGUAGE variable to pkexec (instead, we delete it from the dictionary used), so pkexec uses the one available in the system, which in the case of a Kylin system equals to “zh_CN:zh”.

Pierre Equoy (pieq)
Changed in plainbox-provider-checkbox:
milestone: none → 0.22
assignee: nobody → Pierre Equoy (pierre-equoy)
Pierre Equoy (pieq)
Changed in plainbox-provider-checkbox:
status: Confirmed → Fix Committed
Changed in plainbox-provider-checkbox:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.