[Top][All Lists]

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

Re: RFC: [PATCH] trans/fakeroot.c

From: Samuel Thibault
Subject: Re: RFC: [PATCH] trans/fakeroot.c
Date: Tue, 9 Jun 2015 11:11:55 +0200
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Svante Signell, le Tue 09 Jun 2015 10:55:35 +0200, a écrit :
> On Tue, 2015-06-09 at 10:43 +0200, Samuel Thibault wrote:
> > Svante Signell, le Tue 09 Jun 2015 10:13:46 +0200, a écrit :
> > > Done so now. Attached are two versions of a patch to fakeroot.c. In
> > > netfs_get_dirents(): call netfs_attempt_chmod() before dir_readdir() to
> > > make sure that directories are accessible (executable) before changing
> > > the underlying files.
> > 
> > Why are they not accessible?
> > 
> > We don't want to browntape-fix the issue, but really understand what is
> > happening.
> chmod -R 644 <directory> makes all directories drwr--r-- i.e. not
> accessible, as I wrote.

Ah, right :)

Sorry I'm so busy I can't even follow the thread.

So the package is actually doing something stupid (yes, that's what you
should have written in your mail to explain what is happening, actually
:) ). But it does work as root as specified by POSIX, so we have to
support it.

> Is that a brown-tape fix?

Yes: It's still trying to fix the file mode only "after the fact", only
when we happen to need more permissions, rather than "at the right
time", i.e. when the mode is "erroneously" modified. That was the point
of the patch commited in netfs_attempt_chmod before: when modifying the
mode, keep what we need to work this the files. Thinking again about it,
we added

  if (nn->openmodes & O_READ)
    real_mode |= S_IRUSR;
  if (nn->openmodes & O_WRITE)
    real_mode |= S_IWUSR;
  if (nn->openmodes & O_EXEC)
    real_mode |= S_IXUSR;

to make sure that the mode we actually set on the underlying file permit
that we can continue accessing the file as needed.  But root has all
rights anyway, the only exception is executing a file which doesn't have
+x. So netfs_attempt_chmod should could just allow everything on the
underlying file. I.e. I'd say in netfs_attempt_chmod just do

  real_mode |= S_IRUSR;
  real_mode |= S_IWUSR;
  if (nn is a directory)
    real_mode |= S_IXUSR;

so we're sure of having all rights that root would have on the
underlying file.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]