bin/139314: /usr/bin/install -d reports success on failure

Mikolaj Golub to.my.trociny at gmail.com
Tue Oct 13 20:20:05 UTC 2009


The following reply was made to PR bin/139314; it has been noted by GNATS.

From: Mikolaj Golub <to.my.trociny at gmail.com>
To: Thomas Swan <thomas.swan at gmail.com>
Cc: bug-followup at FreeBSD.org
Subject: Re: bin/139314: /usr/bin/install -d reports success on failure
Date: Tue, 13 Oct 2009 23:18:39 +0300

 On Fri, 2 Oct 2009 19:10:59 GMT Thomas Swan wrote:
  TS> as root:
  TS> # /usr/bin/install -d -m755 /tmp/root-owned
 
  TS> as a mortal:
  TS> $ /usr/bin/install -d -m755 /tmp/root-owned
  TS> install: chmod 755 /tmp/root-owned: Operation not permitted
  TS> $ echo $?
  TS> 0
 
 Actually I am not 100% sure this is a bug. Please note, the message is that it
 was not able to chmod, not to create directory. install(1) considers this is
 as a warning, not a error message.
 
 If you try to create new directory then you will get error exit code:
 
 zhuzha:~% /usr/bin/install -d -m755 /tmp/root-owned/test
 install: mkdir /tmp/root-owned/test: Permission denied
 zhuzha:~% echo $?                                       
 71
 
 In the install code warn() is called when chmod() has failed. So if this still
 looks like a bug the patch is simple -- just replace warn(...) with
 err(EX_OSERR, ...).  But then may be the same thing should be done on chown()
 failure (currently warn() is called here too).
 
 -- 
 Mikolaj Golub


More information about the freebsd-bugs mailing list