Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005219OCamlconfigure and build/installpublic2011-02-04 06:162018-03-29 19:40
Assigned Toshindere 
PlatformOSOS Version
Product Version3.12.0 
Target VersionFixed in Version4.07.0+dev/beta2/rc1/rc2 
Summary0005219: use $(INSTALL) instead of 'cp' in Makefiles
DescriptionThe "make install" target does not set proper file permissions on the installed files. Moreover, there is no easy way to fix the permissions once they are messed up.


Suppose some user uses umask 0007, and root uses umask 0022. It is normal to compile the program as an ordinary user, and to install it later as root. Therefore, during compilation, files are generated with umask 0007. Since "make install" uses a simple "cp" to copy most files, this umask 0007 is preserved during installation, and root's umask 0022 is not used. The installed files (owned by root) are therefore not readable by non-root users.

Moreover, once installed, an attempt to correct this problem by re-compiling with a different umask will fail. Suppose the user changes her umask to 0022, and re-compiles from a fresh copy of the sources. Now "make install", run as root, will still use "cp", and since the target file already exists, the permissions of the target file, and not the source file, will be used!! Therefore the files will still not be readable.

Moreover, since there is no "make uninstall" target, there is no simple way to find all the installed files and correct their permissions manually.

Solution: the make system should use $(INSTALL) instead of 'cp', 'cp -f', etc.
By default this should be set to INSTALL=install, which will set permissions correctly. It could also be set to a shell script, or to 'cp -f', if an 'install' program is not available at the target system.

Patch attached.
Attached Filespatch file icon ocaml-3.12.0-install.patch [^] (26,397 bytes) 2011-02-04 06:16 [Show Content]

- Relationships
related to 0001919assignedshindere 2 installation issues: permissions and emacs files 

-  Notes
doligez (administrator)
2011-05-17 16:37

Will also need to update configure to autodetect a compatible version of install...
gerd (reporter)
2011-07-21 23:44

Note that there are several versions of install (still). Because of this one should at least have the option to set the path of the install binary in the configure script.

In GODI we added a godi_install program to handle this issue, which always provides a BSD-compatible install. Maybe this is also a way to get here around this difficulty, just add a comparable program to the ocaml distribution.
gasche (administrator)
2018-03-29 14:47

I propose a new patch to do this in [^]

I believe that my patch uses 'install' in a portable way, that should work on all the systems we support (Linux distributions use the version from GNU coreutiles, Windows seems to use linux-compatible cygwin tools, and OSX and BSDs use a BSD install):

- I only use the invocation forms (install files... dir) or (install src dst), which are supported by both GNU install and BSD install
- The only option used is `-m <mode>`, and the modes used by the patch are symbolic modes (u+rw,g+rw,o+r and u+rwx,g+rwx,o+rx), which both tools should support (see [^] for FreeBSD's chmod(1) manpage).
gasche (administrator)
2018-03-29 19:40

Fixed by merging GPR#1680.

- Issue History
Date Modified Username Field Change
2011-02-04 06:16 selinger New Issue
2011-02-04 06:16 selinger File Added: ocaml-3.12.0-install.patch
2011-05-17 16:37 doligez Note Added: 0005901
2011-05-17 16:37 doligez Status new => acknowledged
2011-07-21 23:44 gerd Note Added: 0006053
2012-01-27 15:54 doligez Relationship added related to 0001919
2012-07-10 17:04 doligez Target Version => 4.01.0+dev
2012-07-31 13:36 doligez Target Version 4.01.0+dev => 4.00.1+dev
2012-09-19 15:01 doligez Target Version 4.00.1+dev => 4.01.0+dev
2013-08-12 16:20 doligez Target Version 4.01.0+dev => 4.02.0+dev
2013-08-12 16:26 doligez Target Version 4.02.0+dev => 4.01.1+dev
2013-10-08 15:23 doligez Tag Attached: patch
2014-05-25 20:20 doligez Target Version 4.01.1+dev => 4.02.0+dev
2014-07-30 23:12 doligez Category OCaml general => OCaml internal build/install (Makefiles, configure)
2014-07-30 23:12 doligez Target Version 4.02.0+dev => 4.02.1+dev
2014-09-04 00:25 doligez Target Version 4.02.1+dev => undecided
2014-09-24 20:21 doligez Target Version undecided => 4.03.0+dev / +beta1
2016-04-19 14:14 doligez Target Version 4.03.0+dev / +beta1 => 4.03.1+dev
2016-12-13 09:32 shindere Assigned To => shindere
2016-12-13 09:32 shindere Status acknowledged => assigned
2017-02-16 14:00 doligez Target Version 4.03.1+dev => undecided
2017-02-23 16:38 doligez Category OCaml internal build/install (Makefiles, configure) => configure and build/install
2017-03-15 11:14 doligez Target Version undecided =>
2018-03-29 14:47 gasche Note Added: 0018964
2018-03-29 19:40 gasche Note Added: 0018968
2018-03-29 19:40 gasche Status assigned => resolved
2018-03-29 19:40 gasche Fixed in Version => 4.07.0+dev/beta2/rc1/rc2
2018-03-29 19:40 gasche Resolution open => fixed

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker