Bug 1303293 - [abrt] dnf clean metadata crashes with ru_RU locale.
Summary: [abrt] dnf clean metadata crashes with ru_RU locale.
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 26
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
Assignee: rpm-software-management
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1286559 1303447 1316886 1334746 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-30 11:31 UTC by Epifanov Ivan
Modified: 2017-03-23 08:08 UTC (History)
18 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2017-03-23 08:01:18 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Epifanov Ivan 2016-01-30 11:31:01 UTC
dnf-1.1.6-1

# LC_ALL=ru_RU dnf clean metadata
Сброс источников: fedora google-chrome russianfedora-free russianfedora-nonfree russianfedora-free-updates
                : russianfedora-nonfree-updates updates
Traceback (most recent call last):
  File "/usr/bin/dnf", line 57, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 174, in user_main
    errcode = main(args)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 60, in main
    return _main(base, args)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 112, in _main
    cli.run()
  File "/usr/lib/python3.4/site-packages/dnf/cli/cli.py", line 1095, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/clean.py", line 230, in run
    return self.clean(extcmds)
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/clean.py", line 200, in clean
    xmlcode, xmlresults = _clean_metadata(repos)
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/clean.py", line 107, in _clean_metadata
    return _clean_files(repos, exts, 'cachedir', 'metadata')
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/clean.py", line 98, in _clean_files
    return _clean_filelist(filetype, filelist)
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/clean.py", line 85, in _clean_filelist
    msg %= (removed, filetype)
TypeError: not all arguments converted during string formatting

Running with LC_ALL=C works fine.


I'm pretty sure that's a translation problem. Looking at https://github.com/rpm-software-management/dnf/blob/master/po/ru.po#L1484 it clearly misses third plural form (well, actually second is horribly wrong too).

Comment 1 Honza Silhan 2016-02-01 13:33:42 UTC
Thanks for the report. You can make better translations at https://fedora.zanata.org/project/view/dnf ;)

Comment 2 Michal Domonkos 2016-02-01 13:41:27 UTC
*** Bug 1303447 has been marked as a duplicate of this bug. ***

Comment 3 a.zykov.hotcoder 2016-02-04 19:45:35 UTC
Another user experienced a similar problem:

Try execute 'sudo dnf clean packages' or 'sudo dnf clean all'.

reporter:       libreport-2.6.3
cmdline:        /usr/bin/python3 /bin/dnf clean packages
executable:     /bin/dnf
kernel:         4.3.4-300.fc23.x86_64
package:        dnf-1.1.6-1.fc23
reason:         clean.py:85:_clean_filelist:TypeError: not all arguments converted during string formatting
runlevel:       N 5
type:           Python3
uid:            0

Comment 4 Sergei LITVINENKO 2016-02-14 17:21:19 UTC
in case of locale ru_UA.UTF-8 dnf is affected too


Traceback (most recent call last):
  File "/usr/bin/dnf", line 57, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 174, in user_main
    errcode = main(args)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 60, in main
    return _main(base, args)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 112, in _main
    cli.run()
  File "/usr/lib/python3.4/site-packages/dnf/cli/cli.py", line 1095, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/clean.py", line 230, in run
    return self.clean(extcmds)
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/clean.py", line 184, in clean
    pkgcode, pkgresults = _clean_packages(repos)
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/clean.py", line 114, in _clean_packages
    return _clean_files(repos, exts, 'pkgdir', 'package')
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/clean.py", line 98, in _clean_files
    return _clean_filelist(filetype, filelist)
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/clean.py", line 85, in _clean_filelist
    msg %= (removed, filetype)
TypeError: not all arguments converted during string formatting

Comment 5 Maxim Prohorenko 2016-02-19 12:14:01 UTC
[root@WS143 maxim.prohorenko]# dnf update -y  
Проверка истечения последних метаданных произведена 2:21:53 назад на Fri Feb 19 12:42:17 2016.
Зависимости разрешены.
Отсутствуют действия для выполнения
Выполнено!
[root@WS143 maxim.prohorenko]# dnf clean all
Сброс источников: rpmfusion-nonfree-updates rpmfusion-free google-chrome rpmfusion-free-22 russianfedora-branding-updates russianfedora-fixes rpmfusion-nonfree-updates-testing fedora rpmfusion-free-updates-22
                : updates rpmfusion-nonfree-22 rpmfusion-free-updates russianfedora-free-updates rpmfusion-free-updates-testing russianfedora-free rpmfusion-nonfree russianfedora-fixes-updates
                : russianfedora-nonfree-updates rpmfusion-nonfree-updates-22 russianfedora-nonfree russianfedora-branding
Очистка всего
Traceback (most recent call last):
  File "/bin/dnf", line 57, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 174, in user_main
    errcode = main(args)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 60, in main
    return _main(base, args)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 112, in _main
    cli.run()
  File "/usr/lib/python3.4/site-packages/dnf/cli/cli.py", line 1095, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/clean.py", line 230, in run
    return self.clean(extcmds)
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/clean.py", line 184, in clean
    pkgcode, pkgresults = _clean_packages(repos)
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/clean.py", line 114, in _clean_packages
    return _clean_files(repos, exts, 'pkgdir', 'package')
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/clean.py", line 98, in _clean_files
    return _clean_filelist(filetype, filelist)
  File "/usr/lib/python3.4/site-packages/dnf/cli/commands/clean.py", line 85, in _clean_filelist
    msg %= (removed, filetype)
TypeError: not all arguments converted during string formatting
[root@WS143 maxim.prohorenko]# dnf remove python3-dnf-1.1.6-2.fc23.noarch
Зависимости разрешены.
Ошибка: The operation would result in removing the following protected packages: dnf.
[root@WS143 maxim.prohorenko]# uname -a
Linux WS143.local.rfdyn.ru 4.3.5-300.fc23.x86_64 #1 SMP Mon Feb 1 03:18:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@WS143 maxim.prohorenko]# 
[root@WS143 maxim.prohorenko]# LANG=C dnf clean all
Cleaning repos: rpmfusion-nonfree-updates-22 updates russianfedora-free-updates russianfedora-nonfree-updates rpmfusion-nonfree-updates-testing russianfedora-nonfree rpmfusion-free google-chrome
              : rpmfusion-free-updates-22 rpmfusion-free-updates rpmfusion-free-22 russianfedora-branding fedora rpmfusion-nonfree-22 russianfedora-free rpmfusion-nonfree rpmfusion-free-updates-testing
              : rpmfusion-nonfree-updates russianfedora-fixes-updates russianfedora-branding-updates russianfedora-fixes
Cleaning up Everything

Comment 6 Igor Gnatenko 2016-04-04 08:45:43 UTC
I can confirm this bug and was able to reproduce.

It doesn't look like it's missing 3rd plural, but it is still doesn't work.

Comment 7 Igor Gnatenko 2016-04-04 09:05:39 UTC
*** Bug 1316886 has been marked as a duplicate of this bug. ***

Comment 8 Igor Gnatenko 2016-05-16 11:30:00 UTC
*** Bug 1334746 has been marked as a duplicate of this bug. ***

