Bug 38497 - Different MIME encoding in the --mime and --mime-encoding output
Summary: Different MIME encoding in the --mime and --mime-encoding output
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: file (show other bugs)
Version: unstable
Hardware: all Linux
: P5 normal
Assignee: placeholder@altlinux.org
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-18 16:47 MSK by Nikolay A. Fetisov
Modified: 2021-10-13 16:44 MSK (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikolay A. Fetisov 2020-05-18 16:47:29 MSK
Для file-4.26-alt13:

Согласно справке и странице man:
$ file --help 2>&1 |grep mime
  -i, --mime                 output MIME type strings (--mime-type and
                               --mime-encoding)
      --mime-type            output the MIME type
      --mime-encoding        output the MIME encoding

Т.е., предполагается, что --mime выводит MIME полностью, 
--mime-type - только тип, --mime-encoding - только кодировку.

Создаём файлы в ASCII и UTF-8:

$ LC_ALL=C rpm -q --qf '%{SUMMARY}\n' file  > file.ascii
$ LC_ALL=ru_RU.UTF-8 rpm -q --qf '%{SUMMARY}\n' file  > file.utf8

$ cat file.ascii
A utility for determining file types
$ cat file.utf8 
Утилита для определения типов файлов

Вывод file для файла ASCII:

$ file --brief --mime file.ascii
text/plain charset=us-ascii
$ file --brief --mime-type file.ascii
text/plain
$ file --brief --mime-encoding file.ascii
7bit

Ввод кодировки по --mime и --mime-encoding отличается.


То же, для UTF-8:

$ file --brief --mime file.utf8 
text/plain charset=utf-8
$ file --brief --mime-type file.utf8 
text/plain
$ file --brief --mime-encoding file.utf8 
binary


Т.е., --mime выдает правильную строку MIME, --mime-type - выдаёт соответствующий тип MIME,
а --mime-encoding - что-то своё. И вместе --mime-type и --mime-encoding строку --mime не дают.
Comment 1 Nikolay A. Fetisov 2020-05-18 17:09:11 MSK
И идёт это несоответствие из libmagic, т.е., например, модуль Perl File::LibMagic также затронут.
Там для прохождения сборки пакета изменён тест t/oo-api.t, см. perl-File-LibMagic.spec , строки 24-26.
Comment 2 Nikolay A. Fetisov 2021-10-13 16:44:30 MSK
Было исправлено в file-5.40-alt4.
Для p10 пока актуально.