Ticket #4982 (closed bug: fixed)

Opened 2 years ago

Last modified 2 years ago

ghc-7.0.1: make install sets not enough permissions on library documentation

Reported by: Lemming Owned by: duncan
Priority: high Milestone: 7.0.4
Component: Build System Version: 7.0.1
Keywords: Cc:
Operating System: Linux Architecture: x86
Type of failure: Installing GHC failed Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

I have installed GHC-7.0.1 from http://www.haskell.org/ghc/dist/7.0.1/ghc-7.0.1-i386-unknown-linux.tar.bz2 and installed it with 'configure' and 'sudo make install'. I get:

$ ls -l /usr/local/share/doc/ghc/html/libraries/
drwx------  3 root root   4096 2011-02-26 20:23 array-0.3.0.2
drwx------  3 root root  16384 2011-02-26 20:22 base-4.3.0.0
drwxr-xr-x  3 root root   4096 2011-02-26 20:23 bin-package-db-0.0.0.0
drwx------  3 root root   4096 2011-02-26 20:23 bytestring-0.9.1.8
drwx------  3 root root  12288 2011-02-26 20:23 Cabal-1.10.0.0
...
$ ls -l /usr/local/share/doc/ghc/html/
drwxr-xr-x  2 root root 4096 2011-02-26 20:24 Cabal
drwxr-xr-x  2 root root 4096 2011-02-26 20:24 haddock
drwx------  4 root root 4096 2011-02-26 19:31 html
-rw-r--r--  1 root root 1557 2011-02-26 20:24 index.html
drwxr-xr-x 66 root root 4096 2011-02-26 20:24 libraries
drwxr-xr-x  2 root root 4096 2011-02-26 20:24 users_guide

That is, the library documentation directories and /usr/local/share/doc/ghc/html/html/ have not enough permissions set for user access.

Change History

Changed 2 years ago by Lemming

The same applies to the files in /usr/local/lib/ghc-7.0.1/package.conf.d/ and the library directories in /usr/local/lib/ghc-7.0.1/ such as

/usr/local/lib/ghc-7.0.1/array-0.3.0.2/
/usr/local/lib/ghc-7.0.1/base-4.3.0.0/
...

Changed 2 years ago by Lemming

I think we already had this problem in an earlier release: #2781

Changed 2 years ago by Lemming

  • failure changed from None/Unknown to Installing GHC failed

Changed 2 years ago by igloo

  • priority changed from normal to high
  • milestone set to 7.0.3

Thanks for the report. Confirmed with 7.0.2 RC 2:

$ umask
077
$ ./configure --prefix=`pwd`/inst
[...]
$ make install
[...]
$ ls -l inst/share/doc/ghc/html/libraries
total 3644
drwx------ 3 ian ian   12288 Feb 26 21:25 Cabal-1.10.1.0
drwx------ 3 ian ian    4096 Feb 26 21:25 array-0.3.0.2
drwx------ 3 ian ian   20480 Feb 26 21:25 base-4.3.1.0
drwx------ 3 ian ian    4096 Feb 26 21:25 bin-package-db-0.0.0.0
drwx------ 3 ian ian    4096 Feb 26 21:25 bytestring-0.9.1.10
drwx------ 3 ian ian    4096 Feb 26 21:25 containers-0.4.0.0
drwx------ 3 ian ian    4096 Feb 26 21:25 directory-1.1.0.0
-rw-r--r-- 1 ian ian    3437 Feb 26 21:25 doc-index-124.html
-rw-r--r-- 1 ian ian    4650 Feb 26 21:25 doc-index-33.html
-rw-r--r-- 1 ian ian    4269 Feb 26 21:25 doc-index-36.html
[...]

Changed 2 years ago by igloo

  • owner set to igloo

Changed 2 years ago by igloo

  • owner changed from igloo to duncan

OK, Distribution/Compat/CopyFile.hs has

setFileOrdinary,  setFileExecutable  :: FilePath -> IO ()
#ifndef mingw32_HOST_OS
setFileOrdinary   path = setFileMode path 0o644 -- file perms -rw-r--r--
setFileExecutable path = setFileMode path 0o755 -- file perms -rwxr-xr-x

so I think the Cabal's createDirectoryIfMissingVerbose needs to do something similar. But note that when making parent directories too, it'll need to set perms on all the parent directories it creates as well; i.e. it needs to reimplement createDirectoryIfMissing - or better, propose a new directory function that takes a file mode (hmm, need to think about what happens on Windows, though. Maybe it would need to be a unix function instead?).

Duncan, this is in Cabal-land, so assigning to you.

Changed 2 years ago by duncan

  • status changed from new to closed
  • resolution set to fixed

Fixed in Cabal head and the cabal-1.10 branch. Also pushed to the cabal mirror used by ghc-7.0.x branch. It'll be fixed in ghc HEAD when it's Cabal repo is next synced.

Tue May 17 12:23:44 BST 2011  Duncan Coutts <duncan@community.haskell.org>
  * Reimplement createDirectoryIfMissingVerbose to use sensible file permissions
  Hopefully should fix ghc ticket #4982.
  The problem was permissions on directories: previously we used ordinary
  createDirectory and on unix this creates dirs using the current user's
  umask. If the root user has a silly umask then someone doing sudo
  install will end up with dirs that are not readable by non-root users.
  
  So the solution is to do the same as we do with files: override the
  umask and explicitly set the file permissions based on the kind of
  file: ordinary file, executable file and now also directory.
  
  Sadly we also had to re-implement createDirectoryIfMissing to use our
  new createDirectory wrapper function.

Changed 2 years ago by simonmar

  • milestone changed from 7.2.1 to 7.0.4

Updating milestones so we can see what's fixed in 7.0.4.

Note: See TracTickets for help on using tickets.