[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

dpkg/main/help.c



Ian,

in the following code:

int chmodsafe_unlink(const char *pathname) {
  struct stat stab;

  if (lstat(pathname,&stab)) return -1;
  if (S_ISREG(stab.st_mode) ? (stab.st_mode & 07000) :
      !(S_ISLNK(stab.st_mode) || S_ISDIR(stab.st_mode) ||
   S_ISFIFO(stab.st_mode) || S_ISSOCK(stab.st_mode))) {
    /* We chmod it if it is 1. a sticky or set-id file, or 2. an
     * unrecognised object (ie, not a file, link, directory, fifo or
     * socket
     */
    if (chmod(pathname,0600)) return -1;
  }
  if (unlink(pathname)) return -1;
  return 0;
} 

I'm building for an environment where files shared between debian virtual
servers are half-immutable.  That is, their "linkage" is not immutable, so
additional links may be added or removed to the file, but the inode itself
is immutable.  See http://sam.vilain.net/immutable/ for my kernel patch
and patch to e2fsprogs if you're interested.  This trick allows me to
share libraries between virtual servers, with all of the space and memory
saving benefits this entails.

In this environment, the chmod() will fail, and this is causing my
`apt-get install ssh' to fail.

I take it that the chmod is really just a paranoia issue; don't you think
it would be better just to carry on (but still fail if the unlink fails) ?
--
   Sam Vilain, sam@vilain.net     WWW: http://sam.vilain.net/
    7D74 2A09 B2D3 C30F F78E      GPG: http://sam.vilain.net/sam.asc
    278A A425 30A9 05B5 2F13

  Nobody can be exactly like me.  Even I have trouble doing it.
TALLULAH BANKHEAD


-- 
To UNSUBSCRIBE, email to debian-dpkg-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: