Issue #17840 has been updated by xtkoba (Tee KOBAYASHI).


Seems intentionally done at [tool/rbinstall.rb:774](https://github.com/ruby/ruby/blob/dfca24af82e7d06adcb57f625573b0e558d9e5dc/tool/rbinstall.rb#L774). Files having pattern `libexec/*` are chmodded to `prog_mode` (0755), otherwise to `data_mode` (0644).

----------------------------------------
Bug #17840: `make install` overriding file permission with 644
https://bugs.ruby-lang.org/issues/17840#change-91758

* Author: jaruga (Jun Aruga)
* Status: Open
* Priority: Normal
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
On the current latest master `b0b5a4e86ef2740c427f9356a4173a1debf4f79c`, by the following steps, I can see the difference between files permission between installed Ruby's gems directory installed by `make install` and gems directory installed by `gem install`. It seems that the `make install` with `tool/rbinstall.rb` overrides the file permission with 644. Is this intentional? Thanks.


```
$ autoconf
$ ./configure \
  --prefix=${HOME}/local/ruby-master-b0b5a4e \
  --enable-shared
$ make
$ make install
```

```
$ ~/local/ruby-master-b0b5a4e/bin/ruby -v
ruby 3.1.0dev (2021-04-28T18:50:15Z master b0b5a4e86e) [x86_64-linux]

$ ~/local/ruby-master-b0b5a4e/bin/gem -v
3.3.0.dev
```

Then seeing `gems/bundled_gems` file, install the same version's bundled gems to user's directory.

```
$ ~/local/ruby-master-b0b5a4e/bin/gem install -v 2.0.0 --user power_assert
$ ~/local/ruby-master-b0b5a4e/bin/gem install -v 13.0.3 --user rake
$ ~/local/ruby-master-b0b5a4e/bin/gem install -v 3.4.1 --user test-unit
$ ~/local/ruby-master-b0b5a4e/bin/gem install -v 1.2.0 --user rbs
```

Then compare files permissions.

power_assert

```
$ ls -l ~/local/ruby-master-b0b5a4e/lib/ruby/gems/3.1.0/gems/power_assert-2.0.0/bin/
total 8
-rw-r--r--. 1 jaruga jaruga 146 Apr 29 17:07 console
-rw-r--r--. 1 jaruga jaruga  74 Apr 29 17:07 setup


$ ls -l ~/.gem/ruby/3.1.0/gems/power_assert-2.0.0/bin/
total 8
-rwxrwxr-x. 1 jaruga jaruga 146 Apr 29 18:00 console*
-rwxrwxr-x. 1 jaruga jaruga  74 Apr 29 18:00 setup*
```

rake

```
$ ls -l ~/local/ruby-master-b0b5a4e/lib/ruby/gems/3.1.0/gems/rake-13.0.3/bin/
total 24
-rw-r--r--. 1 jaruga jaruga 2841 Apr 29 17:07 bundle
-rw-r--r--. 1 jaruga jaruga   85 Apr 29 17:07 console
-rw-r--r--. 1 jaruga jaruga  787 Apr 29 17:07 rake
-rw-r--r--. 1 jaruga jaruga  787 Apr 29 17:07 rdoc
-rw-r--r--. 1 jaruga jaruga  796 Apr 29 17:07 rubocop
-rw-r--r--. 1 jaruga jaruga   74 Apr 29 17:07 setup

$ ls -l ~/.gem/ruby/3.1.0/gems/rake-13.0.3/bin/
total 24
-rwxr-xr-x. 1 jaruga jaruga 2841 Apr 29 18:00 bundle*
-rwxr-xr-x. 1 jaruga jaruga   85 Apr 29 18:00 console*
-rwxr-xr-x. 1 jaruga jaruga  787 Apr 29 18:00 rake*
-rwxr-xr-x. 1 jaruga jaruga  787 Apr 29 18:00 rdoc*
-rwxr-xr-x. 1 jaruga jaruga  796 Apr 29 18:00 rubocop*
-rwxr-xr-x. 1 jaruga jaruga   74 Apr 29 18:00 setup*
```

rbs

```
$ ls -l ~/local/ruby-master-b0b5a4e/lib/ruby/gems/3.1.0/gems/rbs-1.2.0/bin/
total 40
-rw-r--r--. 1 jaruga jaruga 4369 Apr 29 17:07 annotate-with-rdoc
-rw-r--r--. 1 jaruga jaruga  338 Apr 29 17:07 console
-rw-r--r--. 1 jaruga jaruga 2977 Apr 29 17:07 query-rdoc
-rw-r--r--. 1 jaruga jaruga  200 Apr 29 17:07 rbs-prof
-rw-r--r--. 1 jaruga jaruga 1199 Apr 29 17:07 run_in_md.rb
-rw-r--r--. 1 jaruga jaruga  150 Apr 29 17:07 setup
-rw-r--r--. 1 jaruga jaruga 1856 Apr 29 17:07 sort
-rw-r--r--. 1 jaruga jaruga  103 Apr 29 17:07 steep
-rw-r--r--. 1 jaruga jaruga  710 Apr 29 17:07 test_runner.rb

$ ls -l ~/.gem/ruby/3.1.0/gems/rbs-1.2.0/bin/
total 40
-rwxr-xr-x. 1 jaruga jaruga 4369 Apr 29 18:01 annotate-with-rdoc*
-rwxr-xr-x. 1 jaruga jaruga  338 Apr 29 18:01 console*
-rwxr-xr-x. 1 jaruga jaruga 2977 Apr 29 18:01 query-rdoc*
-rwxr-xr-x. 1 jaruga jaruga  200 Apr 29 18:01 rbs-prof*
-rw-r--r--. 1 jaruga jaruga 1199 Apr 29 18:01 run_in_md.rb
-rwxr-xr-x. 1 jaruga jaruga  150 Apr 29 18:01 setup*
-rwxr-xr-x. 1 jaruga jaruga 1856 Apr 29 18:01 sort*
-rwxr-xr-x. 1 jaruga jaruga  103 Apr 29 18:01 steep*
-rwxr-xr-x. 1 jaruga jaruga  710 Apr 29 18:01 test_runner.rb*
```

test-unit

```
$ ls -l ~/local/ruby-master-b0b5a4e/lib/ruby/gems/3.1.0/gems/test-unit-3.4.1/test/run-test.rb 
-rw-r--r--. 1 jaruga jaruga 620 Apr 29 17:07 /home/jaruga/local/ruby-master-b0b5a4e/lib/ruby/gems/3.1.0/gems/test-unit-3.4.1/test/run-test.rb

$ ls -l ~/.gem/ruby/3.1.0/gems/test-unit-3.4.1/test/run-test.rb 
-rwxr-xr-x. 1 jaruga jaruga 620 Apr 29 18:01 /home/jaruga/.gem/ruby/3.1.0/gems/test-unit-3.4.1/test/run-test.rb*
```



The reason why I choose the files is because I found the following items detected by a lint program in Fedora project. The messages mean that a file with shebang do not have executable bits.

```
rubygem-power_assert.noarch: E: non-executable-script /usr/share/gems/gems/power_assert-1.2.0/bin/console 644 /usr/bin/env ruby
rubygem-power_assert.noarch: E: non-executable-script /usr/share/gems/gems/power_assert-1.2.0/bin/setup 644 /usr/bin/env bash
rubygem-rake.noarch: E: non-executable-script /usr/share/gems/gems/rake-13.0.3/bin/bundle 644 /usr/bin/env ruby
rubygem-rake.noarch: E: non-executable-script /usr/share/gems/gems/rake-13.0.3/bin/console 644 /usr/bin/env ruby
rubygem-rake.noarch: E: non-executable-script /usr/share/gems/gems/rake-13.0.3/bin/rake 644 /usr/bin/env ruby
rubygem-rake.noarch: E: non-executable-script /usr/share/gems/gems/rake-13.0.3/bin/rdoc 644 /usr/bin/env ruby
rubygem-rake.noarch: E: non-executable-script /usr/share/gems/gems/rake-13.0.3/bin/rubocop 644 /usr/bin/env ruby
rubygem-rake.noarch: E: non-executable-script /usr/share/gems/gems/rake-13.0.3/bin/setup 644 /usr/bin/env bash
rubygem-rbs.noarch: E: non-executable-script /usr/share/gems/gems/rbs-1.0.4/bin/annotate-with-rdoc 644 /usr/bin/env ruby
rubygem-rbs.noarch: E: non-executable-script /usr/share/gems/gems/rbs-1.0.4/bin/console 644 /usr/bin/env ruby
rubygem-rbs.noarch: E: non-executable-script /usr/share/gems/gems/rbs-1.0.4/bin/query-rdoc 644 /usr/bin/env ruby
rubygem-rbs.noarch: E: non-executable-script /usr/share/gems/gems/rbs-1.0.4/bin/rbs-prof 644 /usr/bin/env ruby
rubygem-rbs.noarch: E: non-executable-script /usr/share/gems/gems/rbs-1.0.4/bin/setup 644 /usr/bin/env bash
rubygem-rbs.noarch: E: non-executable-script /usr/share/gems/gems/rbs-1.0.4/bin/sort 644 /usr/bin/env ruby
rubygem-rbs.noarch: E: non-executable-script /usr/share/gems/gems/rbs-1.0.4/bin/steep 644 /bin/sh 
rubygem-rbs.noarch: E: non-executable-script /usr/share/gems/gems/rbs-1.0.4/bin/test_runner.rb 644 /usr/bin/env ruby
rubygem-test-unit.noarch: E: non-executable-script /usr/share/gems/gems/test-unit-3.3.7/test/run-test.rb 644 /usr/bin/env ruby
```


Note this ticket is related to the following issue tickets I opened yesterday. It's to suggest to drop development files in the gem file.

* https://github.com/ruby/power_assert/issues/35
* https://github.com/ruby/rake/issues/385
* https://github.com/ruby/rbs/issues/673





-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>