Description of problem: Small change in ruby file results in its different classification: --- /home/vondruch/rhel-scm/ruby/ruby-2.0.0-p247/lib/rubygems/core_ext/kernel_require.rb +++ /var/lib/mock/rhel-7-x86_64/root/builddir/build/BUILD/ruby-2.0.0-p353/lib/rubygems/core_ext/kernel_require.rb @@ -4,7 +4,11 @@ # See LICENSE.txt for permissions. #++ +require 'monitor' + module Kernel + + RUBYGEMS_ACTIVATION_MONITOR = Monitor.new # :nodoc: if defined?(gem_original_require) then # Ruby ships with a custom_require, override its require @@ -32,6 +36,10 @@ # that file has already been loaded is preserved. def require path + RUBYGEMS_ACTIVATION_MONITOR.enter + + path = path.to_path if path.respond_to? :to_path + spec = Gem.find_unresolved_default_spec(path) if spec Gem.remove_unresolved_default_spec(spec) @@ -111,6 +119,8 @@ end raise load_error + ensure + RUBYGEMS_ACTIVATION_MONITOR.exit end private :require --- $ file ~/rhel-scm/ruby/ruby-2.0.0-p247/lib/rubygems/core_ext/kernel_require.rb /home/vondruch/rhel-scm/ruby/ruby-2.0.0-p247/lib/rubygems/core_ext/kernel_require.rb: Ruby module source, ASCII text $ file /var/lib/mock/rhel-7-x86_64/root/builddir/build/BUILD/ruby-2.0.0-p353/lib/rubygems/core_ext/kernel_require.rb /var/lib/mock/rhel-7-x86_64/root/builddir/build/BUILD/ruby-2.0.0-p353/lib/rubygems/core_ext/kernel_require.rb: Ruby script, ASCII text Version-Release number of selected component (if applicable): $ rpm -q file file-5.14-12.fc20.x86_64 Actual results: The classification changes. Expected results: The classification stays the same. Additional info: To be honest, I am not sure if file is not trying to be over-granular. There is nothing like "Ruby module source". Modules can be freely mixed with classes and other code. There might be more modules in single file etc. I don't think there is way how to reliably distinguish such files. However, the classifications could look like: Ruby script, module source, ASCII text Ruby script, class source, ASCII text Ruby script, class/module source, ASCII text In addition, not sure how file classifies the ASCII text, but since Ruby 2.0, every source code is treated as UTF-8 by default, unless there is some magic comment such as "# encoding: US-ASCII" somewhere on top of the file, but this might deserve independent report ;)
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle. Changing version to '22'. More information and reason for this action is here: https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22
This package has changed ownership in the Fedora Package Database. Reassigning to the new owner of this component.
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed.
This was not resolved to my knowledge ...
The default output of file(1) is intended for humans. It is continuously being extended to provide additional info, so it can easily differ between different versions of file(1). Please consider using the --mime option if you need more predictable output. If you want to improve the heuristics that file uses for classification of ruby source code, please attach a set of examples with the expected classification.
As I tried to explain in additional information, there is really nothing like "Ruby module". The file is always Ruby script, it might contain classes, modules, mixture of classes or modules, or no classes or modules at all. But there is no official notion of "Ruby module source" as file currently pretends. This is completely artificial thing ... And as far as I remember, this issue was unveiled by some tool like rpmdiff or so, which is using file on background, so I am not in control of the parameters ...
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle. Changing version to '25'.
file-5.29-9.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-ee474bb41c
file-5.30-10.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-859756e3ac
Created attachment 1315153 [details] Patch proposal Ruby magic file modification Upstream commit: https://github.com/file/file/commit/d56eb7ea0b9c2a4edec17032a92fe66aebb1aa3a
file-5.29-9.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-ee474bb41c
file-5.30-10.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-859756e3ac
file-5.30-10.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.
file-5.29-9.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.