Comment 9 Fedora Admin XMLRPC Client 2016-07-08 09:38:20 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 10 Štěpán Smetana 2016-08-01 12:58:10 UTC
Works for me.
Should be fixed in dnf-1.1.9 (Take a look at this commit https://github.com/rpm-software-management/dnf/commit/93159e360f0b6150e598bba783e22ca113201a40)
In case reopen this bug and provide more info.
Thanks

Comment 11 Igor Gnatenko 2016-08-05 06:19:15 UTC
(In reply to Štěpán Smetana from comment #10)
> Works for me.
> Should be fixed in dnf-1.1.9 (Take a look at this commit
> https://github.com/rpm-software-management/dnf/commit/
> 93159e360f0b6150e598bba783e22ca113201a40)
> In case reopen this bug and provide more info.
> Thanks

rpm gpg-signing has nothing to do with this bug.

Comment 12 Štěpán Smetana 2016-08-09 15:18:11 UTC
I could reproduce it only on virtual Fedora 22 with dnf-1.1.6-2
1. dnf update
2. dnf clean metadata

@Igor Please provide some steps to reproduce or close this bug. I could not reproduce it with new version of dnf.

Comment 13 Fedora End Of Life 2016-11-24 15:17:17 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 14 Michael Mráka 2016-11-28 14:12:47 UTC
Has been fixed during dnf 2.0 development.

dnf-2.0.0-0.rc1.4.fc26.noarch


#  LC_ALL=ru_RU dnf clean metadata
Failed to set locale, defaulting to C
42 files removed



Feel free to reopen if you disagree.

Comment 15 Michael Mráka 2016-11-28 14:13:29 UTC
Clearing needinfo.

Comment 16 Epifanov Ivan 2016-11-28 19:27:39 UTC
>Failed to set locale, defaulting to C
Seriously? You do understand, that you *do* need ru_RU locale to reproduce. It's *always* worked with C locale (and setting locale to C was used as a workaround)

Comment 17 Michael Mráka 2016-11-29 09:14:06 UTC
Oops, my fault.

After installation glibc-langpack-ru result is

#  LC_ALL=ru_RU dnf clean metadatary
37 ������ �������

which seems to work (except I have not correct terminal font) but it still fails for

 LC_ALL=ru dnf clean metadata
Failed to set locale, defaulting to C
0 \u0444\u0430\u0439\u043b\u043e\u0432 \u0443\u0434\u0430\u043b\u0435\u043d\u043e
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib64/python3.5/logging/__init__.py", line 982, in emit
    stream.write(msg)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 23-28: ordinal not in range(128)
Call stack:
  File "/usr/bin/dnf", line 58, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.5/site-packages/dnf/cli/main.py", line 175, in user_main
    errcode = main(args)
  File "/usr/lib/python3.5/site-packages/dnf/cli/main.py", line 61, in main
    return _main(base, args)
  File "/usr/lib/python3.5/site-packages/dnf/cli/main.py", line 99, in _main
    return cli_run(cli, base)
  File "/usr/lib/python3.5/site-packages/dnf/cli/main.py", line 115, in cli_run
    cli.run()
  File "/usr/lib/python3.5/site-packages/dnf/cli/cli.py", line 954, in run
    return self.command.run()
  File "/usr/lib/python3.5/site-packages/dnf/cli/commands/clean.py", line 105, in run
    logger.info(P_('%d file removed', '%d files removed', count) % count)
Message: '0 \u0444\u0430\u0439\u043b\u043e\u0432 \u0443\u0434\u0430\u043b\u0435\u043d\u043e'
Arguments: ()


dnf-2.0.0-0.rc1.4.fc26.noarch

Comment 18 Epifanov Ivan 2016-11-29 12:08:50 UTC
I think second error is something different. There's no such thing as ru locale (well, it's "parent" pseudo-locale), so it defaults to C, which is right. And the error is right too. Yet, somehow it still tries to use ru translation (most of the translations are in "ru" pseudo-locale, not in ru_RU).


I'm pretty sure it will fail with LC_ALL=hu or LC_ALL=es

So, yeah, this bug is definitely fixed. But another one emerged, heh.

Comment 19 Jaroslav Mracek 2017-01-12 16:49:41 UTC
But dnf-2 works:
$ LC_ALL=ru dnf-2 clean all
bash: warning: setlocale: LC_ALL: cannot change locale (ru): No such file or directory
Failed to set locale, defaulting to C
Repository 'fedora' is missing name in configuration, using id.
0 файлов удалено

Comment 20 Honza Silhan 2017-01-30 13:23:12 UTC
This bug is planned to be fixed within next 1-2 months.

Comment 21 Fedora End Of Life 2017-02-28 09:53:16 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 22 Jaroslav Rohel 2017-03-02 11:17:41 UTC
This pull request fix the crash https://github.com/rpm-software-management/dnf/pull/751.

But another problem is with encoding of printed messages.
Althought we get message "...defaulting to C", message is translated (eg. to russian if "ru" is used) and unicode characters is translated to escape sequences.
That is because logger does not known the encoding of terminal (nonexistent locale "ru") and recodes all characters to ASCII.

Comment 23 Jaroslav Rohel 2017-03-02 12:29:00 UTC

This pull request fix the crash https://github.com/rpm-software-management/dnf/pull/751.

But another problem is with encoding of printed messages.
Althought we get message "...defaulting to C", message is translated (eg. to russian if "ru" is used) and unicode characters are translated to escape sequences.
That is because logger does not known the encoding of terminal (nonexistent locale "ru") and recodes all characters to ASCII.

BTW: Is encoding problem of dnf? Use the "locale -a" to obtain the names of the available locales. Is "ru" locale available on your system? Not. Why you want use unavailable locale?

Comment 24 Jaroslav Rohel 2017-03-23 08:01:18 UTC
It is fixed in version dnf-2.1.1-1.1.fc26.

Dnf uses the original (not translated) English messages if the locale is not available on system.

Comment 25 Jaroslav Rohel 2017-03-23 08:08:58 UTC
*** Bug 1286559 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.