unattended-upgrade --help raises UnicodeEncodeError when stdout encoding is ascii
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
apt (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Xenial |
New
|
Undecided
|
Unassigned | ||
Bionic |
Fix Released
|
Undecided
|
Unassigned | ||
unattended-upgrades (Ubuntu) |
Won't Fix
|
Undecided
|
Unassigned | ||
Xenial |
Won't Fix
|
Undecided
|
Unassigned | ||
Bionic |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
[Impact]
* unattended-upgrades --help crashes in apt.systemd.daily script when locale is not in UTF-8.
[Test Case]
In the fixed case no crash is observed.
rbalint@yogi:~$ lxc launch ubuntu:18.04 bb-lp-1806076
Creating bb-lp-1806076
Starting bb-lp-1806076
rbalint@yogi:~$ lxc shell bb-lp-1806076
mesg: ttyname failed: No such device
root@bb-
The following package was automatically installed and is no longer required:
libfreetype6
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
language-pack-ru
The following NEW packages will be installed:
language-pack-ru language-
0 upgraded, 2 newly installed, 0 to remove and 7 not upgraded.
Need to get 2310 kB of archives.
After this operation, 11.8 MB of additional disk space will be used.
Selecting previously unselected package language-
(Reading database ... 28536 files and directories currently installed.)
Preparing to unpack .../language-
Unpacking language-
Selecting previously unselected package language-pack-ru.
Preparing to unpack .../language-
Unpacking language-pack-ru (1:18.04+20180712) ...
Setting up language-pack-ru (1:18.04+20180712) ...
Setting up language-
Generating locales (this might take a while)...
ru_RU.UTF-8... done
ru_UA.UTF-8... done
Generation complete.
root@bb-
LANG=ru_RU
root@bb-
/usr/lib/
Traceback (most recent call last):
File "/usr/bin/
(options, args) = parser.parse_args() # type: ignore
File "/usr/lib/
stop = self._process_
File "/usr/lib/
self.
File "/usr/lib/
option.
File "/usr/lib/
self.action, self.dest, opt, value, values, parser)
File "/usr/lib/
parser.
File "/usr/lib/
file.
UnicodeEncodeError: 'ascii' codec can't encode characters in position 126-133: ordinal not in range(128)
root@bb-
LANG=ru_RU.UTF-8
root@bb-
root@bb-
[Where problems could occur]
* Nowhere, really. The fix is setting LC_ALL=C.UTF-8 for u-u --help and it is processed by grep then.
[Original Bug Text]
The Ubuntu Error Tracker has been receiving reports about a problem regarding unattended-
If you do not have access to the Ubuntu Error Tracker and are a software developer, you can request it at http://
Also seen in:
* https:/
summary: |
- /usr/bin/unattended-upgrade:UnicodeEncodeError:/usr/bin/unattended- - upgrade@1983:parse_args:_process_args:_process_long_opt:process:take_action:print_help + unattended-upgrade --help raises UnicodeEncodeError when stdout encoding + is ascii |
description: | updated |
Changed in apt (Ubuntu): | |
status: | New → Fix Committed |
Changed in unattended-upgrades (Ubuntu): | |
status: | New → Won't Fix |
Changed in apt (Ubuntu Bionic): | |
status: | New → Triaged |
Changed in unattended-upgrades (Ubuntu Xenial): | |
status: | New → Won't Fix |
Changed in unattended-upgrades (Ubuntu Bionic): | |
status: | New → Won't Fix |
description: | updated |
description: | updated |
Unattended-upgrades does not print to stdout by default thus it can operate properly in the environments triggering the bug, but apt.systemd.daily executes u-u --help that may crash.
To avoid the crash apt could set LC_ALL=C.UTF8 when running unattended-upgrades --help as proposed in the MR below:
https:/ /salsa. debian. org/apt- team/apt/ merge_requests/ 34