Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1677442

Summary: document limited usefulness of the --apple function in file(1) man page
Product: Red Hat Enterprise Linux 8 Reporter: Vishnu Unnikrishnan <vunnikri>
Component: fileAssignee: Kamil Dudka <kdudka>
Status: CLOSED ERRATA QA Contact: Karel Volný <kvolny>
Severity: low Docs Contact:
Priority: unspecified    
Version: 8.1CC: kdudka, kvolny, vmihalko
Target Milestone: rcKeywords: EasyFix, Patch
Target Release: 8.0Flags: kdudka: needinfo-
pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: file-5.33-15.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-04 01:57:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1681023    
Bug Blocks:    

Description Vishnu Unnikrishnan 2019-02-14 23:44:11 UTC
Description of problem:

Issue with the output of "--apple" option in file output. it is not giving the expected result.

Version-Release number of selected component (if applicable):

RHEL 8 Beta
file-5.33

How reproducible:

#file --apple <file_name>

Steps to Reproduce:
1.Open any file with --apple option.
2.
3.

Actual results:

The output of the file command with --apple option gives two results only for any type of file.

=> UNKNUNKN
=> ERROR: (null)

Expected results:

As per the man page description, --apple option should print the file type and creator code as the output.

--apple
             Causes the file command to output the file type and creator code as used by older MacOS versions.  The code consists of eight letters, the first describing the file type, the latter the creator.


But here for any regular files like ASCII test, gzip, zip files, it gives output as UNKNUNKN. If it is an empty file or directory, character special files, --apple option gives "ERROR: (null)".

 As per the manpage documentation, this should not be the result for this option. It is a new option added in RHEL8.


Example
=======

# file test1.tar.gz --apple
test1.tar.gz: UNKNUNKN

# file test1.tar.gz 
test1.tar.z: gzip compressed data, last modified: Thu Feb 14 23:13:08 2019, from Unix, original size 10240

--------------------------------------

# file --apple a         <<<<<<<<<Empty text file
a: ERROR: (null)   <<<-----

# file a
a: empty

# echo "1234" > a        <<<<<<<<<Added some content

# file a
a: ASCII text

# file --apple a
a: UNKNUNKN       <<<------

--------------------------------------

# file /dev/tty
/dev/tty: character special (5/0)

# ll /dev/tty
crw-rw-rw-. 1 root tty 5, 0 Feb 15 00:20 /dev/tty
# file /dev/tty --apple
/dev/tty: ERROR: (null)   <<<------



Additional info:

If this is the expected result, then it conflicts with manpage information and it has to be modified. otherwise this need to fixed.

Comment 1 Kamil Dudka 2019-02-15 08:57:29 UTC
It seems that the --apple option is indeed broken.  On the other hand, it did not work much better in RHEL-7.  We can ask upstream to either make the option useful again, or deprecate it.  But do not expect this to be fixed in RHEL-8 unless there is a business justification.

Comment 2 Kamil Dudka 2019-02-15 13:19:11 UTC
(In reply to Vishnu Unnikrishnan from comment #0)
> Actual results:
> 
> The output of the file command with --apple option gives two results only
> for any type of file.

Actually, the above statement is incorrect.  The option works fine for file formats that have --apple output defined:

$ curl -O http://cd.textfiles.com/carousel344/MACTOSH/MACTN/TN001.SIT

$ file --mime TN001.SIT 
TN001.SIT: application/x-stuffit; charset=binary

$ file --apple TN001.SIT 
TN001.SIT: SIT!SIT!

Comment 3 Vishnu Unnikrishnan 2019-02-15 16:59:45 UTC
Hi,

In that case, do we need to modify the man page statement for --apple option?

--apple
             Causes the file command to output the file type and creator code as used by older MacOS versions.  The code consists of eight letters, the first describing the file type, the latter the creator.

I think it would be better to add "The option works for file formats that have --apple output defined" to avoid confusion.

Comment 4 Kamil Dudka 2019-02-18 16:36:06 UTC
I have proposed a patch upstream to modify the man page:

https://mailman.astron.com/pipermail/file/2019-February/000072.html

Comment 5 Kamil Dudka 2019-02-25 13:00:55 UTC
upstream commit:

https://github.com/file/file/commit/642f269e

Comment 11 Kamil Dudka 2020-03-25 20:04:06 UTC
We need to pick the following upstream commit:

https://github.com/file/file/commit/cde5f596

Comment 23 errata-xmlrpc 2020-11-04 01:57:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (file bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4531