[Top][All Lists]

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

[2.1.0p1] filedir.c:CheckCopiedFile() code weirdness

From: Sergio . Gelato
Subject: [2.1.0p1] filedir.c:CheckCopiedFile() code weirdness
Date: Sun, 14 Dec 2003 00:08:40 +0100
User-agent: Mutt/1.3.28i

Not a confirmed bug but rather a request for clarification. Sent to bug-
rather than help- since it's closely related to my earlier bug reports
and patches.) In CheckCopiedFile() I see the following code:

if ((plus == 0) && (minus == 0))
    newplus = sstat->st_mode & 07777 | plus;
    newminus = ~(sstat->st_mode & 07777 & ~minus) & 07777;

I find this code rather strange since the expressions for newplus and
newminus could have been written more simply (both |plus and &~minus 
are no-ops in this context where plus==0 and minus==0).

One wonders if the conditional expression is correct as coded. This is
really a question about the semantics of mode= attributes in copy:
stanzas. I initially stumbled upon this while tracking down a bug
whereby a mode 0777 source directory, together with mode=go-w in the
stanza, would result in the destination directory being mode 0000.
(I think my earlier RecursiveImage() patch will cure that problem.)

"mode=go-w" translates to (plus==0, minus==0022). As the code now
stands, this will be relative to the current permissions of the
destination file or directory. Is that correct behaviour, or should
the specification be interpreted relative to the source permissions?

[As it turns out, I could get what I want with mode=644 since there
is code in CheckExistingFile() to turn on the missing x bits on 
directories. But I don't recall seeing that feature documented
so I'd prefer not to rely on it. Nor does a mere workaround 
make an acceptable answer.]

reply via email to

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